You can generate and run scripts on the VMware Aria Operations for Networks Collector CLI to discover devices in your network automatically and export the details of discovered devices to a .csv
file.
Discovering network devices by running CLI commands will be deprecated in a future release of VMware Aria Operations for Networks.
You can discover the following devices by running the CLI commands:
- Cisco switches
- Arista switches
- Juniper switches
- Dell switches
- F5 Big-IP
- Brocade switches
- Palo Alto Networks
- Check Point Firewall
- Cisco ASA
Procedure
- Log in to the VMware Aria Operations for Networks Collector CLI as a Support user.
Provide your CLI login credentials using the Secure Socket Shell (SSH) client.
- Switch to a Ubuntu user.
ub
- Run the following command to generate the Python script in your present working directory.
java -cp "/home/ubuntu/build-target/common-utils/tools-0.001-SNAPSHOT.jar" com.vnera.tools.DiscoveredDevicesTool -w script.py
You use this script to perform network discovery.
- Run the following command to generate the sample credentials file in your present working directory.
java -cp "/home/ubuntu/build-target/common-utils/tools-0.001-SNAPSHOT.jar" com.vnera.tools.DiscoveredDevicesTool -s sample_creds.csv
You use the sample credentials file to access the devices in your network.
Here is an example of the sample credentials file:
"credential_name","connection_type", "username", "password", "snmp_version", "community_string", "snmp_user", "snmp_context", "snmp_auth_type", "snmp_auth_password", "snmp_privacy_type", "snmp_privacy_password" "SSH1","SSH","admin","admin","","","","","","","","" "API1","API","admin","admin","","","","","","","","" "SNMP1","SNMP","","","v2c","community","","","","","","" "SNMP2","SNMP","","","v3","","user","context","authtype","authpass","privacytype","privacypass"
- Update the sample credentials file with your SSH, SNMP v2c, SNMPv3, or API credentials.
You can enter multiple credentials in the file by providing a unique
credential_name
for each entry.To discover F5 Big-IP load balancers, you must enter your API credentials.Note: You cannot discover other network devices using your API credentials. - Run the
help
command on the Python script to view the options supported by the script.python3 script.py --help
You can use these options to authenticate your credentials and perform network discovery.
Option Description --host The IP address of the VMware Aria Operations for Networks platform node1. --deployment type The type of deployment on which you are performing this operation. Accepted values are onprem
andsaas
.The default value is
onprem
.--username The user name of the platform user. Note: You must always enclose the username in single quotes.--password The password of the platform user. Note: You must always enclose the password in single quotes.--domain_type The domain type to authenticate user credentials. Accepted values are LOCAL
andLDAP
.--domain_value If the domain type is LDAP, provide your LDAP domain name. --proxy_ips The IP address of VMware Aria Operations for Networks Collector. --credentials_file_path The location of the credentials file which contains the SSH, SNMP, or API credentials. --network_ranges The IP address range to perform network discovery on. You can specify the IP addresses in the network range format or the CIDR range format. --seeds The seed IP addresses or the seed FQDN of network devices to begin the network discovery process.
Note:When you run the network discovery script, you begin the network discovery process with given seed IP addresses as the starting point.
Each seed's neighbor devices are discovered based on industry protocols such as CDP and LLDP. Each discovered device is then used as a seed to recursively discover other devices in your network until all devices in your network are discovered or the seed depth is reached.
--seed_depth The depth of discovering network devices.
Note:The seed depth indicates how many levels of neighbors must be explored from the seed IP address. By default, the depth of the seed is 0; the depth of the seed’s neighbors is 1; the depth of the seed’s neighbors’ neighbors is 2 and so on.
If you enter the seed depth as 2, you can discover devices of the seed, the seed's neighbors, and the seed's neighbor's neighbors.
--ignored_list The list of IP addresses to exclude from network discovery. You can specify the IP addresses in the following formats:
- Individual IP address
- FQDN
- Network range
- CIDR range
--download_discovered_devices The option to download the previously discovered devices. Enter True
orFalse
.--out The name of the CSV output file for successful network discovery. The default name of the output file is auto_gen_discovered_devices.csv. --clear_all The option to erase details of the discovery such as discovery job, credential profile, job result, and discovered devices. Enter True
orFalse
.--wait_time_in_secs The maximum wait time (in seconds) to discover devices. - Run the Python script with one of the following options:
Choice Example Provide the network range for discovery by using the --network_ranges option. python3 script.py --deployment_type onprem --username 'user' --password 'pwd' --domain_type LOCAL --proxy_ips 10.xx.196.xxx --out discovered_devices.csv --credentials_file_path sample_creds.csv --network_ranges 10.xxx.xx.158/24
Provide the seed address and the seed depth for network discovery by using --seeds and --seed_depth options. python3 script.py --deployment_type onprem --username 'user' --password 'pwd' --domain_type LDAP --domain_value vmware.com --proxy_ips 10.xx.196.xxx --out discovered_devices.csv --credentials_file_path sample_creds.csv --seeds 10.xxx.xx.xxx --seed_depth 2
Note:You must run the Python script with your updated credentials file that includes your SSH, SNMP v2c, SNMPv3, or API credentials.
The python script only discovers devices that are within the reachability scope of the collector network. It does not discover devices that are available on the network, but not accessible from the collector network.
- Based on the status of the operation, do one of the following:
Status Action The operation succeeds. Open the CSV file. An example of the CSV file is as follows:
"DataSourceType","IP","fqdn","Username","Password","CSPRefreshToken","NickName", "CentralCliEnabled","IPFixEnabled","SwitchType","ParentvCenter","IsVMC", "snmp_version","snmp_community_string","snmp_username","snmp_password", "snmp_auth_type","snmp_privacy_type","ProxyIP" "DataSource1","","Domain_name","username","<pwd>","", "nick_name_discovered_devices_1","","","","","","","","","","","","10.xx.xxx.xx" "DataSource2","10.1xx.xx.1x","","username","pwd","", " nick_name_discovered_devices_2","","","","","","","","","","","","10.xx.xx.xxx"
The operation fails or times out. Run the Python script with the --clear_all option to clear the details of the discovered devices and start a new network discover operation.
For example:
python3 script.py --deployment_type onprem --username 'user' --password 'pwd' --proxy_ips 10.xxx.xxx.xx --clear_all true
What to do next
You can bulk add the discovered network devices as data sources to VMware Aria Operations for Networks by using the operations-for-networks-sdk-python SDK. See Bulk Add Data Sources Using the Python SDK for more information.