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 | 37
Part no.9036931-00 Rev AA February 2021
Your program with the logging capability should look like this:
from exos import api
import exos.api.throwapi as throwapi
import logging
logger = logging.getLogger('test')
logger.setLevel(logging.DEBUG)
logHandler = api.TraceBufferHandler("testbuf", 20480)
logHandler.setLevel(logging.DEBUG)
logHandler.setFormatter(logging.Formatter("%(levelname)s:%(name)s:%(funcName)s.%(
lineno)s:: %(message)s"))
logger.addHandler(logHandler)
def event_cb(event, subs):
logger.info(event)
ev = throwapi.Subscription("vlan")
ev.sub(event_cb)
You now can access the information when reading the trace buffer of your application:
sw1.50 # create process test python-module test start auto
creating test...
sw1.51 #
sw1.51 # create vlan 10-12
sw1.52 #
sw1.52 # debug ems show trace test testbuf
06/07/2020 14:06:37.002965 [200] <test:testbuf> Begin trace buffer
06/07/2020 14:06:54.479653 [221] <test:testbuf> INFO:test:event_cb.15::
{'meta': {'action': 'create', 'timestamp': 1591538814.48, 'object': 'vlan',
'id': 'exos.vlan.create'}, 'data': {'vr_name': 'VR-Default', 'vlan_name':
'VLAN_0010'}}
06/07/2020 14:06:54.485521 [224] <test:testbuf> INFO:test:event_cb.15::
{'meta': {'action': 'create', 'timestamp': 1591538814.49, 'object': 'vlan',
'id': 'exos.vlan.create'}, 'data': {'vr_name': 'VR-Default', 'vlan_name':
'VLAN_0011'}}
06/07/2020 14:06:54.491825 [227] <test:testbuf> INFO:test:event_cb.15::
{'meta': {'action': 'create', 'timestamp': 1591538814.49, 'object': 'vlan',
'id': 'exos.vlan.create'}, 'data': {'vr_name': 'VR-Default', 'vlan_name':
'VLAN_0012'}}
Move a port from one VLAN to another to trigger additional information.
sw1.53 # config vlan 12 add port 1
VLAN 12 VLAN_0012: Port 1 untagged has been auto-moved from VLAN "VLAN_0042"
to "VLAN_0012".
sw1.54 #
sw1.54 # debug ems show trace test testbuf










