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 | 57
Part no.9036931-00 Rev AA February 2021
print("Found VLAN {} with VID {}".format(vlan.get('state').get('name'), v
lan.get('vlan-id')))
def main():
args = get_params()
if args.username is None:
# prompt for username
args.username = input('Enter remote system username: ')
# also get password
args.password = getpass.getpass('Remote system password: ')
# open a restconf session - you are assuming http
rest = Restconf(args.ip + ':' + DEFAULT_TCP_PORT, args.username, args.passwor
d)
# you list the existing vlans prior adding one
list_vlans(rest)
# you prepare the data to send
url = "data/openconfig-vlan:vlans/"
data = {}
vlan = {}
vlan["config"] = {"extreme-mod-oc-vlan:stg-id": 1, "name": "H2G2", "vlan-
id": 42}
data["openconfig-vlan:vlans"] = [vlan]
# you make a POST API call
r = rest.post(url, data)
# you list the existing vlans after adding one to check
print("-"*42)
list_vlans(rest)
# you delete it now
del_url = url + "vlan=42"
rest.delete(del_url)










