Is it possible to do a command line discovery of devices in Spectrum – I want to use CLI to discover devices is this possible

Document ID : KB000125433
Last Modified Date : 29/01/2019
Show Technical Document Details
Introduction:
Tech doc explaining how to run a scripted discovery of multiple devices via CLI
 
Question:
Is it possible to do a command line discovery of devices in Spectrum – I want to use CLI to discover devices is this possible
 
Answer:
Yes, you can discover devices into Spectrum using CLI.
A command line discovery of devices would need to be scripted by the customer using an approach similar to this:
If the customer has a list of ip addresses to discover, then they can write a script to discover each individual ip in the list.
For example, the list of ip addresses would be 1 ip (or range) per line:
192.168.2.4
192.168.2.8
192.168.2.10–192.168.2.23
192.168.2.27
192.168.2.32
Let’s say the filename for this list is “ip_list.txt”. The script would look something like the following:
#!/bin/sh
./connect
for IP in ‘cat ip_list.txt’
do
./create model ip=$IP comm=public
done
./disconnect
If they want it to be placed in a specific container, they would need to modify the script to grab the model handle of the newly created device and add the “create association” to associate the new model to the container.