Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

Network Change & Configuration Management

Reply
Highlighted

Interfaces IP address

Techie
Posts: 3
1964     0

What is the API method to get the list of Interfaces including IP address for a given device?

 

 

Here is what I'm doing 

 

1. Get list of switch and switch-router for device name like 081010 - 

/api/3/devices/find?op_DeviceName=like&val_c_DeviceName=08101%

2. Get the interfaces of device type 'switch-router' -

/api/3/interfaces/find?DeviceID=1657709

 

When i use the web interface(iresults/DeviceViewer/index.tdf?DeviceID=1657709&Content=/webui/settings/management_status&selectedAccordion=Settings___Status&selectedMenu=Management_Status&selectedTitle=Management%20Status)

I see only 21 interfaces. It shows IP address and Interface name . But through API it return 80 interfaces and it has no IP address.

 

Highlighted

Re: Interfaces IP address

[ Edited ]
Authority
Posts: 32
1965     0

 

There is not a single API call that will return the list of all interfaces, including their IP address.  The Interface Table and the Address Table are queried seperately.  This is similar to the way the data is obtained via SNMP from the devices themselves -- with interfaces in ifTable, and addresses in ipAddrTable, and using the value of ifIndex to connect them.

 

So you would use a call like api/3.1/interfaces?DeviceID=2 to get all the physical interfaces, and then use a second call to api/3.1/if_addrs?DeviceID=2 to get the list of IP addresses.  Only those interfaces whose ifIndex appears in both outputs have IP addresses.

 

Of course, if you are only interested in getting a list of IP addresses, and not any of the other interface data from ifTable, then the call to if_addrs is all you need.

 

-Marc-

Showing results for 
Search instead for 
Do you mean 

Recommended for You