Creating a list of devices in each Spectrum NCM Policy via REST to report whether they are in compliance or not
search cancel

Creating a list of devices in each Spectrum NCM Policy via REST to report whether they are in compliance or not

book

Article ID: 234089

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

How can a list of devices in each NCM policy be created via REST to report whether they are in compliance or not?

For e.g. 

Policy Model Handle

Policy Name

Policy Type

948528

DHCP relay agent check

Single_Line(0)

 

Policy Violator?

Model Handle

Hostname

IP

Model Type

N

92A552

Spectro01

xxx.xxx.xxx.xxx

SwCiscoIOS

N

90334E

spectro01

yyy.yyy.yyy.yyy

HubCat29xx

 

Environment

DX NetOps Spectrum 21.2 or later

Cause

Currently, Spectrum has REST API capability to get Associated  Devices, Global Collections and Devices Families for NCM policies.

However, it doesn't have REST API to get combined list of device for NCM policies.

Resolution

Instead, use the following REST API to get the desired result as per:

TechDocs : DX NetOps 22.2 - GET associations

So, the URL is:

http://<hostname><:portnumber>/spectrum/restful/associations/relation/<rel_handle>/model/<model_handle>?side=[left|right]

For Example, using the following parameters:

NCM Policy      : Test_pol

Model Handle    : 0x95d623

Relation Handle : 0x820007 (NCM_HAS_POLICY_REL_ID)

Run the following GET request:

http://<ONECLICK>:8080/spectrum/restful/associations/relation/0x820007/model/0x95d623?side=right

BODY:


<association-response-listxmlns-"http://www.ca.com/spectrum/restful/schema/response">

   <association-responses>

     <association rh="0x820007" leftmh="0x920a36" rightmh="0x95d623"/>

     <association rh="8x820007" leftmh="0x94791f" rightmh="0x95d623"/>

   </association-responses>

</association-response-list›

 

 

Additional Information

NOTE

  • NCM_Policy_Device_List - This will have device list when policy is actual ran, this will refresh with associated devices  when next time policy is running, will not have actual associated list when REST API is running
  • NCM_Policy_Failed_List - This will have failed device list after policy is run
  • NCM_Policy_succeeded _List - this will have succeeded device list after policy is run