08-01-2017 05:33 AM - edited 03-01-2019 03:56 AM
Hello,
I am trying to figure out how to copy/rename device from cli.
CLI syntax of both command are pretty much straight forward, but
I am encountering commit error.
nso_user_guide provides no information on how this command should be
committed.
## copying devices ##
I tried to copy device APIC-1, but commit failed as shown below.
----
admin@ncs(config)#
admin@ncs(config)# copy devices device APIC-1 APIC-1-bkup
admin@ncs(config)# commit
Aborted: Resource device APIC-1-bkup doesn't exist
admin@ncs(config)#
----
So I created device APIC-1-bkup and tried again, but still got error message.
----
admin@ncs(config)#
admin@ncs(config)# copy devices device APIC-1 APIC-1-bkup
Error: 'devices device APIC-1-bkup' already exists
admin@ncs(config)#
----
I deleted APIC-1-bkup and did "commit no-networking".
There was no error.
But I am not sure if this is the right step be followed.
## renaming devices ##
I tried to rename device APIC-1-bkup, but commit failed as shown below.
----
admin@ncs(config)#
admin@ncs(config)# rename devices device APIC-1-bkup APIC-1-bkup2
admin@ncs(config)# commit
Aborted: Resource device APIC-1-bkup2 doesn't exist
admin@ncs(config)#
----
So I created device APIC-1-bkup2 and tried again, but still got error message.
----
admin@ncs(config)#
admin@ncs(config)# copy devices device APIC-1 APIC-1-bkup
Error: 'devices device APIC-1-bkup' already exists
admin@ncs(config)#
----
I deleted APIC-1-bkup and did "commit no-networking".
There was no error.
But I am not sure if this is the right step to be followed.
Tried with NSO4.2 and NSO4.4, and got same result.
I am missing something?
Or is this expected behavior?
Your comment would be very much appreciated.
Best regards,
Takeru Nomura
Solved! Go to Solution.
08-02-2017 01:05 AM
Yes, commit no-networking does exactly what you say, and it is supported. And yes, you can use that as a sort of backup copy of a device config. Another option would be to save the device config to a file that you can reload or compare against in the future.
08-01-2017 06:26 AM
It is possible to copy, instantiate and rename devices when they have no configuration, as you can see here:
admin@ncs(config)# rename devices device o0 o1
admin@ncs(config)# comm
Commit complete.
admin@ncs(config)# copy devices device xr xr2
admin@ncs(config)# show c
devices device xr2
address 127.0.0.1
port 8300
ssh host-key ssh-rsa
key-data "AAAAB3NzaC1yc2EAAAADAQABAAABAQCnHt0HothNVYPd6xPJKDn1yxiLSFjqzZQ8cIU5Olnn\nO00XcnDiQUQAWxz5QaNRxHowiiDJnGKApBcHu7nXq/c3F1PW9JYrwSy+lcDBkmejrGBNioLk\nWpgQy/SlT8smXNcGApuAxLyurKrC+NC4o61YUhCmpsehIVElosRSWafYfDlT4QRwRgTaY7II\njflyc1sfIlh44prUXmBZ0DzAOUGD8QaKDTANGNDOu9A1Mu0Jw8yq+48O6Lfc+65Te22HtPmt\n9BmfB4IxRyWi38k5uWGiAohsAQ++ZN6myj+qQ/KMxl/idF0C2aEs6bYlaLnxpxt9iTu6pUlr\nVNvSNzZ2ps69"
!
authgroup vagrant
device-type netconf
state admin-state unlocked
!
admin@ncs(config)# commit no-networking
Commit complete.
I believe the issue you are encountering is that you already have some (a lot?) of configuration on the device you are copying/renaming. This will make NSO want to push this configuration to the newly created device immediately, and that fails because the device doesn't exist yet.
If you could delete the device configuration, commit no-networking, before you do the operation, then sync-from afterwards, I think it would work.
08-01-2017 06:55 PM
Hello Jan,
Thank you very much for your response!
You are exactly right in saying that my device has lots of configuration, and the mechanism you pointed out makes sense to me.
Even with large size device config, I can successfully copy/rename device if I use "commit no-networking".
As per your comment, I assume "commit no-networking" prevents NSO from pushing the config to newly created device, thus doesn't fail.
I am hoping if I can use this to temporarily backup device config along with its service metadata before reconciling out of policy config from network device and use it to restore original state when something went wrong in the reconciliation process.
So my next question is, is this renaming/coping device with config using commit no-networking supported?
In other words, is this something I can use in service model?
Any comment would be very much appreciated.
Best regards,
Takeru Nomura
08-02-2017 01:05 AM
Yes, commit no-networking does exactly what you say, and it is supported. And yes, you can use that as a sort of backup copy of a device config. Another option would be to save the device config to a file that you can reload or compare against in the future.
08-02-2017 06:34 AM
Thank you soooo much for you help!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide