DX NetOps

 View Only
  • 1.  REST Query on GET Interface

    Posted Aug 16, 2016 09:48 AM

    We are trying to get a list of interfaces for a device from REST and obviously can do it via left associations.

    However I have seen GET_INTERFACES listed but no idea of how to use this in a better way than the associations and nothing on the forum to help me.

     

    Has anyone used it and can provide an example of how it can work ?

     

    Cheers,



  • 2.  Re: REST Query on GET Interface

    Posted Aug 16, 2016 10:01 AM

    Hi Ian,

     

    This is Balta.

     

    I'm not sure I've understood what exactly is what you are trying to achieve. Do you want to use the webservices_rest probe to get a list of a device's interfaces?

     

    Thanks.

     

    Best regards,

     

    Balta.



  • 3.  Re: REST Query on GET Interface
    Best Answer

    Posted Aug 16, 2016 10:15 AM

    To return all interfaces of a device, you would issue a POST with this XML to the REST API endpoint '/spectrum/restful/models'.  This is essentially a copy of the "Ports -> By Device IP" Locater search.

     

    <?xml version="1.0" encoding="UTF-8"?>

    <rs:model-request

        xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd ">

     

        <rs:target-models>

            <rs:models-search>

                <rs:search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter">

                    <action-models>

                        <action-models>

                            <filtered-models>

                                <equals>

                                    <model-type>SearchManager</model-type>

                                </equals>

                            </filtered-models>

                            <action>FIND_DEV_MODELS_BY_IP</action>

                            <attribute id="AttributeID.NETWORK_ADDRESS">

                                <value>x.x.x.x</value>   <!-- Enter Device IP here -->

                            </attribute>

                        </action-models>

                        <action>GET_INTERFACES</action>

                    </action-models>

                </rs:search-criteria>

            </rs:models-search>

        </rs:target-models>

     

        <rs:requested-attribute id="0x1006e" />

         <!-- Enter more attributes here -->

    </rs:model-request>

     

     

    Another nice easy endpoint to return only the interfaces with discovered connections, is to issue a GET to the REST API endpoint '/spectrum/restful/connectivity/<ip_address>'.



  • 4.  Re: REST Query on GET Interface

    Posted Aug 16, 2016 11:06 AM

    Thanks Ian.

     

    One quick question, if you are aiming towards Spectrum, shouldn't this thread be open in the Spectrum Community?

     

    Bestt regards,

     

    Balta.



  • 5.  Re: REST Query on GET Interface

    Posted Aug 16, 2016 11:26 AM

    My bad. I forgot that different products are discussed within this same thread. As we speak I don't have an answer to your question but since it is fairly new, I'm sure some other engineers/customers will step in .

     

    Best regards,

     

    Balta.