Tore Anderson <[email protected]> writes: > Hi, > > I'm trying to write a template for a commit script that, when called, > will find the first unused unit on an interface and add some transient > config to it. "Unused" means that that the unit isn't defined in the > main configuration file and that an earlier call to the template hasn't > written transient config to it yet.
I had almost exactly the same problem when trying to pick unit numbers for q-in-q interfaces. I gave up on doing it transiently and now I simply save the unit numbers in apply-macros as permanent changes. If you don't care what the unit numbers are and you are parsing objects from somewhere else to generate them, you can just do position() + 5000 like I did originally. This does not work if you might reach the maximum ID or if you are parsing objects from multiple places (so position() could repeat). Curtis Call already pointed out the problem of ID's changing. I would recommend testing it, as at least when it comes to l2circuits, the router effectively tears down all the old units and builds the new ones if the ID's change -- even if everything ends up exactly the same apart from the unit ID's. That is service-impacting. /Benny _______________________________________________ juniper-nsp mailing list [email protected] https://puck.nether.net/mailman/listinfo/juniper-nsp

