Extreme API with Python

Table Of Contents
Extreme API with Python
Page | 59
Part no.9036931-00 Rev AA February 2021
5 XMC API
XMC (Extreme Management Center) uses several APIs, and the focus in this section is on the most
recent addition with
GraphQL support. This is also referred to as the NBI API (NorthBound Interface),
through the extensive use of the Python capability built into XMC. This API can be accessed either
externally or internally via the Python Scripting Engine.
Note: GraphQL is a query language developed by Facebook, before becoming public in 2015. It accesses
data via HTTP and receives the content formatted in JSON. It is very similar to a REST API but has the
benefit of sending only the information requested, instead of the entire tree. It provides a more efficient
system, which is very appealing when manipulating large databases.
This section is an updated (with XMC 8.4.4) and summary of the document available here:
HTTPS://api.extremenetworks.com/XMC/Scripting/Python_with_XMC_8.1_v0.94.pdf
5.1 Python Scripting Engine
XMC includes a Python Scripting Engine (Tasks > Scripts) based on Jython and running Jython 2.7.0.8.
Support for Jython has been included with XMC 8.0.4 and several modules have been installed in
addition to the standard library, such as requests and pip utility.
5.1.1 Default Location for Scripts
When you create or modify a script in the XMC UI, the script is saved in the following location:
/usr/local/Extreme_Networks/NetSight/appdata/scripting/overrides/
5.1.2 Add a User-Created Script
To add a user-created script, copy the Python script to this directory:
/usr/local/Extreme_Networks/NetSight/appdata/scripting/extensions/
From the embedded Python scripts, import the module.
Note: This directory doesn’t exist by default. When created, it is automatically added to the system path
and so becomes available for importing.
5.1.3 Python Modules Shipped with XMC
With the release of XMC 8.1.2, some default Python modules ship with XMC. They are located into the
following directory:
/usr/local/Extreme_Networks/NetSight/appdata/scripting/system/
This is also where jsonrpc.py, restconf.py and restconf_voss.py are located. While Extreme Networks has
an ongoing effort to update the included versions, the timing of releases may prevent their ability to