List items by Alias or Name filtered by specific characters via REST
search cancel

List items by Alias or Name filtered by specific characters via REST

book

Article ID: 95798

calendar_today

Updated On:

Products

CA Performance Management - Usage and Administration DX NetOps

Issue/Introduction

How can we get a list of devices with their IDs and Alias name filtered by specific characters in the name, for example '-3G' ?

How can we get a list of interfaces with their IDs and Alias name filtered by specific characters in the name, for example '-3G' ?

A whole list of interface items is returned by POST method with RESTclient using this XML example:

<?xml version='1.0'?>
<FilterSelect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="filter.xsd">
 <Filter>
 <Or>
 <Port.Alias type="GREATER">0</Port.Alias >
 </Or>
 </Filter>
 <Select use="exclude" isa="exclude">
  <Port use="exclude">
 <Alias use="include"/>
 </Port>
 </Select>
</FilterSelect>

But couldn't find how to use values like GREATER, ISLIKE, CONTAINS, etc to filter the results as needed. For example when using the following line in the XML:

<Port.Alias type="CONTAINS"={-3G}</Port.Alias >

it only returns an empty list: <PortList />

Environment

All supported DX NetOps Performance Management releases

Resolution

This is the list of base comparisons used by the DX NetOps Performance Management Data Aggregator (DA) via REST.

<xs:enumeration value="LESS"/> 
<xs:enumeration value="LESS_OR_EQUAL"/> 
<xs:enumeration value="GREATER"/> 
<xs:enumeration value="GREATER_OR_EQUAL"/> 
<xs:enumeration value="EQUAL"/> 
<xs:enumeration value="CONTAINS"/> 
<xs:enumeration value="STARTS_WITH"/> 
<xs:enumeration value="ENDS_WITH"/> 
<xs:enumeration value="REGEX"/> 
<xs:enumeration value="IS_NULL"/> 

Note that for Interface items 'Port.Alias' is the ifAlias we read from the device, not the Interface Name Alias that exists in the DX NetOps Performance Management Portal web UI.

To filter against the item's Alias read off the device use this, looking for '-3G' in the name for the example above.

<Port.Alias type="CONTAINS">-3G</Port.Alias> 

These same options apply to device item filters. There are a number of name options for devices seen via DA_HOST:8581/rest/devices/manageable/xsd/filterselect.xsd

For example what if we want to filter for all devices with ABC in the device name? We might try something like:

<Item.Name type="CONTAINS">ABC</Item.Name>

Or it might be something like this for all things that start with ABC:

<Item.Name type="REGEX">ABC*</Item.Name>

Additional Information

Filter select choices for all DA REST filter options such as /rest/devices/manageable or /rest/ports are available via DA_Host:8581/typecatalog/basefilterselect.xsd.