cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Python Scripts Executing from Netsight - Clarification Needed

Python Scripts Executing from Netsight - Clarification Needed

Ed_McGuigan1
New Contributor III
I got my python book and started learning python at the beginning of the week.

I want to write a script that can be executed from Netsight ( EMC 8.04 ). What I actually want to do is locate ports on switches to which PoE powered wireless access points are connected and cycle the PoE power in order to reboot hung access points.

There is no documentation that I can find specific to Python scripts as opposed to TCL scripts on Netsight and my assumption was that I would just write a script that was suitable to be loaded directly onto a switch and that the Netsight interface would take care of uploading the script and executing it.

I noticed that there didn't seem to be any information about adding the same kind of metadata for the definition of script arguments.

I have a script that I can manually upload onto a switch and execute but if I try to execute it from Netsight by selecting the Run option and picking a switch to run it on, it fails with a complaint that the exsh module couldn't be found.

I have realized that a python script in Netsight is not uploaded to the switch but rather executed on the server. I guess that would be workable but there is no documented method for providing arguments to the scripts.

Is this a feature that hasn't been completed yet?
I am trying to work out a method of being able to upload and execute a python script on a switch such that it can be leveraged from Netsight, or understand how others are leveraging python on XOS and getting scripts out onto devices on as needed basis.

Do I need to use a generic python server script to push out my XOS python scripts, run them at the switch and then delete them?
20 REPLIES 20

Stephane_Grosj1
Extreme Employee
Hi,

you do not use Python from EMC the same way than you write a script running directly on a switch.

as for Python in 8.0.4, you can use the same metadata than TCL, and declare variables the same way too (do not quote them). To let the user modify the variables, you need to use them in the following way:

emc_vars["yourVar"]

You also have access to all the TCL variables:

myVar = emc_vars["deviceIP"]

if you use the port variable, it will prompt the user to select a list of ports.

ports = emc_vars["port"]

to execute CLI command:

cli_results = emc_cli.send("show vlan")
cli_output = cli_results.getOutput()

Hope it helps.
GTM-P2G8KFN