Python and the REST API for scripts

Network Analytics Engine scripts are written in Python, and the Network Analytics Engine provides a built-in Python interpreter that is used when validating scripts and creating agents from scripts.

Python is the go-to language for network engineers:

  • Python is high-level and human-readable.

  • Python is popular with an active development community.

  • There are many libraries (code written for you that you can use in your programs) available.

Python and the REST API to the ArubaOS-CX database provide powerful tools to support network automation. By using Python and the REST API, you can move far beyond CLI scripting in network automation.

In the past, a network engineer might use Perl scripts to automate show and configure CLI commands. This scheme provided some automation, but it was inefficient because it still used the CLI to interact with the switch. CLI inputs and outputs are in an unstructured, human-readable format. You must use text processing based on specific CLI output to extract the information you want.

For example, you would have to write code to detect a MAC address in the large continuous string of text that is the CLI output. The CLI output might have many things to make it human-readable, such as table formatting, column headings, introductory text, and so forth, and the way MAC addresses are presented can vary by CLI, operating system version, and sometimes even by individual command output.

In contrast, by using programmatic APIs such as the ArubaOS-CX REST API, you can get the information you are looking for in a predictable and structured way. For example, you can ask for and get just the MAC address.

Although Python programming is beyond the scope of this document, this document provides information about the structure and functions of Network Analytics Engine scripts.