Search in sources :

Example 26 with NetworkDeviceControllerException

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();
}
Also used : NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException) ArrayList(java.util.ArrayList) FCEndpoint(com.emc.storageos.db.client.model.FCEndpoint)

Aggregations

NetworkDeviceControllerException (com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)26 HashMap (java.util.HashMap)12 FCEndpoint (com.emc.storageos.db.client.model.FCEndpoint)10 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)10 SSHPrompt (com.emc.storageos.networkcontroller.SSHPrompt)7 ControllerException (com.emc.storageos.volumecontroller.ControllerException)7 ArrayList (java.util.ArrayList)7 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)5 CIMInstance (javax.cim.CIMInstance)5 CIMObjectPath (javax.cim.CIMObjectPath)5 WBEMException (javax.wbem.WBEMException)5 WBEMClient (javax.wbem.client.WBEMClient)5 Zone (com.emc.storageos.networkcontroller.impl.mds.Zone)3 NetworkLite (com.emc.storageos.util.NetworkLite)2 List (java.util.List)2 IntRange (org.apache.commons.lang.math.IntRange)2 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 Network (com.emc.storageos.db.client.model.Network)1 NetworkSystem (com.emc.storageos.db.client.model.NetworkSystem)1