DX NetOps

 View Only
  • 1.  Unable to get the attributes based on the model class

    Posted Jul 10, 2017 04:39 AM

    Hello Experts,

     

    I am trying to use HTTP GET method to get the attributes based on the model class value. I have used below url to get the attributes where the model class value is '0' and the requested attribute values of 0x1006e,0x11ee8 and 0x110df.

     

    URL: http://localhost/spectrum/restful/attribute/0x11ee8/enums/?id=0&val=Unknown&attr=0x1006e&attr=0x11ee8&attr=0x110df&throttlesize=100

     

    but this url response gives me a full list of model classes, not the requested one. Please help me on this. Attached screen shot for reference.



  • 2.  Re: Unable to get the attributes based on the model class
    Best Answer

    Broadcom Employee
    Posted Jul 10, 2017 09:11 PM

    Hi Vijay,

     

    I'm not sure if this will work, i.e. getting attributes of individual models using the GET attribute request. You can see the following docops description of the request and it only shows it to be used for returning the enumerations of the specified attribute:

     

    GET attribute request

     

    Instead, you can use a POST request and create an XML body with your requests targeting the individual Model_Handle (attribute 0x129fa) of each model you wish to get attributes from.. For example (note, I haven't tested this out):

     

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

     

    <rs:model-request throttlesize="1000" 

    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:model mh=“YOUR_MODEL_HANDLES” />

    <rs:model mh=“YOUR_MODEL_HANDLES” />

    Etc…

    </rs:target-models>

     

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

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

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

     

    </rs:model-request>



  • 3.  Re: Unable to get the attributes based on the model class

    Posted Jul 11, 2017 01:51 AM

    Thanks, Mohammed Alfakhrany.

     

    I have used POST method and got the solution for my requirement.

    Our requirement is to get all the requested attributes for the model class value '40'. Below is the XML body which I have used.

     

    <?xml version="1.0" encoding="UTF-8"?>
    <rs:model-request throttlesize="100"
    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">
    <filtered-models>
    <equals>
    <attribute id="0x11ee8">
    <value>40</value>
    </attribute>
    </equals>
    </filtered-models>
    </rs:search-criteria>
    </rs:models-search>
    </rs:target-models>
    <rs:requested-attribute id="0x11ee8" />
    <rs:requested-attribute id="0x10000" />
    </rs:model-request>