- Dwarfsoft [GPA] - http://www.dwarfsoft.com/blog -

Brocade Clone Config

I was attempting to get a cloned configuration on Brocade switches as part of a PowerShell script that is adding Aliases and Zones to the Active Config. The original code that created the tasks to be run on the Brocade switch required 2 separate calls to PLINK in order to get all its information. The first was a call to cfgactvshow, and the second was a call to alishow. I knew there had to be a better way, so I developed the following one liner for cloning the active zone configuration based on our standard rules:

zoneobjectcopy "`cfg=\`cfgactvshow|grep "cfg:"\`;echo ${cfg:6}\", \"${cfg:6}_\`date +\"%Y%m%d%H%M%S\"\``"

Simply, this gets the current active configuration name, then clones that to the current name with a date appended on the end. Follow this up with a cfgSave in order to save the newly copied config.