logo

NJP

Cisco Prime API Integration: An Example

Import · Dec 31, 2020 · article

Introduction

This article contains a recently developed and anonymized update set containing the following:

  • A custom Script Include containing the Cisco Prime API functions to query the Cisco Prime system for Wireless Access Point(s) (WAP) and the associated WAP Controllers for these aforementioned Access Points (APs). The programming logic includes the steps to configure the JSON payload for the IRE API call to create both the WAP Controller(s) and APs. Also the AP's reference to its parent WAP Controller is configured as part of the programming logic.
  • New Wireless AP Controller table (u_cmdb_ci_wap_controller) is extended from the 'Network Gear' table with the added attribute: Active Access Points (u_active_access_points)
  • Added WAP Controller (u_wap_controller) reference (CI) attribute to the Wireless Access Point table
  • Outbound REST messages for the integration:
  • * GET WLAN Controllers
    • GET WLAN Controller Details
    • GET Access Points
    • GET Access Point Details

Note: Use this example to possibly extend the attributes for the Wireless Access Point or WAP Controller tables. Add the associated logic in the script include to configure these additional attributes for the JSON payload prior to the IRE invocation.

Required Manual Configuration (post Update Set Installation)

Create the custom 'Discovery Source':

/*A new discovery_source value for 'CiscoPrimeAPI' is required for the IRE call 
(don't manually edit the sys_choice table)...
From System Definition -> Scripts - Background execute the below*/

var dsUtil = new global.CMDBDataSourceUtil();
dsUtil.addDataSource("CiscoPrimeAPI");

Discovery Source (sys_choice.list > match discovery_source) for the cmdb_ci Table:

image

Create authentication profile:

A default anonymized configuration is provided as an example.

image

Identify Cisco Prime End Point and MID Server

A default anonymized configuration is provided as an example. All 'end point' records must be modified for the particular site.

image

Create the scheduled job:

The main function in the script include can be 'called' from a scheduled job, i.e.

image

new CiscoPrimeIntegration().run();
//new CiscoPrimeIntegration().getWANControllers();
//new CiscoPrimeIntegration().getWirelessAPs();

Example Screen Captures

Log File Entries:

WAP Controller Log Entries (includes IRE input JSON payload):

image

Wireless Access Point Log Entries (includes IRE input JSON payload):

image

System Web Services > Outbound > REST Message Records:

REST Message Main Record

image

REST Message Main Record (default all payloads from Cisco Prime to JSON)

image

HTTP Methods - GET WLAN Controllers

image

HTTP Methods - GET WLAN Controller Details

image

HTTP Methods - GET Access Points (with pagination)

image

HTTP Methods - GET Access Points (with pagination) #2

image

HTTP Methods - GET Access Point Details

image

HTTP Methods - GET Access Point Details #2

image

Example Cisco Prime JSON payload s:

GET WLAN Controllers Payload (0 to 29 count of EntityIds): An EntityId is required for the WAN Controller Details method.

Note: A similar logic is also applied for a 'page' (1000 EntityIds) of Access Points (APs) whereas each AP EntityId us used to query for the AP's 'full' details. The APs are 'paginated' at 1000 entries per 'Get Access Points' method until all AP EntityIds from the Cisco Prime AP EntityIds table are exhausted.

image

Resultant JSON payload to create WAP Controller CI via IRE call (script include):

image

Resultant JSON payload to create Wireless Access Point CI via IRE call and the relation/reference to the AP's WAP Controller (script include):

image

View original source

https://www.servicenow.com/community/developer-articles/cisco-prime-api-integration-an-example/ta-p/2324137