09-30-2020 07:30 PM
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,
Solved! Go to Solution.
10-20-2020 01:58 PM
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
01-28-2021 08:52 AM
This is what I use in my scripts:
if nbiMutation(NBI_Query['rediscover_device'].replace('<IP>', emc_vars['deviceIP'])):
print "Initiated XMC rediscovery of switch"
else:
print "Failed to trigger XMC rediscovery of switch; perform manually"
I attached a file which has all my the methods I use; you can pluck the methods you need from it.
01-27-2021 04:17 PM
It would be so kind of you if you can send me the code, as I am new to this… it would give me a good example to learn all of this and then change it as needed for other tasks.
Thanks,
01-27-2021 03:29 PM
You can, I use this mutation query for it:
mutation {
network {
rediscoverDevices(input: {devices: {ipAddress: "<IP>"}}) {
status
message
}
}
}
Replace <IP> with your switch IP address.
Do you need the Python code to interact with XMC NBI ?
01-26-2021 07:01 PM
Hello Chad,
as far as I know, you can't trigger rediscover in the NBI or via the old Rest/SOAP API.
You can only optimize the Discover settings under Administration->Options->Management Center Collector. However, this does not really help you I thnil