Discover Network Devices by Running CLI
Commands
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
- Log in to theVMware Aria Operations for NetworksCollector CLI as aSupportuser.Provide your CLI login credentials using the Secure Socket Shell (SSH) client.
- Switch to aUbuntuuser.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.pyYou 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.csvYou 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 uniquecredential_namefor each entry.To discover F5 Big-IP load balancers, you must enter your API credentials.You cannot discover other network devices using your API credentials.
- Run thehelpcommand on the Python script to view the options supported by the script.python3 script.py --helpYou can use these options to authenticate your credentials and perform network discovery.OptionDescription--hostThe IP address of theVMware Aria Operations for Networksplatform node1.--deployment typeThe type of deployment on which you are performing this operation. Accepted values areonpremandsaas.The default value isonprem.--usernameThe user name of the platform user.You must always enclose the username in single quotes.--passwordThe password of the platform user.You must always enclose the password in single quotes.--domain_typeThe domain type to authenticate user credentials. Accepted values areLOCALandLDAP.--domain_valueIf the domain type is LDAP, provide your LDAP domain name.--api_tokenThe API refresh token to authenticate yourVMware Aria Operations for Networkscredentials.--cloud_locationThe location of the data center. Accepted values areUS,UK,JP,AU, andDE.The default value isUS.--cloud_api_urlThe URL ofVMware Aria Operations for Networks. This option overrides the value provided in the--cloud_locationoption.--proxy_ipsThe IP address ofVMware Aria Operations for NetworksCollector.--credentials_file_pathThe location of the credentials file which contains the SSH, SNMP, or API credentials.--network_rangesThe IP address range to perform network discovery on. You can specify the IP addresses in the network range format or the CIDR range format.--seedsThe seed IP addresses or the seed FQDN of network devices to begin the network discovery process.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_depthThe depth of discovering network devices.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_listThe 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_devicesThe option to download the previously discovered devices. EnterTrueorFalse.--outThe name of the CSV output file for successful network discovery. The default name of the output file isauto_gen_discovered_devices.csv.--clear_allThe option to erase details of the discovery such as discovery job, credential profile, job result, and discovered devices. EnterTrueorFalse.--wait_time_in_secsThe maximum wait time (in seconds) to discover devices. - Run the Python script with one of the following options:ChoiceExampleProvide the network range for discovery by using the--network_rangesoption.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/24Provide the seed address and the seed depth for network discovery by using--seedsand--seed_depthoptions.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 2ChoiceExampleProvide the network range for discovery by using the--network_rangesoption.python3 script.py --deployment_type saas --api_token YourCSPAPIToken --cloud_location UK --proxy_ips 10.xx.196.xxx --out discovered_devices.csv --credentials_file_path sample_creds.csv --network_ranges 10.xxx.xx.158/24Provide the seed address and the seed depth for network discovery by using--seedsand--seed_depthoptions.python3 script.py --deployment_type saas --api_token YourCSPAPIToken --cloud_location UK --proxy_ips 10.xx.196.xxx --out discovered_devices.csv --credentials_file_path sample_creds.csv --seeds 10.xxx.xx.xxx --seed_depth 2You 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:StatusActionThe 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_alloption 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 truepython3 script.py --deployment_type saas --api_token YourCSPAPIToken --cloud_location UK --proxy_ips 10.xx.xxx.xx --clear_all true
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.