cancel
Showing results for 
Search instead for 
Did you mean: 

Create a python script that can run from site engine to cycle power based on OUI

Create a python script that can run from site engine to cycle power based on OUI

Joshua_DeltaNS
New Contributor II

I have created a python script that I am able to run directly from Extreme 5xxx series switches that allows the user to enter an OUI and then cycle inline power to all ports connected to a device that has that OUI. In this specific instance, the customer requested a simple method to reboot all of their CareHawk clocks. 

However, this script does not function when I attempt to deploy it via site engine, which is the customer's ultimate goal. Taking a look at some of the built-in scripts, it looks like most python scripts use a module named "api" that is imported from device. I'm unsure what the 'device' module that these scripts are referring to is, but I believe a better understanding of it would allow me to rewrite the script for site engine deployment. However, I am unable to find any documentation available on this module.

The second issue is that my script as written requires the user to enter an OUI and then enter uplink ports that they would like to exclude from the command. When running scripts via site engine there does not seem to be functionality for user input while the script is running. It appears that the "emc_vars" module creates a GUI where parameters can be passed to a function prior to starting it via site engine; however, I cannot find any documentation on this module either. 

Does anybody have any insight into writing python scripts for Site engine, and where I might be able to find documentation for these two modules? 

I have attached a screenshot of an example script that references both the "api" and "emc_vars" modules for clarity. 

 

Thanks!

Joshua_DeltaNS_0-1704476079685.png

 

1 ACCEPTED SOLUTION

Markus_Nikulski
Extreme Employee

Please don't spend time understanding the internal API calls. They are not documented or published. Is much better to look at existing workflows you just can take or get inspired for your workflows. 

Go to your GitHub repository where we host all scripting and workflows.
ExtremeScripting/XMC_XIQ-SE/oneview_workflows at master · extremenetworks/ExtremeScripting · GitHub

and search for PoE and you will find what you are looking for.

View solution in original post

2 REPLIES 2

Joshua_DeltaNS
New Contributor II

Thank you for the information, Markus. I was hoping there was something published and available to the public. I'll take a look at the available scripts in the GitHub and work from those.

Markus_Nikulski
Extreme Employee

Please don't spend time understanding the internal API calls. They are not documented or published. Is much better to look at existing workflows you just can take or get inspired for your workflows. 

Go to your GitHub repository where we host all scripting and workflows.
ExtremeScripting/XMC_XIQ-SE/oneview_workflows at master · extremenetworks/ExtremeScripting · GitHub

and search for PoE and you will find what you are looking for.

GTM-P2G8KFN