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 | 105
Part no.9036931-00 Rev AA February 2021
session.verify = False
session.timeout = 10
session.auth = (args.username, args.password)
session.headers.update(
{ 'Accept': 'application/json',
'Content-type': 'application/json',
'Cache-Control': 'no-cache',
}
)
# define XMC-NBI query
nbiQuery = '{ network{ devices { ip nickName } } }'
# execute NBI call
nbiUrl = 'HTTPS://' + args.ip + ':8443/nbi/graphql'
response = session.post(nbiUrl, json= {'query': nbiQuery} )
if response.status_code != 200:
print('ERROR: HTTP ' + response.reason + '(' + str(response.status_code) + ')
')
else:
# convert JSON string to a data structure
inbound_data = json.loads(response.text)
for device in inbound_data['data']['network']['devices']:
print(device['ip'] + ' \t' + device['nickName'])
The output is:
C:\Extreme API with Python> nbi.py
Enter remote system username: root
Remote system password:
Enter IP of the XMC server: 192.168.56.10
192.168.56.121 IP Campus_08:00:27:35:2A:E4
192.168.56.143 voss03
192.168.56.125 IP Campus_08:00:27:7D:DB:E6
192.168.56.142 voss02
192.168.56.129 IP Campus_08:00:27:AD:C4:CB
192.168.56.145 voss05
192.168.56.126 IP Campus_08:00:27:07:56:3D
192.168.56.144 voss04
192.168.56.124 IP Campus_08:00:27:DD:A3:DA
192.168.56.12 FabricManager










