Brocade Zoning Template

Document created by Hidenori Akatoki Employee on Aug 22, 2016Last modified by Kota Saito on Aug 23, 2016
Version 5Show Document
  • View in full screen mode


Another Brocade zoning template. This one accepts the zoning configuration as JSON providing you with opportunity to create JSON input which matches customer standards for zone and alias names.



Service TemplateDescription
Configure Brocade SAN Zoning from JSON inputFeed the zoning configuration to the template in the form of JSON,




VersionFile (With Link)DescriptionTemplate IDVendor IDHAD versionCreated date
01.00.23DownloadInitial ImplementationconfigureAliasesWwnZoningForBrocadeSwitchesJSONinHDSV8.4.0-00May 23, 2016



How to use


  1. Download and import the template.
  2. Create a new service template which produces your zoning configuration in the form of JSON ( see below for details ).
  3. Connect the JSON and optionally the zoning cfg name ( see below for details ).
  4. Create the service and enter login credentials for switch.


Detailed Information

  1. From the JSON, assemble indices for the 2 loops.
  2. Connect to the SAN switch.
  3. cfgshow config name.
  4. Check config exists, exit if it doesn't.
  5. Execute cfgtransshow to obtain any outstanding config transactions.
  6. Check for outstanding config transactions and exit if present.
  7. Loop through zones adding them to the zone config.
  8. Loop through all aliases, alicreate and zoneadd.
  9. cfgsave the config - notice that in it's current form, the service does NOT enable the zoning configuration, this is a safety measure.
  10. Check cfgsave updated flash.
  11. Disconnect from switch.


cfgadd zones loop ( 7 )

  1. JS to obtain zone details from assembled indices.
  2. Add zone to config.
  3. Otain config transaction and store for abort.


alicreate loop ( 8 )

  1. JS to obtain zone and alias details from assembled indices.
  2. alicreate the alias.
  3. Check for 'invalid alias' error and abort transaction if encountered.
  4. zoneshow $zonename
  5. If zone doesn't exist, create the zone.
  6. Add alias to the zone.



You will need to assemble an appropriate data structure to pass to this service. The following provides a highly simplified example in which the zoning data structure is defined as a javascript variable. In reality you would likely assemble the structure based upon customer zone and alias rules and perhaps even use HCS or raidcom to provide a list of ports and wwns for the storage aliases.


JSON Input

The template supports creation of multiple zones containing multiple aliases in a SINGLE config. Simply use the template twice in your service to create zoning in two configs.

For convenience you can store more than one zone config in the data structure but if you do so then you must also pass the name of the config that you wish to apply. If the data structure contains just a single zoning config it is not necessary to pass the additional parameter to indicate the config name.




The following example is included at the foot of this page.

In the this example javascript is executed using the javascript plugin to feed the zoning service. This is the piece that you will assemble for you own service.


(function(serviceProperties, pluginProperties, zoningJSON, cfgname) {

var obj = {};
var cfgname = "SC_fabric_1";
var zoningJSON = {"SC_fabric_1":[

    print("[Informational]: pluginProperties out1 cfgname  -> " + cfgname);

    pluginProperties["out0"] = zoningJSON;
    pluginProperties["out1"] = cfgname;

    return obj;




The javascript plugin and Brocade zoning service template are placed together into the flow and the 2 outputs from the javascript are linked to the Brocade zoning service template.

In this example the javascript outputs the zoningJSON object as out0 and because we have 2 cfgs in our data we also output the cfgname 'out1'.

Here the switch details are already entered but you will also find that they are visible in the gui allowing the values to be set there during service creation.

Be mindful that if you wish to use switch credentials in the template rather than have HAD use 'Agentless Remote Connections' you will need to omit the switch under Administration > Agentless Remote Connections for the Service Group that you intend to use otherwise you may wonder why you are unable to connect to the switch.


Link the zoning input to the 'Brocade SAN Zoning from JSON input' service template.


We must make the javascript outputs 'visible' under gui settings otherwise the template will not compile.


Test the service


Check the zoning.

Finally you must enable the zoning to make it effective.


cfgenable <cfgname>