diff --git a/README.md b/README.md index fb794fa..fb39eb9 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,19 @@ Example: `python zoning.py example/zonedata.json` ``` cfgclear -alicreate SRV_P0, 00:00:00:00:00:00:00:01 -alicreate SRV_P1, 00:00:00:00:00:00:00:02 -alicreate CLI_PA, 00:00:00:00:00:00:00:03 -alicreate CLI_PB, 00:00:00:00:00:00:00:04 -zonecreate SRV_CLI1, "SRV_P0; CLI_PA" -zonecreate SRV_CLI2, "SRV_P1; CLI_PB" +alicreate SRV_P0, "00:00:00:00:00:00:00:01" +alicreate SRV_P1, "00:00:00:00:00:00:00:02" +alicreate CLI_PA, "00:00:00:00:00:00:00:03" +alicreate CLI_PB, "00:00:00:00:00:00:00:04" +alicreate STOR2, "00:00:00:00:00:01:00:05;00:00:00:00:00:02:00:05" +zonecreate "SRV_CLI1", "SRV_P0;CLI_PA" +zonecreate "SRV_CLI2", "SRV_P1;CLI_PB" +zonecreate "SRV_P0_STOR2", "SRV_P0;STOR2" +zonecreate "SRV_P1_STOR2", "SRV_P1;STOR2" cfgcreate FABRIC_1, SRV_CLI1 cfgadd FABRIC_1, SRV_CLI2 +cfgadd FABRIC_1, SRV_P0_STOR2 +cfgadd FABRIC_1, SRV_P1_STOR2 cfgenable FABRIC_1 + ``` diff --git a/example/zonedata.json b/example/zonedata.json index 1343baf..17422ac 100644 --- a/example/zonedata.json +++ b/example/zonedata.json @@ -1,15 +1,18 @@ { "ALIAS": [ - {"SRV_P0":"00:00:00:00:00:00:00:01"}, - {"SRV_P1":"00:00:00:00:00:00:00:02"}, - {"CLI_PA":"00:00:00:00:00:00:00:03"}, - {"CLI_PB":"00:00:00:00:00:00:00:04"} + {"SRV_P0":["00:00:00:00:00:00:00:01"]}, + {"SRV_P1":["00:00:00:00:00:00:00:02"]}, + {"CLI_PA":["00:00:00:00:00:00:00:03"]}, + {"CLI_PB":["00:00:00:00:00:00:00:04"]}, + {"STOR2" :["00:00:00:00:00:01:00:05","00:00:00:00:00:02:00:05"]} ], "ZONES": [ {"SRV_CLI1":["SRV_P0","CLI_PA"]}, - {"SRV_CLI2":["SRV_P1","CLI_PB"]} + {"SRV_CLI2":["SRV_P1","CLI_PB"]}, + {"SRV_P0_STOR2":["SRV_P0","STOR2"]}, + {"SRV_P1_STOR2":["SRV_P1","STOR2"]} ], "CFGS": { - "FABRIC_1":["SRV_CLI1","SRV_CLI2"] + "FABRIC_1":["SRV_CLI1","SRV_CLI2","SRV_P0_STOR2","SRV_P1_STOR2" ] } } diff --git a/zoning.py b/zoning.py index 0c55c62..165e41b 100644 --- a/zoning.py +++ b/zoning.py @@ -24,13 +24,13 @@ def mkcfg(wwns,zoning,cfgs,clear=True) for wwn in wwns: k = wwn.keys() v = wwn.values() - alias = "alicreate %s, %s" % (k[0],v[0]) + alias = """alicreate %s, "%s" """ % (k[0],(";").join(v[0])) txt = txt + alias + "\n" for zone in zoning: k = zone.keys() v = zone.values() - zone = 'zonecreate %s, "%s; %s"' % (k[0],v[0][0],v[0][1]) + zone = """zonecreate "%s", "%s" """ % (k[0],(";").join(v[0])) txt = txt + zone + "\n" cfgname = cfgs.keys()[0]