use of com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException in project coprhd-controller by CoprHD.
the class MDSDialogTest method testZoning.
static void testZoning(MDSDialog dialog, Integer vsanId) throws ControllerException {
dialog.config();
dialog.deviceAliasConfig();
// Make a bunch of zones to test
for (Integer i = 0; i < 100; i++) {
Zone z = new Zone("z" + i.toString());
Integer lastByte = i + 16;
ZoneMember m1 = new ZoneMember("10:00:00:00:00:FF:FF:" + Integer.toHexString(lastByte).toUpperCase(), ZoneMember.ConnectivityMemberType.WWPN);
m1.setAlias("device-alias_10_" + Integer.toHexString(lastByte).toUpperCase());
ZoneMember m2 = new ZoneMember("50:00:00:00:00:FF:FF:" + Integer.toHexString(lastByte).toUpperCase(), ZoneMember.ConnectivityMemberType.WWPN);
m2.setAlias("device-alias_50_" + Integer.toHexString(lastByte).toUpperCase());
z.getMembers().add(m1);
z.getMembers().add(m2);
zonesToTest.add(z);
try {
dialog.deviceAliasName(m1.getAlias(), m1.getAddress(), false);
} catch (NetworkDeviceControllerException ex) {
if (ex.getMessage().indexOf("already present") >= 0) {
continue;
} else {
throw ex;
}
}
try {
dialog.deviceAliasName(m2.getAlias(), m2.getAddress(), false);
} catch (NetworkDeviceControllerException ex) {
if (ex.getMessage().indexOf("already present") >= 0) {
continue;
} else {
throw ex;
}
}
}
dialog.deviceAliasCommit();
dialog.endConfig();
// Loop, timing differing number of zones
for (Integer i = 4; i < 50; i += 5) {
List<Zone> zoneArgs = new ArrayList<Zone>();
for (int j = 0; j <= i; j++) {
zoneArgs.add(zonesToTest.get(j));
}
_log.info("Creating zones:");
MdsNetworkSystemDevice device = new MdsNetworkSystemDevice();
device.addZonesStrategy(dialog, zoneArgs, vsanId, false);
printVsan(dialog, vsanId);
_log.info("Removing zones:");
device.removeZonesStrategy(dialog, zoneArgs, vsanId, false);
printVsan(dialog, vsanId);
}
dialog.config();
dialog.deviceAliasConfig();
for (Zone zone : zonesToTest) {
for (ZoneMember zoneMember : zone.getMembers()) {
if (zoneMember.getAlias() != null) {
try {
dialog.deviceAliasName(zoneMember.getAlias(), zoneMember.getAddress(), true);
} catch (NetworkDeviceControllerException ex) {
if (ex.getMessage().indexOf("not present") >= 0) {
continue;
} else {
throw ex;
}
}
}
}
}
dialog.deviceAliasCommit();
dialog.endConfig();
}
Aggregations