cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Get Network Inventory IPs with Script

Get Network Inventory IPs with Script

Terren_Crider
Contributor
I'm working on a Python script to help with some networking tasks. Is there a way that I can get the IPs of my network devices from EMC programatically? Rather than hardcoding the IPs in the script, I'd like to use EMC as the authoritative source for that information. It would be even better if I could pull other attributes like OS and Version, as well.

I've been looking at the API, but I haven't seen a way to use that method to pull the information.
4 REPLIES 4

StephanH
Valued Contributor III
Or if you don't like soap ļ˜‰, you can use REST calls like:

import requestsuser = 'your user'
pw = 'your password'
xmcip = 'your xmcip:8443'
request = '/axis/services/NetSightDeviceWebService/getAllDevices'
r = requests.get('https://' + user + ':' + pw + '@' + xmcip + request, verify = False)
Regards Stephan

Gates_Zeng
Extreme Employee
Hi Terren,

The APIs are defined in the wsdl file.

Here are several lines of python code for your reference:

import deep
def service (self, xmc_ip): wsdl_url = 'https://' + xmc_ip +':8443/axis/services/NetSightDeviceWebService?wsdl'
client = zeep.CachingClient (wsdl=wsdl_url, transport=self.transport, strict=False)
return client.bind ('NetSightDeviceWebService', "NetSightDeviceWebServiceSOAP11port_https1")

StephanH
Valued Contributor III
Hello Terren,

are you looking for network devices like switches or end systems (=clients)?

All switch data you will receive with:

  1. Get all devices (and there ips) with this command: "https://YourNetSightIP:8443/axis/services/NetSightDeviceWebService/getAllDevices". Take all ips form the answer to this request and put the ips in the command here:
  2. "https://YourNetSightIP:8443/axis/services/InventoryWebService/getDeviceProperties?ipAddress=IpFromStepOne" in a loop of you script.
Best regards
Stephan
Regards Stephan

Yeah, I'm looking for the switches.

Thanks, I'll give this a shot.
GTM-P2G8KFN