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 | 51
Part no.9036931-00 Rev AA February 2021
parser.add_argument('-p', '--password',
help='Login password for the remote system',
default='')
args = parser.parse_args()
return args
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: ')
with open(args.filename, "r") as f:
cmds = f.read().splitlines()
# you open a jsonrpc session to the switch
jsonrpc = JsonRPC(args.ip, args.username, args.password)
# you execute the CLI commands from the file
for cmd in cmds:
response = jsonrpc.cli(cmd)
rslt = response.get('result')
print("Executed CLI command {}".format(cmd))
print("result: {}".format(rslt[0].get('CLIoutput')))
main()
The goal is to present the concepts and show how to manipulate APIs. As a result, these code examples
are not meant to be the most efficient or handle all exceptions and errors.
In this example you send the CLI commands to the switch using JSON-RPC and print the CLI output from
the response. The CLI output is a string of what is displayed on the switch if you are connected to it via
Console, Telnet or SSH. It is normal for some of the CLI commands to have no output.
When you run the application, you should see output similar to this:
C:\Extreme API with Python> jsonrpc_example.py -f cmds.txt -i 192.168.56.121 -u admin
Executed CLI command create vlan 10-15
result:
Executed CLI command config vlan 10-15 add port 1 tag
result:
Executed CLI command show vlan port 1
result: Untagged ports auto-move: Inform
-----------------------------------------------------------------------------------------------










