How can I get neighour IPs using REST call with Spetrum

Document ID : KB000104959
Last Modified Date : 05/07/2018
Show Technical Document Details
Question:
How can I get neighbor IPs using REST call with Spectrum?
Answer:
There are a couple of options:

1.
A GET of associations will return associations for a specific relation and model.
URL
    http://<hostname><:portnumber>/spectrum/restful/associations/relation/<rel_handle>/model/<model_handle>?side={left | right}
HTTP Method
    GET
Body
    None
Body Content
    Not Used
Header
    application/xml, application/json
Output
    XML or JSON listing alarms in the SpectroSERVER or distributed SpectroSERVER

URL Parameters
rel_handle
    Specifies the relation handle.
model_handle
    Specifies the handle of the model in the relation.


Or
2. Use the Connectivity resource to retrieve connectivity information for a specified IP address.
Base URL
    http://<hostname><:portnumber>/spectrum/restful/connectivity

GET connectivity
A connectivity request returns XML describing all the connectivity from a requested end point.
URL
    http://<hostname><:portnumber>/spectrum/restful/connectivity/<ip_address>
HTTP Method
    GET
Body
    None
Body Content
    application/xml, application
Header
    application/xml, application/json
Output
    XML describing the connectivity
URL Parameters
    ip_address
Specifies the IP address to retrieve connectivity information for.

Example
The following URL requests connectivity information for the specified IP address:
http://localhost:8080/spectrum/restful/connectivity/172.22.94.134

The following is returned for the request:
?xml version="1.0" encoding="UTF-8"?>
<connection-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response">
    <connection-response>
        <connection-element-left>
            <ipaddress>172.22.94.134</ipaddress>
            <mh>0x400538</mh>
            <name>Stack</name>
            <type>ExtrDevice</type>
            <class>Switch-Router</class>
        </connection-element-left>
        <connection-element-left>
            <ipaddress>172.22.94.134</ipaddress>
            <mh>0x400c52</mh>
            <name>Stack_1:1</name>
            <type>ExtrIfPort</type>
            <class>Port</class>
        </connection-element-left>

        <connection-element-right>
            <ipaddress>172.22.94.25</ipaddress>
            <mh>0x400449</mh>
            <name>cis7204-96.6.ca.com.6.ca.com</name>
            <type>Rtr_Cisco</type>
            <class>Switch-Router</class>
        </connection-element-right>
        <connection-element-right>
            <ipaddress>172.22.94.25</ipaddress>
            <mh>0x4007bb</mh>
            <name>cis7204-96.6.ca.com.6.ca.com_Fa4/0</name>
            <type>Gen_IF_Port</type>
            <class>Port</class>
        </connection-element-right>
    </connection-response>
    <connection-response>
        <connection-element-left>
            <ipaddress>138.42.94.134</ipaddress>