Data Infrastructure Management Software Discussions

Create Zoning on Brocade - forbidden characters ?


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!


Re: Create Zoning on Brocade - forbidden characters ?


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

Re: Create Zoning on Brocade - forbidden characters ?


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"

Re: Create Zoning on Brocade - forbidden characters ?

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?

Re: Create Zoning on Brocade - forbidden characters ?

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

Review Banner
All Community Forums