ExtremeCloud IQ- Site Engine & Extreme Management Center

Expand all | Collapse all

Get Network Inventory IPs with Script

  • 1.  Get Network Inventory IPs with Script

    Posted 06-28-2018 13:41
    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.


  • 2.  RE: Get Network Inventory IPs with Script

    Posted 06-28-2018 14:12
    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


  • 3.  RE: Get Network Inventory IPs with Script

    Posted 06-28-2018 23:08
    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):[/code] 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")
    [/code]


  • 4.  RE: Get Network Inventory IPs with Script

    Posted 07-01-2018 17:59
    Or if you don't like soap 😉, you can use REST calls like:

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


  • 5.  RE: Get Network Inventory IPs with Script

    Posted 06-28-2018 14:12
    Yeah, I'm looking for the switches.

    Thanks, I'll give this a shot.