Extreme API with Python
Table Of Contents
- 1 Preface
- 2 Introduction
- 3 EXOS APIs
- 4 VOSS API
- 5 XMC API
- 6 ExtremeCloud IQ API
- 7 Extreme Campus Controller API
Extreme API with Python
Page | 31
Part no.9036931-00 Rev AA February 2021
sw1.2 # run script createVlans.py
sw1.3 # show vlan
Untagged ports auto-move: Inform
-----------------------------------------------------------------------------------------------
Name VID Protocol Addr Flags Proto Ports Virtual
Active router
/Total
-----------------------------------------------------------------------------------------------
Default 1 --------------------------------T------------- ANY 5 /5 VR-Default
Mgmt 4095 192.168.56.121 /24 -------------------------- ANY 1 /1 VR-Mgmt
VLAN_0010 10 ---------------------------------------------- ANY 0 /0 VR-Default
VLAN_0011 11 ---------------------------------------------- ANY 0 /0 VR-Default
VLAN_0012 12 ---------------------------------------------- ANY 0 /0 VR-Default
VLAN_0013 13 ---------------------------------------------- ANY 0 /0 VR-Default
VLAN_0014 14 ---------------------------------------------- ANY 0 /0 VR-Default
-----------------------------------------------------------------------------------------------
Flags : (B) BFD Enabled, (c) 802.1ad customer VLAN, (C) EAPS Control VLAN,
(d) Dynamically created VLAN, (D) VLAN Admin Disabled,
(E) ESRP Enabled, (f) IP Forwarding Enabled,
(F) Learning Disabled, (i) ISIS Enabled,
(I) Inter-Switch Connection VLAN for MLAG, (k) PTP Configured,
(l) MPLS Enabled, (L) Loopback Enabled, (m) IPmc Forwarding Enabled,
(M) Translation Member VLAN or Subscriber VLAN, (n) IP Multinetting Enabled,
(N) Network Login VLAN, (o) OSPF Enabled, (O) Virtual Network Overlay,
(p) PIM Enabled, (P) EAPS protected VLAN, (r) RIP Enabled,
(R) Sub-VLAN IP Range Configured, (s) Sub-VLAN, (S) Super-VLAN,
(t) Translation VLAN or Network VLAN, (T) Member of STP Domain,
(v) VRRP Enabled, (V) VPLS Enabled, (W) VPWS Enabled,
(Y) Policy Enabled
Total number of VLAN(s) : 7
3.1.1.5 Automate the Python Script Execution
EXOS offers the ability to dynamically execute scripts when a particular event is met using a feature
called UPM.
3.1.1.5.1 UPM
UPM can trigger a script based on time of the day (for example every second, or twice a day at a fixed
time or on a given date), LLDP events, or based on events in the log. This capability combined with
Python scripting allows for very powerful on-switch automation. UPM can pass event-related
parameters to the script; for example, a port number associated to a monitored event, or a MAC
address, etc.
As a basic example, when a port goes up or down in the logs, you can ask UPM to trigger a basic Python
script to create a VLAN and add this port to it, or delete this VLAN and add the port back to the default
VLAN. Obviously, this example is too basic for a real use-case, but it shows the concepts involved. The
Python script would look like this:
import exsh
import sys
if len(sys.argv) < 3:










