cancel
Showing results for 
Search instead for 
Did you mean: 

Set Switch IP at runtime in workflow or script?

Set Switch IP at runtime in workflow or script?

StephanH
Valued Contributor III
Hello,

how can I pass an IP of a switch to the script within a script or a workflow to access this IP via CLI / Python and send CLI commands to this IP?

Attention, this is not about the selection of the switch when starting a script or workflow, but a switch IP that is defined at runtime!

Example: You start the workflow for a switch (selected while hit run for the workflow) and then determine within the workflow that you have to configure another switch. In this case, a CLI command must be issued to this switch "new/additional" switch.

How can I achieve this?

Regards
Stephan
Regards Stephan
1 ACCEPTED SOLUTION

StephanH
Valued Contributor III
Hello,

I received a solution to my problem. Many thanks to Markus from Extreme, he has send me the solution.

Here is an example form an Python program as part of an workflow:

#Set the focus to the new switch with IP 1.1.1.1
cli_result = emc_cli.setIpAddress("1.1.1.1")
#Continue as always. All commands will use the new switch
res = emc_cli.send("create vlan XXX").getOutput()Regards
Stephan

Regards Stephan

View solution in original post

3 REPLIES 3

StephanH
Valued Contributor III
Hello,

I received a solution to my problem. Many thanks to Markus from Extreme, he has send me the solution.

Here is an example form an Python program as part of an workflow:

#Set the focus to the new switch with IP 1.1.1.1
cli_result = emc_cli.setIpAddress("1.1.1.1")
#Continue as always. All commands will use the new switch
res = emc_cli.send("create vlan XXX").getOutput()Regards
Stephan

Regards Stephan

StephanH
Valued Contributor III
Hello John,

thank you for the explanation.

But I do not want to enter the IP address of the switch in a window that opens, but pass it as a variable (because its an automatic process without user interaction).

Unfortunately, I did not write that clearly in the previous post.

Example: A script opens a text file searches for the appropriate IP of the switch to be configured (write this IP into a variable), and the subsequent CLI commands are then executed on this switch.

For the sake of completeness, all the devices I want to communicate with are managed by the XMC.

Regards
Stephan

Regards Stephan

John_Moore
Extreme Employee
Hi Stephan,

You can accomplish this via the Manage Inputs window.

To access it, select the activity you are configuring to have a user-defined IP (I'm assuming it's a script task) and select the Input tab in the Details section of the window (the right side of the Workflows tab). The Config button is located at the top of that tab. Click it to open the Manage Inputs window.

Create a new input, select devices as the Variable Reference, and then select the Prompt User checkbox. When the workflow is running and it reaches that activity, it will pause and open a window that asks you for the device on which you want to run the workflow.

For more information, see https://emc.extremenetworks.com/content/oneview/docs/tasks/docs/c_workflows.html?Highlight=workflow#...

Thanks!

John
GTM-P2G8KFN