Ethernet Switches & Routers

Reply
Occasional Contributor
sbartley_1
Posts: 6
Registered: ‎03-14-2012

Brocade for Cisco people

Hello,

I am a typical Cisco person...CCNP using Cisco switches and routers at work. We have some Brocade FCX-48GS switches and are planning on moving completely from Cisco switches to Brocade. I have a few questions I need to get answered before we commit to this change.

VLANs: On Cisco switches, "All" VLANs are allowed through trunk links (tagged ports) by default. This is great for a dynamic network...add the new VLAN to the VTP server, and ... that's it - it's now on every switch and traffic for that VLAN goes everywhere it needs to go. There's no additional config, "All" includes VLANs added in the future, like this one. I don't see any way to do this on Brocade switches. I looked at VLAN-groups, but these don't seem to be usable in any real-world application. For example, we have servers that do not support 802.1q tagging, but need to be a member of a VLAN. If that VLAN is part of a VLAN-group, it will not support untagged ports (at least, not that I can tell). On a Cisco switch, I simply add that port to the VLAN as an access port, and it's untagged. How do you manage VLANs on Brocade switches without creating an administrative nightmare? I haven't tried to see if dual-mode will work for VLANs in a VLAN-group. If it does that might be ok, but it's not ideal. I also haven't looked at GVRP.

plink: I like plink for automation of switch commands. Basically, it links PuTTy and the cmd.exe interpreter and you can write batch files and easily run them against all of your equipment. Usually for show commands, but you could send out mass config changes too if you wanted. plink is super easy to use with Cisco switches. Here's an example that runs "show ver" on a switch: plink -ssh -l myusername -pw mypassword myswitchFQDNorIP show ver. It redirects the standard output to the calling process, so you can have a script perform some logic on it and perhaps send another command, or log it or whatever. When I try to run the same thing against a Brocade switch, all I get is an error: ☺Protocol error, doesn't start with scp! I can't find very much online about this error, only that it's probably a bug in the SSH code on the Brocade switch. I'm running fcxr07300.bin SW: Version 07.3.00T7f3. Yes, scp is enabled. If it's not, plink returns a different error: ☺SCP is disabled on this device BTW, PuTTy works fine with the same Brocade switch.

These Brocade switches have features that we like that the Cisco switches do not have, so please don't think I'm just trying to make Cisco look good. For example, redundant power supplies are super easy to install, and sflow...Cisco 3750's don't support netflow/sflow/IPFIX...that's huge.

Super Contributor
mschipp
Posts: 1,087
Registered: ‎12-13-2009

Re: Brocade for Cisco people

Hi sbartley,

     Ok I can get the same error with using plink.

     Note - I have an enable password and I am not using radius, so local username and password in the local DB and no radius for enable (priv) level.

     What I found is that if I put my commands in a text file and redirect into plink I can get the output.

     e.g. a.txt text looks like (remove the "'s)

"enable myenablepassword
skip-page-display
show version
quit

"

then issue

C:\Program Files (x86)\PuTTY>plink.exe -l myUname -pw mypassword myipadd < drive:\path\a.txt

However I had to remove the last "exit" from the text file to get the show ver output (and the ssh session was locked and had to press ctrl-c

Not sure how to fix that!!! Maybe you can find a way

Will look into the VLAN's, but do not think there is a simple way to do this.

This works

Thanks

Michael.

Occasional Contributor
sbartley_1
Posts: 6
Registered: ‎03-14-2012

Re: Brocade for Cisco people

Ok, that is a step in the right direction. Thanks. I am using RADIUS, so maybe there's a difference there. If my test file contains, "show ver", then it connects and types "show ver" in the command prompt on the switch but doesn't execute it. If I add a line break at the end of the file, it runs the command and displays the first page, but then I would have to press the space bar to display the rest of the output. The problem is that either way, it's not accepting any keyboard input, and I have to Ctrl-C to exit back to the Windows command line.

I'll play with it some more later and see if I can work around this.

Occasional Contributor
branto
Posts: 6
Registered: ‎03-21-2011

Re: Brocade for Cisco people

Have you looked into using RANCID for configuration management? It runs on Linux/UNIX, but I'm sure you can get it work on cygwin as well. It also offers a facility to script commands.

Occasional Contributor
sbartley_1
Posts: 6
Registered: ‎03-14-2012

Re: Brocade for Cisco people

Here's the workaround for plink...

You can't use "quit"in the text file. For short output's it's fine, but for long ones, it throw's in a "^C" for some reason which stops the output of that command there, but continues with the next command. Try "show mac" for example...well, maybe. I guess it depends on how many mac addresses your switch knows. For comparison, mine is a 4-switch stack of 48-port switches.

I don't have a nice way to keep plink from locking up, just as you saw. So, I wrote a wrapper to launch it without waiting for it to finish. I'm redirecting the output to a text file, and looking at the text file for a helper "exit plink" keyword to appear in the output. The switch doesn't recongize "exit plink", so it just says invalid input and moves on (to the part where plink locks up). The wrapper kills plink.exe when it sees "exit plink" in the output file. It's not perfect, but I think it will be ok. If you need to run several instances at once, changes will need to be made first so that you're not killing "all" of the plink processes, or the wrong one. This is proof-of-concept only...it's just outputting to the cmd window, but you could do lots of other things with it.

In a folder, put "Plink Commands.txt" and "Run Plink Commands.vbs" with the contents below. Double-click "Run Plink Commands.vbs". A cmd window should appear that will fill with the output of the commands, and return to the Windows command line when it's finished.

The last 4 lines of Plink Commands.txt need to be a single space, exit, exit plink, and lastly an empty line.

Here's my sample:

skip-page-display
show ver
show mac

exit
exit plink

Run Plink Commands.vbs...use at your own risk. I speak vbscript...maybe you do maybe you don't...this is really just a proof of concept.

...I don't see a "Preview Post" button, so I'm not sure what this is going to look like (looks like I only lost tabs and blank lines):

'************************Start of Information
'Runs a set of plink commands
'************************End of Information

'************************Start of Script Header
Public objFSO, objShell, objWMI
Set objShell = CreateObject("WScript.Shell")
ForceVisibleCScript
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}\\.\root\cimv2")
ScriptDirectory = Left(WScript.ScriptFullName,(Len(WScript.ScriptFullName)) - (Len(WScript.ScriptName) + 1))
'************************End of Script Header

'************************Start of Main Routine
Launch "plink.exe -ssh -l MyUsername -pw MyPassword MySwithcFQDNorIP < """ & ScriptDirectory & "\Plink Commands.txt"" > """ & ScriptDirectory & "\Plink Output.txt"""

ReadyToKillPlink = False
Do While Not ReadyToKillPlink
Output = ReadFile(ScriptDirectory & "\Plink Output.txt")
If InStr(1,Output,"exit plink",1) > 0 Then ReadyToKillPlink = True
Wscript.Sleep 150
Loop
KillProcess "plink.exe"

Do While IfExist(ScriptDirectory & "\Plink Output.txt")
DeleteFile ScriptDirectory & "\Plink Output.txt"
Wscript.Sleep 150
Loop

WScript.Echo Output
'************************End of Main Routine

'************************Start of Helper Functions
'************************Start of Launch()
Function Launch(FileToLaunch)
'Runs an executable file (.exe, .bat, .cmd, .vbs, etc.) in a hidden window
' and continues this script without waiting for the file to finish.
'Only the FileToLaunch is hidden - If the FileToLaunch launches another process (like launching a shortcut),
' that process will not necessarily be hidden.
'Syntax: Launch "<full path of file to launch>" 'Spaces in the path are okay.
'Example: Launch "C:\MyExecutableFile.exe"
Return = objShell.Run("%comspec% /c """ & FileToLaunch & """",0,False)
End Function'<==Launch()
'************************End of Launch()

'************************Start of ReadFile()
Function ReadFile(filenameandpath)
'Reads a file and returns the contents to the file that called this function.
'Syntax: ReadFile("<full path of file to read>")
'Example: MyVariable = ReadFile("C:\MyFile.txt")
On Error Resume Next
If objFSO.FileExists(filenameandpath) Then
  Set objSize = objFSO.GetFile(filenameandpath) 'prepare to read file size
  If objSize.size > 0 Then 'reading an empty file causes an error, so check the file size first.
   Set objRead = objFSO.OpenTextFile(filenameandpath, 1)
   ReadFile = objRead.ReadAll() 'return the entire file contents to the line that called this function.
   objRead.Close
  Else
   ReadFile = ""
  End If 
End If
End Function'<==ReadFile()
'************************End of ReadFile()

'************************Start of IfExist()
Function IfExist(strName)
'Checks for existence of folder or file given by strName
'Syntax: IfExist("<source full path>")
'Example: If IfExist("C:\MyFile.txt") Then
'   Wscript.Echo "C:\MyFile.txt exists."
'  Else
'   Wscript.Echo "C:\MyFile.txt does not exist."
'  End If
IfExist = False
On Error Resume Next
If objFSO.FileExists(strName) Then IfExist = True
If objFSO.FolderExists(strName) Then IfExist = True
End Function'<==IfExist()
'************************End of IfExist()

'************************Start of DeleteFile()
Function DeleteFile(filenameandpath)
'Specific files only. If you need to use wildcards, use DeleteFilesLike() instead.
'Syntax: DeleteFile <full path of file to delete>
'Example: DeleteFile "C:\MyDeleteableFile.txt"
On Error Resume Next
Set objFile = objFSO.GetFile(filenameandpath)
objFile.Delete(1)
End Function'<==DeleteFile()
'************************End of DeleteFile()

'************************Start of ProcessExists()
Function ProcessExists(MyExe)
'Detect if the exe in the parameter is running.
Set colProcess = objWMI.ExecQuery ("Select * from Win32_Process")
For Each objProcess in colProcess
  If LCase(objProcess.Name) = LCase(MyExe) Then
   ProcessExists = True
   Exit For
  Else
   ProcessExists = False
  End If
Next
End Function'<==ProcessExists()
'************************End of ProcessExists()

'************************Start of KillProcess()
Function KillProcess(MyExe)
On Error Resume Next
'Detect if the exe in the parameter is running and kill it.
Set colProcess = objWMI.ExecQuery ("Select * from Win32_Process")
For Each objProcess in colProcess
  If LCase(objProcess.Name) = LCase(MyExe) Then
   objProcess.Terminate()
  End If
Next
End Function'<==KillProcess()
'************************End of KillProcess()

'************************Start of ForceVisibleCScript()
Function ForceVisibleCScript()
'Requires objShell already declared
If Not WScript.FullName = WScript.Path & "\cscript.exe" Then
  Set objArgs = WScript.Arguments
  For i = 0 to objArgs.Count - 1
   If InStr(1,objArgs(i)," ",1) > 0 Then
    parameter = parameter & " """ & objArgs(i) & """"
   Else
    parameter = parameter & " " & objArgs(i)
   End If
  Next
  Set objShell = CreateObject("WScript.Shell")
  objShell.Run "%comspec% /k " & WScript.Path & "\cscript.exe /nologo """ & WScript.ScriptFullName & """" & parameter,1,False
  WScript.Quit
End If
End Function'<==ForceVisibleCScript()
'************************End of ForceVisibleCScript()
'************************End of Helper Functions

Occasional Contributor
sbartley_1
Posts: 6
Registered: ‎03-14-2012

Re: Brocade for Cisco people

branto wrote:

Have you looked into using RANCID for configuration management? It runs on Linux/UNIX, but I'm sure you can get it work on cygwin as well. It also offers a facility to script commands.

No, I haven't used RANCID. Do you think it could be used to manage adding/removing/changing VLANs configs?

Super Contributor
mschipp
Posts: 1,087
Registered: ‎12-13-2009

Re: Brocade for Cisco people

Hi  sbartley,

     Yes I also found the second adding of exit or quit would return no results - and removing it would then hang plink.  I think that this is a bug.

     I will give your script a go - looks good.

     I would recommend BNA (Brocade Network Adviser) for network management, running of CLI commands and sFlow collector.  You can download a free trial from the Brocade web site.

Thanks

Michael.

Occasional Contributor
sbartley_1
Posts: 6
Registered: ‎03-14-2012

Re: Brocade for Cisco people

We spoke with Brocade about BNA, but it didn't have enough support for non-Brocade devices that we use. Even if we change switches to Brocade, we're still going to be a multi-vendor network. We're leaning towards Solar Winds right now, but haven't made a final decision.

Super Contributor
mschipp
Posts: 1,087
Registered: ‎12-13-2009

Re: Brocade for Cisco people

Cannot seem to find an alt to plink to see if the bug is Brocade or plink, did try privateshell but could not redirect text file into CLI SSH

Sorry not much help here.

N/A
piotr.chodorowski
Posts: 1
Registered: ‎01-13-2013

Re: Brocade for Cisco people

RANCID works with Brocade devices - I'm using it for MLX and TI. It's usefull for only for config backups and revision control.

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.