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 | 32
Part no.9036931-00 Rev AA February 2021
print "Missing arguments\nExpected arguments are Port and Action\nValid Actio
ns are down and up"
exit(0)
if sys.argv[2] == "down":
exsh.clicmd("delete vlan 42")
exsh.clicmd("config vlan Default add port {}".format(sys.argv[1]))
else:
exsh.clicmd("create vlan 42")
exsh.clicmd("config vlan 42 add port {}".format(sys.argv[1]))
UPM config requires that you create a profile and a log filter to monitor the event you want associated
with this profile.
create upm profile Up_Down_Profile
enable cli scripting
IF (!$MATCH($EVENT.LOG_COMPONENT_SUBCOMPONENT,vlan.msgs) &&
!$MATCH($EVENT.LOG_EVENT,portLinkStateDown)) THEN
run script upm_port.py $EVENT.LOG_PARAM_0 down
ENDIF
IF (!$MATCH($EVENT.LOG_COMPONENT_SUBCOMPONENT,vlan.msgs) &&
!$MATCH($EVENT.LOG_EVENT,portLinkStateUp)) THEN
run script upm_port.py $EVENT.LOG_PARAM_0 up
ENDIF
.
create log filter Port_Up_Down
config log filter Port_Up_Down add event vlan.msgs.portLinkStateUp
config log filter Port_Up_Down add event vlan.msgs.portLinkStateDown
create log target upm Up_Down_Profile
enable log target upm Up_Down_Profile
config log target upm Up_Down_Profile filter Port_Up_Down severity Info
You can validate the correct execution on the switch as the event happened:
sw1.29 # sh log
06/07/2020 11:03:51.39 <Noti:UPM.Msg.upmMsgExshLaunch> Launched profile
Up_Down_Profile for the event log-message
06/07/2020 11:03:51.38 <Info:vlan.msgs.portLinkStateUp> Port 1 link UP at speed 100
Mbps and full-duplex
06/07/2020 11:03:44.42 <Noti:UPM.Msg.upmMsgExshLaunch> Launched profile
Up_Down_Profile for the event log-message
06/07/2020 11:03:44.42 <Info:vlan.msgs.portLinkStateDown> Port 1 link down
sw1.30 #










