DX NetOps

  • 1.  REST APIs Alarms filter doesn't work.

    Posted Mar 20, 2019 05:51 AM

    I want to use the Web Services API to allow a hypervisor to query Spectrum to retrieve the alarms. I have created alarm filters in Spectrum to target the alerts I want to see back to the hypervisor.
    To test the REST APIs, I use the Postman tool and test simple queries to validate the operation.
    I'm having trouble viewing answers when I test the following query:

    GET http://my server:8080/spectrum/restful/alarms/filters

    I do not get the expected return with Postman and even with IE or Chrome. I only have the first two lines of the expected answer while I have six alarm filters.

    <? xml version = "1.0" encoding = "UTF-8" standalone = "yes"?>
    <alarmfilters-response xmlns = "http://www.ca.com/spectrum/restful/schema/response" />

    I have one exception with Firefox that returns the correct answer:

    <Alarmfilters-response>
    <Alarmfilter> LAN-Control </ alarmfilter>

    <alarmfilter> AllAlarms </ alarmfilter>

    <alarmfilter> Severity </ alarmfilter>
    <Alarmfilter> MAN-Control </ alarmfilter>
    <Alarmfilter> Alarms-Control </ alarmfilter>
    <Alarmfilter> WAN-Control </ alarmfilter>
    </ Alarmfilters-response>

    My goal is then to use a POST command that will allow me to select one of the alarm filters to retrieve the alarms with details of them.
    Here is the model I want to use:

     

    POST /spectrum/restful/alarms/filter?name=Alarmes-Control HTTP/1.1
    Host: myserver:8080
    Content-Type: application/xml,application/json
    Authorization: Basic YmNpdC1waWwxOnBpbG90ZTE=
    cache-control: no-cache
    Postman-Token: fb894bff-2f1d-413f-8782-f6501b37f0f7
    <?xml version="1.0" encoding="UTF-8"?>
    <rs:alarm-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 ">
    <!-- Attributes of Interest -->
    <rs:requested-attribute id="0x10000"/>
    <!--Model Type Name-->
    <rs:requested-attribute id="0x10001"/>
    <!--Model Type of Alarmed Model-->
    <rs:requested-attribute id="0x12adb"/>
    <!--Collection-->
    <rs:requested-attribute id="0x1000a"/>
    <!--Condition-->
    <rs:requested-attribute id="0x1006e"/>
    <!--Model Name-->
    <rs:requested-attribute id="0x12b4c"/>
    <!--Alarm Title-->

    </rs:alarm-request>

    When I test this query, I get the following answer:

     

    <? xml version = "1.0" encoding = "UTF-8" standalone = "yes"?>
    <alarm-response-list xmlns = "http://www.ca.com/spectrum/restful/schema/response" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: nil = "true" />


    Which also corresponds to the first two lines of the answer.

    Can someone explain to me why? Thanks for your help.#



  • 2.  Re: REST APIs Alarms filter doesn't work.
    Best Answer

    Broadcom Employee
    Posted May 13, 2019 10:52 AM

    Hi Erwan,

     

    You might take a look at this KB article to see if it can help you.

     

    How can I use Java Webservices to pull alarms from - CA Knowledge 

     

    If that still doesn´t help we can investigate further if you open a support issue.

     

    Best regards,

    Glenn



  • 3.  Re: REST APIs Alarms filter doesn't work.

    Posted May 14, 2019 10:47 AM

    Hi Glenn,

    I tried the KB article query but it does not work. I have a status message equal to "204 No Content".
    I will follow your advice by opening a ticket to support

    Best regards

    Erwan



  • 4.  RE: Re: REST APIs Alarms filter doesn't work.

    Posted May 19, 2020 04:06 AM
    HI,

    I am in version 10.3.2 and I have the same problem. I think I found the cause. When I do an alarm POST, I also recover the alarms whose ports are in maintenance.

    While in the filter, I have removed the maintenance state. I think I will open a case at the support.

    I would also like to be able to retrieve alarms via a filter from a Global Collection. Is it possible ? If yes,  what should we put in the request header to see only the GC alarms ?

    I thought about this:

    <?xml version="1.0" encoding="UTF-8"?>
    <rs:alarm-request throttlesize="5000"
    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 ">
    <!-- This xml can be posted to the Alarms URL to obtain
    attributes on the specified alarms
    -->
    <!-- Attributes of Interest -->
    <!-- -->
    <rs:attribute-filter>
    <search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter">
    <devices-only-search />
    <filtered-models>
    <has-substring>
    <attribute id="0x12adb">
    <value>name of global collection</value>
    </attribute>
    </has-substring>
    </filtered-models>
    </search-criteria>
    </rs:attribute-filter>

    <rs:requested-attribute id="0x129fa" />
    <rs:requested-attribute id="0x11ee8" />
    <rs:requested-attribute id="0x12d7f" />
    <rs:requested-attribute id="0x10000"/> <!--Model Type Name-->
    <rs:requested-attribute id="0x10001"/> <!--Model Type of Alarmed Model-->
    <rs:requested-attribute id="0x10009"/> <!--Security String-->
    <rs:requested-attribute id="0x1000a"/> <!--Condition-->
    <rs:requested-attribute id="0x1006e"/> <!--Model Name-->
    <rs:requested-attribute id="0x11ee8"/> <!--Model Class-->
    <rs:requested-attribute id="0x12b4c"/> <!--alarme title-->

    <rs:alarm-filter name="Test"/>

    </rs:alarm-request>

    Best Regards,

    Chris.