cancel
Showing results for 
Search instead for 
Did you mean: 

XMC Python System Variables and api commands

XMC Python System Variables and api commands

Chad5
Contributor

Hi,

 

I am starting to create our own scripts/macros for certain tasks in Python and been looking at some of the built in one, so a simple one is disable a port:

 

from device import api

print "selected ports = " + emc_vars["port"]
api.perform_port_operation("disable", emc_vars["port"])

I can see from above there is a system variable of emc_vars[“ports”] and an api command to perform a port operation….

Where do I get a list of all variables and all the api commands so I can create my own stuff?

The alternative is to send SNMP commands, but this is simpler. I am looking to do one for example to enable/disable 802.1X mac or dot1x or mode.

Thanks for any references,

1 ACCEPTED SOLUTION

yas1
New Contributor II

Hello together,

This document https://api.extremenetworks.com/XMC/Scripting/Python_with_XMC_8.1_v0.94.pdf has helped me to get in touch with python and XMC. On page 5 there are some emc_vars listed too. Perhaps there are some further information for you.

Best regards
Yannick

View solution in original post

17 REPLIES 17

Chad5
Contributor

Thank you all, I will be testing this and getting back to you…

 

yas1
New Contributor II

Hello together,

This document https://api.extremenetworks.com/XMC/Scripting/Python_with_XMC_8.1_v0.94.pdf has helped me to get in touch with python and XMC. On page 5 there are some emc_vars listed too. Perhaps there are some further information for you.

Best regards
Yannick

StephanH
Valued Contributor III

Hello Chad,

 

is your problem solved  or can we help you even further?
If it is solved it would be great if you click on "Best answer", so that everyone can see that the question is solved.

 

Regards

Stephan

Regards Stephan

Ludovico_Steven
Extreme Employee

If you want to see the available emc_vars run this XMC script

import json
json_out = json.dumps(emc_vars, sort_keys=True, indent=4)
print json_out

 

StephanH
Valued Contributor III

Hello Chad,

to get all emc_vars with values for a device, you ca create a python script like:

for key, value in emc_vars.iteritems():

            print(key + " => " + value)

 

run this script again a device and you will receive all key and the values.

 

Regards

Regards Stephan
GTM-P2G8KFN