Active IQ Unified Manager Discussions

Create Zoning on Brocade - forbidden characters ?

THORSTEN_KRAUSE
6,155 Views

Hello,

I'm currently working on a WFA-command to create zoning on our Brocade FC-Switches.

Login works fine and getting outputs etc.

For example:

$alias = $(Invoke-NaSsh -Name $Switch -Command $("alishow | grep " + $wwpn) -Credential $credentials)

--> this gives the desired output from the FC-Switch

Now I want to create an alias, which fails:

$alicreate = $(Invoke-NaSsh -Name $Switch -Command $("alicreate Testalias, 50:01:23:3a:02:23:60:5a") -Credential $credentials)

--> $alicreate does not show any output, which would be expected when positive, but the Alias is not being created

I suspect the comma to be the problem here, but escaping with ` also did bring no success.

The login credentials are correct and the command is working when directly executed without problem

Any hints on this?

Thanks in advance!

1 ACCEPTED SOLUTION

THORSTEN_KRAUSE
6,156 Views

found the solution, it seems the command always worked, but you need to add a cfgsave or cfgenable to make the change permanent on the FC-Switch.

It seems on alicreate the aliases are not saved into the local flash of the FC-Switch and dropped on next logout.

You need to append a cfgsave/cfgenable.

Here another hint as cfgsave requests the user to say yes/no:

echo yes | cfgsave

Here the code snippet for the ones interested:

#get current acitve configname

$config = $(Invoke-NaSsh -Name $Switch -Command $("cfgshow |grep -A1 `"Defined configuration:`" |grep cfg") -Credential $credentials)

$config = $config -split '\s+|\t+'

$config = $config[2]

Get-WFALogger -Info -message $("Configfile:" + $config)

$alicreate = $(Invoke-NaSsh -Name $Switch -Command $("alicreate " + $alias + ", " + $wwpn + " ; echo yes |cfgenable " + $config) -Credential $credentials)

#wait 10 seconds for config to be propagated in fabric

Start-Sleep -s 10

--> now you have the alias defined in the fabric

View solution in original post

4 REPLIES 4

kandati
6,156 Views

Hi,

Can you please try your command something like below,

$alicreate = $(Invoke-NaSsh -Name $Switch -Command $("alicreate `"Testalias`",`"50:01:23:3a:02:23:60:5a`"") -Credential $credentials)

Warm Regards

Sivaprasad K

THORSTEN_KRAUSE
6,156 Views

Hi,

already tried that, but for Brocade these commands are the same:

alicreate Testalias, 50:01:23:3a:02:23:60:5a

alicreate "Testalias", "50:01:23:3a:02:23:60:5a"

THORSTEN_KRAUSE
6,156 Views

Did some further testing, it must definetly be the comma, WFA seems to somehow loose the data when a comma comes up.

I tried to use a here-string to avoid any escaping stuff, but still WFA seems to loose everything once a comma comes up even within a string

$myHereString = @"

alicreate "Testalias", "50:01:23:3a:02:23:60:5a" ; history

"@

$alicreate = $(Invoke-NaSsh -Name $Switch -Command $($myHereString) -Credential $credentials)

alicreate gives no output.

if I leave out the comma in the here string, at least a message comes back from the appended history-command that the command failed,

which is not the case with a comma inside.

Any hints?

THORSTEN_KRAUSE
6,157 Views

found the solution, it seems the command always worked, but you need to add a cfgsave or cfgenable to make the change permanent on the FC-Switch.

It seems on alicreate the aliases are not saved into the local flash of the FC-Switch and dropped on next logout.

You need to append a cfgsave/cfgenable.

Here another hint as cfgsave requests the user to say yes/no:

echo yes | cfgsave

Here the code snippet for the ones interested:

#get current acitve configname

$config = $(Invoke-NaSsh -Name $Switch -Command $("cfgshow |grep -A1 `"Defined configuration:`" |grep cfg") -Credential $credentials)

$config = $config -split '\s+|\t+'

$config = $config[2]

Get-WFALogger -Info -message $("Configfile:" + $config)

$alicreate = $(Invoke-NaSsh -Name $Switch -Command $("alicreate " + $alias + ", " + $wwpn + " ; echo yes |cfgenable " + $config) -Credential $credentials)

#wait 10 seconds for config to be propagated in fabric

Start-Sleep -s 10

--> now you have the alias defined in the fabric

Public