Retrieve Segment Routing Policy Details
This documentation provides a use case for retrieving the SR Policies discovered on the CNC server.
Prerequisites
Before running this example, ensure to obtain access token. Refer 'Getting Started' section.
Retrieve the SR Policy Details on the CNC Server
Run the script retrieve_sr_policies.sh from the example directory to get the SR Policies discovered on the CNC server.
cd cnc-topology-api-examples;./retrieve_sr_policies.sh
Script Details
!/bin/bash
. ./cnc-api-common.sh
sr_policies() {
# assume cnc jwt is obtained prior to invoking this method by executing get-cnc-jwt.sh script
# read from jwt file and export it as AUTH_TOKEN_HDR
export_jwt
# STEP 1 : get SR policies discovered on server and store the output in CNC_API_OUTPUT file
CNC_API_URL=$CNC_TOPOLOGY_API_CTX/cisco-crosswork-segment-routing-policy:sr-policies
CNC_API_OUTPUT="$PRJ/output/sr_policies.json"
http_get $CNC_API_URL $CNC_API_OUTPUT
}
sr_policies