Hi everyone. Is there a way to configure mass import of devices into NCS? I have a network of devices from a couple different vendors. Is there a native way to configure these en masse? If not, I have an idea of how to do this, but I want to make sure I am not reinventing the wheel.
Solved! Go to Solution.
I prepared it for a POC and showed a couple of options:
- one bash script to load devices from csv file
- one python script to delete the same servers
There are many ways of doing this such as using ncs_load, ncs_cli, netconf-console, REST API, creating a script that reads an excel or csv file and loads it into NCS using any of the previously mentioned options, ...
Here is an example using the ncs_load tool:
Create an XML file containing the relevant information about the devices such as:
Use the ncs_load tool to upload the devices into NCS:
ncs_load -l -m devices.xml
A sample format of devices.xml
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>deviceXYZ.cisco.com</name>
<address>x.x.x.x</address>
<port>22</port>
<ssh> ... </ssh>
<state> <admin-state>unlocked</admin-state> </state>
<authgroup>default</authgroup>
<device-type>
<cli> <ned-id xmlns:cisco-ios-xr-id="http://tail-f.com/ned/cisco-ios-xr-id">cisco-ios-xr-id:cisco-ios-xr</ned-id> </cli>
</device-type>
</device>
<device> ... </device>
<device> ... </device>
...
</devices>
I guess the easiest way is to prepare the device xml config and import it using the “ncs_load -m -l <file>” command.
Hi,
Couldnt find the discovery package?
ok so I found it under packages folder
Hi Shantha – thank you for your email. Glad you were able to locate the package.
Regards,
Khara
Khara Grant
Communication
khgrant@cisco.com<mailto:khgrant@cisco.com>
Tel: +1 678 352 2678
Cisco Systems, Inc.
United States
cisco.com
Think before you print.
This email may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
Please click here<http://www.cisco.com/c/en/us/about/legal/terms-sale-software-license-agreement/company-registration-information.html> for Company Registration Information.
Here the bash script text as file was filtered by anti-virus.
#!/bin/bash
INPUT=lab_equipment_list.csv
CLI=${NCS_DIR}/bin/ncs_cli
#CLI=cat
while IFS=, read -ra arr; do
IP=${arr[0]}
NAME=${arr[1]}
MODEL=${arr[2]}
NEDType=${arr[3]}
echo "Adding:" ${NAME} " NedType: " ${NEDType}
case $NEDType in
cisco-ios)
nedconfig="set device device ${NAME} device-type cli ned-id cisco-ios "
;;
cisco-iosxr)
nedconfig="set device device ${NAME} device-type cli ned-id cisco-ios-xr"
;;
netconf)
nedconfig="set device device ${NAME} device-type netconf"
;;
esac
$CLI << CommandsHERE
configure
set devices device ${NAME} address ${IP}
set devices device ${NAME} port 22
set devices device ${NAME} authgroup default
set devices device ${NAME} state admin-state unlocked
${nedconfig}
commit
exit
exit
CommandsHERE
done < $INPUT
A side note is there's also a device discovery package within nso
Basically you specify the mgmt ip range/set, nso will try to connect and report upon request what it discovers
I did this, and there I also had the issue that the the amount of devs was large. 50k devs.
At the time I concluded that adding them one by one was slower than preparing one fat XML file for all of them and then just load with ncs_load -l -m
Hi everyone. I finished a script that takes a MATE plan file and imports the routers into NCS. I can send it out in a bit when I get back.
I tested it and it worked in a 25 router lab.
Thanks,your updates are really helpful.
I see you have worked on clustering setup,was wondering how were you keeping your service node updated with devices from device nodes.
The service node requires each of the remote node managed devices to be added in service node..