[j-nsp] Unit-ID's revisited / accessing committed configuration

Benny Amorsen benny+usenet at amorsen.dk
Thu Apr 26 08:53:58 EDT 2012


Is it possible to somehow get the committed configuration as it looked
after commit-scripts were applied? I do not want the commit-scripts
re-run, I simply want to fetch the configuration as it was after all
scripts were run and the commit succeeded.

To explain why I need to do this, it is necessary to go back to the unit
ID problem I posted about earlier.

To reiterate, the challenge is to generate unit ID's for a bunch of
q-in-q interfaces like this:

   unit 5239 {
        encapsulation vlan-ccc;
        vlan-tags outer 1559 inner 3;
        input-vlan-map pop-pop;
        output-vlan-map push-push;
    }

I solved it, or so I thought, by keeping all configuration in
apply-macros, like this:

apply-macro eompls-1001089 {
    inner 3;
    interface ge-1/0/4;
    outer 1559;
}

which then generates the above q-in-q interface as a transient-change.
The unit ID is simply the position of the apply-macro in the
configuration file + 5000, so this particular apply-macro happens to be
the 239th apply-macro.

It all works really well, in general. Except I had not considered what
happens if you remove an apply-macro. All is well if you remove the last
apply-macro, but if you happen to remove one of the first ones, every
interface below changes unit ID. The MX80 was less than happy about
hundreds of interfaces being torn down and rebuilt...

At this point it is tempting to give up on that design and "simply" add a
unit ID to the provisioning database and to the apply-macro. Keeping
them consistent is no fun at all.

However, I would like to give the dynamic ID's one more chance. If it is
possible to find out which unit ID the previous commit used for a
particular apply-macro, I can then reuse that unit ID. Since all the
changes my commit script does are transient, this seems to be a
challenging task.

Any help is really appreciated!


/Benny



More information about the juniper-nsp mailing list