08-08-2023 12:21 AM
I know that I can load merge a config from a .xml file onto a device config. And the format for that is,
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{device}</name>
<config>
<ip xmlns="urn:ios">
<name-server xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
nc:operation="delete">
</name-server>
</ip>
</config>
</device>
</devices>
I want to load merge the same config in cli format from a .txt file. My questions are,
1. Can we do that? (load merge config in cli format onto a device config)
2. If yes, what should be the format of the file?
commands in cli: (example)
no ip name-server
ip name-server {ip_1}
ip name-server {ip_2}
Solved! Go to Solution.
08-08-2023 12:15 PM - edited 08-08-2023 12:16 PM
Hello,
Regarding the first question , yes you can.
Here an example . You need to do it for a device to find the right command .
admin@ncs-run-5.8.10(config)# devices device NETSIM-XE-0 config
admin@ncs-run-5.8.10(config-config)# no ip name-server
admin@ncs-run-5.8.10(config-config)# ip name-server 10.10.10.10
admin@ncs-run-5.8.10(config-config)# ip name-server 11.11.11.11
admin@ncs-run-5.8.10(config-config)# top
admin@ncs-run-5.8.10(config)# show configuration
devices device NETSIM-XE-0
config
no ip name-server 1.1.1.1
ip name-server 10.10.10.10
ip name-server 11.11.11.11
!
admin@ncs-run-5.8.10(config)# show configuration | save conf.txt
!
Then you can load it
admin@ncs-run-5.8.10# file show conf.txt
devices device NETSIM-XE-0
config
no ip name-server
ip name-server 10.10.10.10
ip name-server 11.11.11.11
!
!
admin@ncs-run-5.8.10# conf
Entering configuration mode terminal
admin@ncs-run-5.8.10(config)# load merge conf.txt
Loading.
118 bytes parsed in 0.16 sec (728 bytes/sec)
admin@ncs-run-5.8.10(config)# commit dry-run
cli {
local-node {
data devices {
device NETSIM-XE-0 {
config {
ip {
name-server {
- name-server-list 1.1.1.1;
+ # first
+ name-server-list 10.10.10.10;
+ name-server-list 11.11.11.11;
}
}
}
}
}
}
}
2 - You can use whatever you want as extension but it's better to use .txt or .cli to avoid confusion.
08-08-2023 12:15 PM - edited 08-08-2023 12:16 PM
Hello,
Regarding the first question , yes you can.
Here an example . You need to do it for a device to find the right command .
admin@ncs-run-5.8.10(config)# devices device NETSIM-XE-0 config
admin@ncs-run-5.8.10(config-config)# no ip name-server
admin@ncs-run-5.8.10(config-config)# ip name-server 10.10.10.10
admin@ncs-run-5.8.10(config-config)# ip name-server 11.11.11.11
admin@ncs-run-5.8.10(config-config)# top
admin@ncs-run-5.8.10(config)# show configuration
devices device NETSIM-XE-0
config
no ip name-server 1.1.1.1
ip name-server 10.10.10.10
ip name-server 11.11.11.11
!
admin@ncs-run-5.8.10(config)# show configuration | save conf.txt
!
Then you can load it
admin@ncs-run-5.8.10# file show conf.txt
devices device NETSIM-XE-0
config
no ip name-server
ip name-server 10.10.10.10
ip name-server 11.11.11.11
!
!
admin@ncs-run-5.8.10# conf
Entering configuration mode terminal
admin@ncs-run-5.8.10(config)# load merge conf.txt
Loading.
118 bytes parsed in 0.16 sec (728 bytes/sec)
admin@ncs-run-5.8.10(config)# commit dry-run
cli {
local-node {
data devices {
device NETSIM-XE-0 {
config {
ip {
name-server {
- name-server-list 1.1.1.1;
+ # first
+ name-server-list 10.10.10.10;
+ name-server-list 11.11.11.11;
}
}
}
}
}
}
}
2 - You can use whatever you want as extension but it's better to use .txt or .cli to avoid confusion.
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