Using Get tunneling with REST to filter results from the Data Aggregator

book

Article ID: 35733

calendar_today

Updated On:

Products

CA Infrastructure Management CA Infrastructure Management CA Performance Management - Usage and Administration

Issue/Introduction

Get Tunneling is where we "Post" some XML to the WebServices on the Data Aggregator which defines a "query". This query specifically includes or excludes data to ensure only the data you want returned is actually returned by the data aggregator web services. This can be useful when you have a large number of items and want to restrict the data being returned by the system to a specific subset to both speed up the query AND simplify the data response.

This applies to ALL web services under to <DA_HOST>:8581/rest endpoint

Environment

Release: IMDAGG99000-2.5-Infrastructure Management-Data Aggregator
Component:

Resolution

Instructions:

1. You must use the POST method to send XML to the following endpoint: <DA_HOST>:8581/rest/<specific_endpoint>/filtered
   The format of the XML sent is very specific

2. The GetTunneling XML that you post has two distinct sections.

The first section, called the "Filter" section, is used to filter or restrict the number of ITEMs returned from the web service call. You can either specify the IDs of the items you want to be returned directly, OR specify a dynamic list by querying specific attributes and comparing them to desired values.

The second section, called the "Select" section, is used to filter or restrict the attributes returned for ALL desired items, allowing your returned XML to have simple detail such as an ID, or as much detail as possible including all attributes.

In both cases, it is important to know that the more items, and the more attributes you include, the longer it will take to render, and the more the DA will be impacted. To ensure that the DA is not overloaded, there is a restriction on the number of items/attributes that can be returned.


Example XML:

The following XML selects all communication profiles (i.e. SNMP profiles) which have "SNMP" in the name OR ( are ranked 3rd or lower AND have an SNMP port of 161). Once found, only the CommunityName, and the generic CommunicationProfile details are returned.

<FilterSelect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="filter.xsd">
    <Filter>
        <Or>
            <CommunicationProfile.ProfileName type="CONTAINS">SNMP</CommunicationProfile.ProfileName>
            <And>
               <CommunicationProfile.Rank type="LESS_OR_EQUAL">3</CommunicationProfile.Rank>
               <SNMPv1Profile.PortNumber type="EQUAL">161</SNMPv1Profile.PortNumber>
            </And>
       </Or>
    </Filter>
    <Select use="exclude" isa="exclude">
       <SNMPv1Profile use="exclude">
          <CommunityName use="include"/>
       </SNMPv1Profile>
       <CommunicationProfile use="include" />
    </Select>
</FilterSelect>

To get the attributes available see:

<DA_HOST>:8581/rest/<specific_endpoint>/documentation

For example the above example for CommuncationProfile

<DA_HOST>:8581/rest/profiles/documentation.

If you look at the rest documentation for an endpoint you will see the Attributes are prefaced by the section they are in.

CommunicationProfile.ProfileName
CommunicationProfile.Rank
SNMPv1Profile.PortNumber
SNMPv1Profile.CommunityName

In the filter section, they would be referenced as seen Section.Attribute

            <CommunicationProfile.ProfileName type="CONTAINS">SNMP</CommunicationProfile.ProfileName>

In the select section, you break out each section and reference the Attributes in that section to limit to those attributes only:

       <SNMPv1Profile use="exclude">
          <CommunityName use="include"/>
       </SNMPv1Profile>