napalm-automation / napalm-ios

Apache License 2.0
31 stars 40 forks source link

New feature: commit confirmed #121

Closed mirceaulinic closed 7 years ago

mirceaulinic commented 7 years ago

See details in the parent issue napalm-automation/napalm-base#214

mirceaulinic commented 7 years ago

Hi @ktbyers - I recall we have discussed about this in the past and - if I'm not wrong - you said you have an idea how to implement this. Is that correct? If so, could you please expose a bit the idea, I'd like to give it a try. Thanks!

ktbyers commented 7 years ago

@mirceaulinic It looks like we should be able to do something like this (note, time is in minutes).

test123#configure replace flash:/candidate_config.txt force time 2
Rollback Confirmed Change: Backing up current running config to flash:pynet-rtr1-cfgMar--8-09-32-38.872-PST-19

Total number of passes: 1
Rollback Done

pynet-rtr1#

# Eventually just rolled back the change
pynet-rtr1#                  
test123#

# Logging showed this
test123#show logging
...
Mar  8 09:32:19.824 PST: %SYS-5-CONFIG_I: Configured from console by pyclass on vty0 (54.219.38.58)
Mar  8 09:32:40.356 PST: %ARCHIVE_DIFF-5-ROLLBK_CNFMD_CHG_BACKUP: Backing up current running config to flash:pynet-rtr1-cfgMar--8-09-32-38.872-PST-19
Mar  8 09:32:40.360 PST: Rollback:Acquired Configuration lock.
Mar  8 09:32:42.401 PST: %ARCHIVE_DIFF-5-ROLLBK_CNFMD_CHG_START_ABSTIMER: User: pyclass(Priv: 15, View: 0): Scheduled to rollback to config flash:pynet-rtr1-cfgMar--8-09-32-38.872-PST-19 in 2 minutes
Mar  8 09:33:42.402 PST: %ARCHIVE_DIFF-5-ROLLBK_CNFMD_CHG_WARNING_ABSTIMER: System will rollback to config flash:pynet-rtr1-cfgMar--8-09-32-38.872-PST-19 in one minute. Enter "configure confirm" if you wish to keep what you've configured
Mar  8 09:34:42.404 PST: %ARCHIVE_DIFF-5-ROLLBK_CNFMD_CHG_ROLLBACK_START: Start rolling to: flash:pynet-rtr1-cfgMar--8-09-32-38.872-PST-19
Mar  8 09:34:42.436 PST: Rollback:Acquired Configuration lock.

# Here I do the same thing, but confirm it
test123#configure replace flash:/candidate_config.txt force time 2
Rollback Confirmed Change: Backing up current running config to flash:pynet-rtr1-cfgMar--8-09-35-54.346-PST-20

Total number of passes: 1
Rollback Done

pynet-rtr1#configure confirm         
ktbyers commented 7 years ago

@mirceaulinic I also see this configuration lock which we probably should be using:

pynet-rtr1#configure terminal lock 
Configuration session is locked. The lock will be cleared once you exit out of configuration mode.
Enter configuration commands, one per line.  End with CNTL/Z.

In another SSH session, I then tried:

pynet-rtr1#conf t
Configuration mode is locked by process '78' user 'pyclass' from terminal '8'. Please try later.
mirceaulinic commented 7 years ago

Ah that's really nice! I believed that's going to be way harder. I plan for next week to focus more on the whole epic: https://github.com/napalm-automation/napalm-base/issues/214 and I will try an implementation if you don't beat me :)

ktbyers commented 7 years ago

@mirceaulinic Yes, Cisco IOS for all its automation failings has so many features in it...that you can retrofit a lot of things onto it.

ktbyers commented 7 years ago

We have PR on this. Closing the issue.