Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollback rescue function not working as expected JunOS 19.4R3.11 #1098

Open
dseira opened this issue Mar 24, 2021 · 0 comments
Open

Rollback rescue function not working as expected JunOS 19.4R3.11 #1098

dseira opened this issue Mar 24, 2021 · 0 comments

Comments

@dseira
Copy link

dseira commented Mar 24, 2021

I'm playing with pyez to restore configuration from rescue but it is not working as expected with the JunOS 19.4R3.11 (also tried with JunOS 20.3R1).

The scenario is:

router1.lab -> JunOS 19.4R3.11
router2.lab -> JunOS 18.2R3-S5.3

The code I am using is very simple:

with Device(host='router1.lab', user=username, password=password) as dev:
    with Config(dev, mode='exclusive') as cu:
        cu.load('set interfaces ae1 unit 11000 vlan-id 4000', format='set')
        cu.pdiff()
        cu.commit()

The pdiff just shows the following:

[edit interfaces ae1]
+    unit 11000 {
+        vlan-id 4000;
+    }

To rollback to the rescue, the code is:

with Device(host=router,user=username, password=password) as dev:
    with Config(dev, mode='exclusive') as cu:
        rescue = cu.rescue(action="reload")
        if rescue is False:
            print ("No existing rescue configuration.")
        else:
            cu.pdiff()
            cu.commit()

In both cases (router1 and router2) the pdiff show:

[edit interfaces ae1]
-    unit 11000 {
-        vlan-id 4000;
-    }

The strange behaviour is that in router1 (19.4R3.11) some "ghost" configuration is left:

show configuration interfaces ae1 unit 11000

Shows nothing as expected in both routers. But in router1 the command:

show interfaces ae1.11000

Shows unit interface related info (just in router1):

  Logical interface ae1.11000 (Index 101) (SNMP ifIndex 591)
    Flags: Up SNMP-Traps 0x4000 VLAN-Tag [ 0x8100.4000 ]  Encapsulation: ENET2
    Statistics        Packets        pps         Bytes          bps
    Bundle:
        Input :             0          0             0            0
        Output:             0          0             0            0

Furthermore, should you call cu.rollback(1) instead of cu.rescue, the pdiff shows the same as with rescue:

[edit interfaces ae1]
-    unit 11000 {
-        vlan-id 4000;
-    }

But in this case, the "ghost" configuration isn't left (as expected):

router1> show interfaces ae1.11000
error: interface ae1.11000 not found

Is there something that I'm missing on using the cu.rescue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants