Scripting the setup of a virtual connect (2657 Views)
Reply
Contributor
cursur949
Posts: 14
Registered: ‎07-26-2011
Message 1 of 13 (2,657 Views)
Accepted Solution

Scripting the setup of a virtual connect

This might be a stupid question but I am at a bit of a loss here. 

 

I have created basically a script that sets up my virtual connects up from bare mettle, everything from setting user name and password to assigning the newly created profiles to a server bay. 

 

That said, if I cut and paste the script in to putty or SecureCRT in small chunks all the commands work fine and my virtual connects get setup correctly. 

 

The issue comes in when I copy and paste the data in at the same time, it simply overloads the virtual connect and some stuff does not get created. I think this is because both putty and secureCRT is not waiting for an output of success or error from the VC before executing the next command

 

 

This is one of those issues I hope I feel stupid for asking because the answer is so simple.

Please use plain text.
Honored Contributor
Johan Guldmyr
Posts: 3,833
Registered: ‎06-14-2009
Message 2 of 13 (2,654 Views)

Re: Scripting the setup of a virtual connect

Hey, maybe it's possible to put in a sleep() command somewhere? I suppose putty is not so smart that you can write a script/macro in it, but maybe SecureCRT has some kind of macro/scripting feature?

There ought to be other tools you can use for this. If you used Linux then a relatively simple bash script could accomplish this (the command name is 'sleep'). Or perl, or something like that. It should be possible to install on Windows too.

I haven't looked into powershell for Windows, maybe that can do this? Maybe kix might be worth checking out as well..


Click the Kudos Star if this was a good post.
Please use plain text.
Honored Contributor
Jimmy Vance
Posts: 1,480
Registered: ‎11-27-2006
Message 3 of 13 (2,652 Views)

Re: Scripting the setup of a virtual connect

I use plink or ssh to send a text file of commands to setup VC.  plink is the command line version of PuTTY

 

# usage
# plink.exe -m SCRIPT_FILENAME -pw VC_TOETAG_PASSWORD Administrator@VC_IP_ADDRESS

 

Please use plain text.
Honored Contributor
Johan Guldmyr
Posts: 3,833
Registered: ‎06-14-2009
Message 4 of 13 (2,650 Views)

Re: Scripting the setup of a virtual connect

Great tip Jimmy! Forgot about those extra apps on http://www.putty.nl/


Click the Kudos Star if this was a good post.
Please use plain text.
Respected Contributor
Psychonaut
Posts: 210
Registered: ‎08-31-2011
Message 5 of 13 (2,632 Views)

Re: Scripting the setup of a virtual connect

Great tip, plink is what I have been using, too.

I've been doing a hybrid as it seemed like I couldn't do everything from a script. At least as I looked through the documentation certain setup commands seemed to be missing. cursur949 - is there any chance you can share what you've got? Do you have a redundant VC config? Can you import the other VC's?

Thanks,
Tim
Please use plain text.
Honored Contributor
Jimmy Vance
Posts: 1,480
Registered: ‎11-27-2006
Message 6 of 13 (2,627 Views)

Re: Scripting the setup of a virtual connect

An example I've used in training labs

 

# usage
# plink.exe -m SCRIPT_FILENAME -pw VC_TOETAG_PASSWORD Administrator@VC_IP_ADDRESS

 

# import the domain, give it a name

import enclosure username=OA_User password=OA_Password

set domain name=TechForum_vc_domain

 

# create a username/password that has all privileges

add user adminuser password=password privileges=*

 

# set up VC-assigned GUIDs

set domain mactype=vc-defined macpool=46
# set domain wwntype=vc-defined wwnpool=

 

# create some networks with preferred and maximum speeds

# add network demo3 prefspeedtype=custom prefspeed=800 maxspeedtype=custom maxspeed=5000
# add network demo4 prefspeedtype=custom prefspeed=900 maxspeedtype=custom maxspeed=5000

 

add network Outside
add network Classroom
add network Classroom
add network Station_01
add network Station_02
add network Station_03
add network Station_04
add network Station_05
add network Station_06
add network Station_07
add network Station_08
add network Station_09
add network Station_10
add network Station_11
add network Station_12

 

# Add uplinks

add uplinkport enc0:1:X2 network=Outside
add uplinkport enc0:1:X4 network=Classroom

 

# profiles are created with 2 ethernet connections by default, so you'll need to
# add 6 more connections to a profile so that all 8 FlexNICs are taken care of

 

add profile Slot_01
set enet-connection Slot_01 1 network=Classroom
set enet-connection Slot_01 2 network=Station_01

 

add profile Slot_02
set enet-connection Slot_02 1 network=Classroom
set enet-connection Slot_02 2 network=Station_02

 

add profile Slot_03
set enet-connection Slot_03 1 network=Classroom
set enet-connection Slot_03 2 network=Station_03

 

add profile Slot_04
set enet-connection Slot_04 1 network=Classroom
set enet-connection Slot_04 2 network=Station_04

 

add profile Slot_05
set enet-connection Slot_05 1 network=Classroom
set enet-connection Slot_05 2 network=Station_05

 

add profile Slot_06
set enet-connection Slot_06 1 network=Classroom
set enet-connection Slot_06 2 network=Station_06

 

add profile Slot_07
set enet-connection Slot_07 1 network=Classroom
set enet-connection Slot_07 2 network=Station_07

 

add profile Slot_08
set enet-connection Slot_08 1 network=Classroom
set enet-connection Slot_08 2 network=Station_08

 

add profile Slot_09
set enet-connection Slot_09 1 network=Classroom
set enet-connection Slot_09 2 network=Station_09

 

add profile Slot_10
set enet-connection Slot_10 1 network=Classroom
set enet-connection Slot_10 2 network=Station_10

 

add profile Slot_11
set enet-connection Slot_11 1 network=Classroom
set enet-connection Slot_11 2 network=Station_11

 

add profile Slot_12
set enet-connection Slot_12 1 network=Classroom
set enet-connection Slot_12 2 network=Station_12

 

add profile Slot_13
set enet-connection Slot_13 1 network=Classroom
set enet-connection Slot_13 2 network=Station_13

 

add profile Slot_14
set enet-connection Slot_14 1 network=Classroom
set enet-connection Slot_14 2 network=Station_01
add enet-connection Slot_14 network=Station_02
add enet-connection Slot_14 network=Station_03
add enet-connection Slot_14 network=Station_04
add enet-connection Slot_14 network=Station_05
add enet-connection Slot_14 network=Station_06

 

add profile Slot_15
set enet-connection Slot_15 1 network=Classroom
set enet-connection Slot_15 2 network=Station_07
add enet-connection Slot_15 network=Station_08
add enet-connection Slot_15 network=Station_09
add enet-connection Slot_15 network=Station_10
add enet-connection Slot_15 network=Station_11
add enet-connection Slot_15 network=Station_12

 

add profile Slot_16
set enet-connection Slot_16 1 network=Outside
set enet-connection Slot_16 2 network=Classroom
add enet-connection Slot_16 network=Labnet

 

# assign the profile to a bay

assign profile Slot_01 1
assign profile Slot_02 2
assign profile Slot_03 3
assign profile Slot_04 4
assign profile Slot_05 5
assign profile Slot_06 6
assign profile Slot_07 7
assign profile Slot_08 8
assign profile Slot_09 9
assign profile Slot_10 10
assign profile Slot_11 11
assign profile Slot_12 12
assign profile Slot_13 13
assign profile Slot_14 14
assign profile Slot_15 15
assign profile Slot_16 16

 

# power on the server (optional)

 

poweron server 1

poweron server 2

poweron server 3

poweron server 4

poweron server 5

poweron server 6

poweron server 7

poweron server 8

 

 

Please use plain text.
Visitor
Ctl2011
Posts: 3
Registered: ‎10-06-2011
Message 7 of 13 (2,614 Views)

Re: Scripting the setup of a virtual connect

[ Edited ]
May I know how to generate a configuration script from the existing vc domain? What is the command? I try show all command in cli but the output format is not like the example in jimmy's post.
Please use plain text.
Honored Contributor
Jimmy Vance
Posts: 1,480
Registered: ‎11-27-2006
Message 8 of 13 (2,607 Views)

Re: Scripting the setup of a virtual connect

"show config" is the CLI command your looking for

Please use plain text.
Contributor
cursur949
Posts: 14
Registered: ‎07-26-2011
Message 9 of 13 (2,606 Views)

Re: Scripting the setup of a virtual connect

OK – so SecureCRT resolved my issue, there is a value that can be set both via command line and UI that allows to me change the delay time in relation to when it will send the next line.  I played with it a bit and found that 250 milliseconds fixed my issue though I still run it at 400 just to be safe.

 

The Plink idea is also a great idea, though I did not get around to testing it.

Please use plain text.
Visitor
Ctl2011
Posts: 3
Registered: ‎10-06-2011
Message 10 of 13 (2,595 Views)

Re: Scripting the setup of a virtual connect

Hi Jimmy,

 

I am using VC3.15 and I cannot find the command show config. Is this only for the latest VC firmware?

 

Please use plain text.
Honored Contributor
Jimmy Vance
Posts: 1,480
Registered: ‎11-27-2006
Message 11 of 13 (2,586 Views)

Re: Scripting the setup of a virtual connect

I'm not sure when the command was added, it's in v3.30

Please use plain text.
Honored Contributor
Johan Guldmyr
Posts: 3,833
Registered: ‎06-14-2009
Message 12 of 13 (2,585 Views)

Re: Scripting the setup of a virtual connect

Maybe it's possible to get the config out from the 'show all' ?



Click the Kudos Star if this was a good post.
Please use plain text.
Visitor
Ctl2011
Posts: 3
Registered: ‎10-06-2011
Message 13 of 13 (2,580 Views)

Re: Scripting the setup of a virtual connect

Show config is new command in 3.3. Below is the extracted from the 3.3 release note.

 

• New CLI commands—New CLI commands to support save and restore configurations, copy
profiles, and the show config command that generates a CLI script that can be used to restore the
current VC domain configuration

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation