How to use cnMaestro APIs

cnWave 60 GHz Network API Guide

This guide offers straightforward instructions for developers and network administrators on using the cnWave 60 GHz network’s API. It details the steps to obtain API credentials and execute the attached
sample Python script to create sites, nodes and links.

api_sample_usage.zip (3.4 KB)

GETTING STARTED

Before executing the script, ensure Python is installed on your system, and you’ve obtained the necessary API credentials: client_id and client_secret.

Prerequisites:

  • Python 3.x
  • requests library
  • Access to cnMaestro cloud with a Super Admin account in cnMaestro X

Installing:
Ensure Python is installed by checking its version with either of the following
commands, depending on your system:

python3 --version

Install the requests library using pip:

pip3 install requests

Obtaining API Credentials:

  1. Log in to cnMaestro cloud as a Super Admin, ensuring you’re on a cnMaestro X account.
  2. Navigate to Network Services → API Client.
  3. Click on “Add new API client,” fill in the details, and save. You’ll then see the “OAuth 2.0 Access Credentials” section.
  4. Download the credentials as a JSON file or copy them directly from the screen.

Configuring the Script:

After securing your credentials, prepare the input_data.json with your network’s specifics:

  1. Open input_data.json in a text editor.
  2. Replace your_client_id and your_client_secret with the actual credentials.
  3. Replace ‘your_network_id’ with the E2E network id
  4. Update placeholders in the “sites”, “nodes”, and “links” sections with your network configuration details. This encompasses name, latitude, longitude, altitude, and accuracy for sites; name, pop, azimuth, elevation, mode, site, msn, and model for nodes; and name, a_node_name, a_node_mac, z_node_name, z_node_mac, and link_type for links. To calculate a_node_mac and z_node_mac for sector 1, add 12 to the first octet of the node’s MAC address; for sector 2, add 22.
  5. Confirm the cn_maestro_url and network_id align with your cnWave 60 GHz network setup.

Running the Script:

Execute the script with the following command in your terminal or command prompt:

python3 site_node_link.py

API DESCRIPTION

The script communicates with cnWave’s APIs for site, node, and link creation, with detailed documentation available through Cambium Networks’ Swagger instance. Briefly:

  1. Create Site API: /cnwave/60/networks/{network_id}/sites - POST method to create a new site with details like name and location.

  2. Create Node API: /cnwave/60/devices - POST method registers a new node device to the network. The request includes details about the node, such as its name, whether it is a pop, azimuth, elevation, mode (DN or CN), associated site, Serial number (cloud cnMaestro) or MAC address (on prem cnMaestro), and model.

  3. Create Link API: /cnwave/60/networks/{network_id}/links - POST method for establishing a link between two nodes, requiring names and MAC addresses.

For comprehensive API details, including parameters and responses, visit: Cambium Networks Swagger documentation

Accessing the Network Services → API Client in cnMaestro cloud and using the “Try It Out” button also directs you to an interactive documentation.

3 Likes