For more details, please see ourCookie Policy.

Fibre Channel (SAN)

Occasional Visitor
Posts: 1
Registered: ‎04-21-2016

Problems with FabricOS v7.3.0c and commandline echo in SSH (automatic processing with expect)

(Introduction: McData switches had a usable user interface, but now I'll have to use FabricOS)


I have written a Perl script to send commands to a Brocade switch via SSH using Expect to configure aliases and zones stored in a text file. Unfortunately Brocade has broken the fundamental echo feature:


Creating aliases (alicreate) works fine, and the command input is echoed correctly. The script uses this to keep pace with the switch.


However as soon as I configure zones (zonecreate), the output echoed is different from the input, breaking the script (the script thinks something is wrong). First, for some unknown reason, the zonecreate command is echo'd with a blank at the end of the line (while alicreate does not do that). It seems to me the switch does crazy things when the line exceeds 80 characters. Truely funny is the fact that even when used from a wide terminal, the switch doesn't care about. What I see in the output are escape sequences like "ESC [A" and "ESC [K". As the script does not expect these strings, it thinks communication is broken.


Sometimes the switch is also very slow responding. The code sketch is like this:


my $real_cmd = $cmd . "\r";


if ($echo) { # expect echo
sleep(1); # just a try...
if ($exp->expect($timeout, '-re', "\Q$cmd\E\ ?\r")) {
$exp->clear_accum(); # discard old data
} else {
warn "$0: No echo for '$cmd':", join('|',
$exp->before(), $exp->match(),
$exp->after()), "\n";




$match = $exp->expect($timeout, @replies);


So the code sends the requested command with a CR at the end and then expects the command to be output with or without a trailing space. As the switch is slow (for no obvious reason) it seems I'll also have to wait (a second?) until the echo appears. If the echo was validated, it is assumed the command arrived at the switch (and will be processed). After processing it is expected that the switch presents a prompt (one of the @replies).


While everything works smoothly with old McData switches, things just don't work with FabricOS. Is there a "dumb terminal mode" to set, like in the good old days where command line wasn't fancy, but simply worked?

Frequent Contributor
Posts: 112
Registered: ‎04-05-2011

Re: Problems with FabricOS v7.3.0c and commandline echo in SSH (automatic processing with expect)

That is one of the reasons that led me to start using python with pyssh.


Join the Broadcom Support Community

Get quick and easy access to valuable resources across the Broadcom Community Network.