Retrieve Topology Details

This documentation explains how to retrieve the topology from the CNC server, including nodes, L2 links, L3 links, and termination points.

Prerequisites

Before running this example, ensure to obtain access token. Refer 'Getting Started' section.

Retrieve the Topology Details on the CNC Server

Run the script retrieve_networks.sh from the example directory to get the network topology discovered on the CNC server.

cd cnc-topology-api-examples;./retrieve_networks.sh

Script Details

!/bin/bash
. ./cnc-api-common.sh

networks() {
    # 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 network topology on server and store the output in CNC_API_OUTPUT file
    CNC_API_URL=$CNC_TOPOLOGY_API_CTX/ietf-network-state:networks
    CNC_API_OUTPUT="$PRJ/output/networks.json"
    http_get $CNC_API_URL $CNC_API_OUTPUT
}
networks