Extreme API with Python

Table Of Contents
Extreme API with Python
Page | 35
Part no.9036931-00 Rev AA February 2021
sw1.1 # sh log
07/01/2020 00:51:44.26 <Info:System.userComment> User Admin just connected!
07/01/2020 00:51:44.26 <Info:AAA.authPass> Login passed for user admin
through telnet (192.168.56.1)
07/01/2020 00:51:37.20 <Info:AAA.logout> Administrative account (admin)
logout from telnet (192.168.56.1)
07/01/2020 00:51:30.32 <Noti:log.ClrLogMsg> User admin: Cleared the log
messages in memory-buffer.
A total of 4 log messages were displayed.
Use this feature to execute specific scripts or apps based on the user connected to the switch.
3.1.2 Python Application
Starting with EXOS 15.7, Python application development capability has been added to EXOS.
Instead of writing a script to run to completion every time it is executed (manually or dynamically using
UPM), you can create an application that lives as a new process in the system. This process can be
started, terminated, or deleted, and runs into a dedicated Linux CGroup named “Other”, while official
EXOS processes run in the “EXOS” CGroup.
Note: The Linux CGroup was introduced with EXOS 22. Prior to this release there was no differentiation
between system and user-created processes. CGroups ensure that user-created applications cannot
significantly impact processes in another CGroup. “Other” CGroup is limited, by default, to 10% CPU
usage and 5% RAM usage, however these parameters are configurable.
Processes run in a different system environment than user-created scripts. This environment is called
expy and requires a different development approach. It is a more powerful environment that offers
access to the dataplane.
The detailed API is documented here:
HTTPS://api.extremenetworks.com/EXOS/ProgramInterfaces/PYTHONAPI/
This API is based on the C SDK for EXOS and offers a wide variety of methods and functions to retrieve
large amounts of data. For example, it can check if the process is running on a stackable switch, what
role it has, it can manipulate packets, interact with the CLI to pass commands but also create its own CLI
command, handle Authentication and so on.
To illustrate the use of this API, create a process that monitors the VLAN events on the switch. You need
to subscribe to the event, as provided by the API.
import exos.api.throwapi as throwapi
def event_cb(event, subs):
print event
ev = throwapi.Subscription("vlan")