Closed ktbyers closed 7 years ago
One more example, an ACL change where the order of the ACL has changed, but all the lines entirely match for ACL entries.
Router config:
ip access-list extended TEST1
permit ip any host 1.1.1.1
permit ip any host 1.1.1.2
permit ip any host 1.1.1.3
permit ip any host 1.1.1.4
permit ip any host 1.1.1.5
permit ip any host 2.2.2.2
New merge file:
logging buffered 12000
no logging console
ip access-list extended TEST1
permit ip any host 2.2.2.2
permit ip any host 1.1.1.1
permit ip any host 1.1.1.2
permit ip any host 1.1.1.3
permit ip any host 1.1.1.4
permit ip any host 1.1.1.5
What Cisco IOS reports:
show archive config incremental-diffs flash:/merge_config.txt
!List of Commands:
!
!The following order-dependent line(s) were re-ordered
!ip access-list extended TEST1
! permit ip any host 1.1.1.1
! permit ip any host 1.1.1.2
! permit ip any host 1.1.1.3
! permit ip any host 1.1.1.4
! permit ip any host 1.1.1.5
end
!No changes were found
What napalm-ios would show:
+!The following order-dependent line(s) were re-ordered
+!ip access-list extended TEST1
+! permit ip any host 1.1.1.1
+! permit ip any host 1.1.1.2
+! permit ip any host 1.1.1.3
+! permit ip any host 1.1.1.4
+! permit ip any host 1.1.1.5
If the 'show archive config incremental-diffs flash:/merge_config.txt', then it will fall back to old method and print some warning about this.
That's fantastic @ktbyers!
I would be curious if NX-OS has something similar we could use. I will have a look soon and check that out!
Very cool. Good find @ktbyers with this incremental-diffs command.
@mirceaulinic nothing like this I'm aware of on NX-OS unless we use a system generated checkpoint file (which is how napalm works today for a config replace).
+100000
This is great! Any caveat like OS support or something that we should add to the documentation?
Thanks for info @jedelman8!
@dbarrosop I didn't see any new caveats, but let me dig into it some more. I did add a handler so if the command fails (i.e. '% Invalid' it will fall back to the old way).
Working branch is here:
https://github.com/ktbyers/napalm-ios/tree/devel
Note, I still have some print debugging in the code and some other minor things need cleaned up.
Implemented here: https://github.com/napalm-automation/napalm-ios/pull/100
Cisco IOS has the following:
It compares against the running config. This looks like a better solution than what we currently have (which is just to echo the config commands in merge file).
I have a working proof-of-concept of this.
Here is what I observed for behavior:
Test merge file that had:
Where this matched what was in current config:
What Cisco IOS returns:
What napalm-ios would return:
Test merge file:
logging buffer size is different than current config
What Cisco IOS returns:
What napalm-ios would return:
Test merge file:
What router current config is:
What Cisco IOS shows:
What napalm-ios would show:
Note, the '-' prefixing is handled in napalm-ios and is relatively stupid i.e. if the command line starts with a 'no ' it will be prefixed with a minus sign.