Search in sources :

Example 51 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTests method testRpVplexConnectivtyAndPlacement.

/**
 * RP VPLEX connectivity with only the vplex is visible to the rpsites
 */
@Test
public void testRpVplexConnectivtyAndPlacement() {
    // Create Tenant
    TenantOrg tenant = new TenantOrg();
    tenant.setId(URI.create("tenant"));
    _dbClient.createObject(tenant);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create block consistency group
    BlockConsistencyGroup cg = new BlockConsistencyGroup();
    cg.setProject(new NamedURI(project.getId(), project.getLabel()));
    cg.setId(URI.create("blockCG"));
    _dbClient.createObject(cg);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("5GB", 4, cg);
    StringMap siteVolCap = new StringMap();
    siteVolCap.put("site1", "3221225472");
    siteVolCap.put("site2", "3221225472");
    StringMap siteVolCnt = new StringMap();
    siteVolCnt.put("site1", "10");
    siteVolCnt.put("site2", "10");
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] rp1FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    String[] rp2FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    // Create Virtual Array1
    VirtualArray varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    // Create 2 Networks
    StringSet connVA = new StringSet();
    connVA.add(varray1.getId().toString());
    Network networkFE1 = PlacementTestUtils.createNetwork(_dbClient, (String[]) ArrayUtils.addAll(vplex1FE, rp1FE), "VSANFE1", "FC+BROCADE+FE", connVA);
    Network networkBE1 = PlacementTestUtils.createNetwork(_dbClient, vplex1BE, "VSANBE1", "FC+BROCADE+BE", connVA);
    // Create storage system
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    // Create two front-end storage ports VMAX1
    List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, networkBE1, vmax1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupvmax1" + i, "C0+FC0" + i));
    }
    // Create VPLEX storage system
    StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
    // Create two front-end storage ports VPLEX1
    List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex1FE.length; i++) {
        fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, networkFE1, vplex1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX1
    List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex1BE.length; i++) {
        bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, networkBE1, vplex1BE[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
    }
    // Create RP system
    AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
    for (int i = 0; i < rp1FE.length; i++) {
        wwnSite1.add(rp1FE[i]);
    }
    StringSetMap initiatorsSiteMap = new StringSetMap();
    initiatorsSiteMap.put("site1", wwnSite1);
    AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
    for (int i = 0; i < rp2FE.length; i++) {
        wwnSite2.add(rp2FE[i]);
    }
    initiatorsSiteMap.put("site2", wwnSite2);
    StringSet storSystems = new StringSet();
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster1"));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex1cluster1"));
    ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", null, "IP", initiatorsSiteMap, storSystems, null, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
    // RP Site Array objects
    RPSiteArray rpSiteArray1 = new RPSiteArray();
    rpSiteArray1.setId(URI.create("rsa1"));
    rpSiteArray1.setStorageSystem(URI.create("vplex1"));
    rpSiteArray1.setRpInternalSiteName("site1");
    rpSiteArray1.setRpSiteName("site1");
    rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray1);
    RPSiteArray rpSiteArray2 = new RPSiteArray();
    rpSiteArray2.setId(URI.create("rsa2"));
    rpSiteArray2.setStorageSystem(URI.create("vplex1"));
    rpSiteArray2.setRpInternalSiteName("site2");
    rpSiteArray2.setRpSiteName("site2");
    rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray2);
    ConnectivityUtil.updateRpSystemConnectivity(rpSystem, _dbClient);
    StringSet virtualArrays = rpSystem.getVirtualArrays();
    assertNotNull(virtualArrays);
    assertTrue(!virtualArrays.isEmpty());
    for (String varrayURIStr : virtualArrays) {
        _log.info("Protection is possible to Virtual Array: " + varrayURIStr);
    }
    // Create a storage pool for vmax1
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool1", "Pool1", Long.valueOf(SIZE_GB * 500), Long.valueOf(SIZE_GB * 500), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a base RP virtual pool
    VirtualPool tgtVpool = new VirtualPool();
    tgtVpool.setId(URI.create("vpoolRP"));
    tgtVpool.setLabel("vpoolRP");
    tgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    tgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    tgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    tgtVpool.setMatchedStoragePools(matchedPools);
    tgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(varray1.getId().toString());
    tgtVpool.setVirtualArrays(virtualArrays1);
    _dbClient.createObject(tgtVpool);
    // Create a RP VPLEX virtual pool
    VirtualPool rpSrcVpool = new VirtualPool();
    rpSrcVpool.setId(URI.create("rpVplexVpool"));
    rpSrcVpool.setLabel("rpVplexVpool");
    rpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
    rpSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    rpSrcVpool.setJournalSize("10GB");
    VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
    protectionSettings.setVirtualPool(tgtVpool.getId());
    protectionSettings.setJournalSize("10GB");
    protectionSettings.setId(URI.create("protectionSettings"));
    _dbClient.createObject(protectionSettings);
    List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
    protectionSettingsList.add(protectionSettings);
    StringMap protectionVarray = new StringMap();
    protectionVarray.put(varray1.getId().toString(), protectionSettingsList.get(0).getId().toString());
    rpSrcVpool.setProtectionVarraySettings(protectionVarray);
    rpSrcVpool.setRpCopyMode("SYNCHRONOUS");
    rpSrcVpool.setRpRpoType("MINUTES");
    rpSrcVpool.setRpRpoValue(Long.valueOf("5"));
    matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    rpSrcVpool.setMatchedStoragePools(matchedPools);
    rpSrcVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(varray1.getId().toString());
    rpSrcVpool.setVirtualArrays(virtualArrays2);
    _dbClient.createObject(rpSrcVpool);
    List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray1, project, rpSrcVpool, capabilities);
    assertNotNull(recommendations);
    assertTrue(!recommendations.isEmpty());
    assertNotNull(recommendations.get(0));
    RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
    for (RPRecommendation rpVplexRec : rec.getSourceRecommendations()) {
        assertNotNull(rpVplexRec.getVirtualVolumeRecommendation());
        assertNotNull(rpVplexRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
        assertNotNull(rpVplexRec.getSourceStoragePool());
        assertNotNull(rpVplexRec.getSourceStorageSystem());
        assertNotNull(rpVplexRec.getTargetRecommendations());
        assertTrue(!rpVplexRec.getTargetRecommendations().isEmpty());
        assertNotNull(rpVplexRec.getInternalSiteName());
        assertTrue("site1".equals(rpVplexRec.getInternalSiteName()));
        assertTrue("vmax1".equals(rpVplexRec.getSourceStorageSystem().toString()));
        assertTrue(("pool1".equals(rpVplexRec.getSourceStoragePool().toString())));
        assertTrue("vplex1".equals(rpVplexRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
        for (RPRecommendation targetRec : rpVplexRec.getTargetRecommendations()) {
            assertNotNull(targetRec.getSourceStoragePool());
            assertNotNull(targetRec.getInternalSiteName());
            assertNotNull(targetRec.getSourceStorageSystem());
            assertNotNull(targetRec.getVirtualPool());
            assertTrue("vpoolRP".equals(targetRec.getVirtualPool().getId().toString()));
            assertTrue("varray1".equals(targetRec.getVirtualArray().toString()));
            assertTrue("site1".equals(targetRec.getInternalSiteName()));
            assertTrue("vplex1".equals(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
            assertTrue("vmax1".equals(targetRec.getSourceStorageSystem().toString()));
            assertTrue(("pool1".equals(targetRec.getSourceStoragePool().toString())));
        }
    }
    assertNotNull(rec.getSourceJournalRecommendation());
    assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
    assertNotNull(rec.getSourceJournalRecommendation().getSourceStorageSystem());
    assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
    if (rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation() != null) {
        assertTrue("vplex1".equals(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
    }
    assertTrue("site1".equals(rec.getSourceJournalRecommendation().getInternalSiteName().toString()));
    assertTrue(("pool1".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
    assertNotNull(rec.getTargetJournalRecommendations());
    assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
    for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
        assertNotNull(targetJournalRec.getVirtualArray());
        assertNotNull(targetJournalRec.getInternalSiteName());
        assertNotNull(targetJournalRec.getSourceStorageSystem());
        assertNotNull(targetJournalRec.getSourceStoragePool());
        assertTrue("varray1".equals(targetJournalRec.getVirtualArray().toString()));
        assertTrue("vmax1".equals(targetJournalRec.getSourceStorageSystem().toString()));
        assertTrue("site1".equals(targetJournalRec.getInternalSiteName().toString()));
        assertTrue(("pool1".equals(targetJournalRec.getSourceStoragePool().toString())));
        assertTrue("vplex1".equals(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
    }
    _log.info(rec.toString(_dbClient));
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) StringMap(com.emc.storageos.db.client.model.StringMap) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StoragePool(com.emc.storageos.db.client.model.StoragePool) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) NamedURI(com.emc.storageos.db.client.model.NamedURI) ArrayList(java.util.ArrayList) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Example 52 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTests method testPlacementVPlex.

/**
 * Simple VPLEX local block placement.
 */
@Test
public void testPlacementVPlex() {
    String[] vplexFE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplexBE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    // Create a Network
    Network networkFE = PlacementTestUtils.createNetwork(_dbClient, vplexFE, "VSANFE", "FC+BROCADE+FE", null);
    Network networkBE = PlacementTestUtils.createNetwork(_dbClient, vplexBE, "VSANBE", "FC+BROCADE+BE", null);
    // Create a Virtual Array
    VirtualArray varray = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    // Create a storage system
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    // Create two front-end storage ports VMAX
    List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, networkBE, vmax1FE[i], varray, StoragePort.PortType.frontend.name(), "portGroupvmax" + i, "C0+FC0" + i));
    }
    // Create a second storage system
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
    // Create front end ports for the second VMAX
    List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, networkBE, vmax2FE[i], varray, StoragePort.PortType.frontend.name(), "portGroupvmax" + i, "C0+FC0" + i));
    }
    // Create a VPLEX storage system
    StorageSystem vplexStorageSystem = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
    // Create two front-end storage ports VPLEX
    List<StoragePort> fePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexFE.length; i++) {
        fePorts.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem, networkFE, vplexFE[i], varray, StoragePort.PortType.frontend.name(), "portGroupFE" + i, "A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX
    List<StoragePort> bePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexBE.length; i++) {
        bePorts.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem, networkBE, vplexBE[i], varray, StoragePort.PortType.backend.name(), "portGroupBE" + i, "B0+FC0" + i));
    }
    // Create a storage pool
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem1, "pool1", "Pool1", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem1, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem1, "pool3", "Pool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem2, "pool4", "Pool4", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem2, "pool5", "Pool5", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem2, "pool6", "Pool6", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a virtual pool
    VirtualPool vpool = new VirtualPool();
    vpool.setId(URI.create("vpool"));
    vpool.setLabel("vpool");
    vpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    vpool.setMatchedStoragePools(matchedPools);
    vpool.setUseMatchedPools(true);
    _dbClient.createObject(vpool);
    // Create a VPLEX virtual pool
    VirtualPool vplexVpool = new VirtualPool();
    vplexVpool.setId(URI.create("vplexVpool"));
    vplexVpool.setLabel("vplexVpool");
    vplexVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vplexVpool.setDriveType(SupportedDriveTypes.FC.name());
    vplexVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    vplexVpool.setMatchedStoragePools(matchedPools);
    vplexVpool.setUseMatchedPools(true);
    _dbClient.createObject(vplexVpool);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    _dbClient.createObject(project);
    // Test that only pools from the source storageSystem1 show up.
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    capabilities.put(VirtualPoolCapabilityValuesWrapper.SOURCE_STORAGE_SYSTEM, storageSystem1);
    // Run single volume placement: Run 10 times to make sure pool3 never comes up.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray, project, vplexVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        VPlexRecommendation rec = (VPlexRecommendation) recommendations.get(0);
        assertNotNull(rec.getSourceStoragePool());
        assertNotNull(rec.getSourceStorageSystem());
        assertNotNull(rec.getVPlexStorageSystem());
        assertTrue("vmax1".equals(rec.getSourceStorageSystem().toString()));
        assertTrue("vplex1".equals(rec.getVPlexStorageSystem().toString()));
        assertTrue(("pool2".equals(rec.getSourceStoragePool().toString())) || ("pool1".equals(rec.getSourceStoragePool().toString())));
        _log.info("Recommendation " + i + ": " + recommendations.size() + ", Pool Chosen: " + rec.getSourceStoragePool().toString());
    }
    // Test that only pools from the source storageSystem2 show up.
    capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    capabilities.put(VirtualPoolCapabilityValuesWrapper.SOURCE_STORAGE_SYSTEM, storageSystem2);
    // Run single volume placement: Run 10 times to make sure pool3 never comes up.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray, project, vplexVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        VPlexRecommendation rec = (VPlexRecommendation) recommendations.get(0);
        assertNotNull(rec.getSourceStoragePool());
        assertNotNull(rec.getSourceStorageSystem());
        assertNotNull(rec.getVPlexStorageSystem());
        assertTrue("vmax2".equals(rec.getSourceStorageSystem().toString()));
        assertTrue("vplex1".equals(rec.getVPlexStorageSystem().toString()));
        assertTrue(("pool4".equals(rec.getSourceStoragePool().toString())) || ("pool5".equals(rec.getSourceStoragePool().toString())));
        _log.info("Recommendation " + i + ": " + recommendations.size() + ", Pool Chosen: " + rec.getSourceStoragePool().toString());
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StoragePool(com.emc.storageos.db.client.model.StoragePool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) Project(com.emc.storageos.db.client.model.Project) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Test(org.junit.Test)

Example 53 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTests method testPlacementRpVplexAdvancedSite1toSite2.

/**
 * RP VPLEX placement -- placement decision based on RP array visibility
 */
@Test
public void testPlacementRpVplexAdvancedSite1toSite2() {
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    String[] rp1FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    String[] rp2FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    String[] vplex2FE = { "FE:FE:FE:FE:FE:FE:FE:02", "FE:FE:FE:FE:FE:FE:FE:03" };
    String[] vplex2BE = { "BE:BE:BE:BE:BE:BE:BE:02", "BE:BE:BE:BE:BE:BE:BE:03" };
    String[] vplex3FE = { "FE:FE:FE:FE:FE:FE:FE:04", "FE:FE:FE:FE:FE:FE:FE:05" };
    String[] vplex3BE = { "BE:BE:BE:BE:BE:BE:BE:04", "BE:BE:BE:BE:BE:BE:BE:05" };
    // Create 3 Virtual Arrays
    VirtualArray varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    VirtualArray varray2 = PlacementTestUtils.createVirtualArray(_dbClient, "varray2");
    VirtualArray varray3 = PlacementTestUtils.createVirtualArray(_dbClient, "varray3");
    // Create 1 Network
    StringSet connVA = new StringSet();
    connVA.add(varray1.getId().toString());
    connVA.add(varray2.getId().toString());
    connVA.add(varray3.getId().toString());
    Network network = PlacementTestUtils.createNetwork(_dbClient, vplex1FE, "VSAN", "FC+BROCADE", connVA);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex2FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex3FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex1BE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex2BE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex3BE);
    PlacementTestUtils.addEndpoints(_dbClient, network, rp1FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, rp2FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vmax1FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vmax2FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vmax3FE);
    // Create 3 storage systems
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
    StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
    // Create two front-end storage ports VMAX1
    List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network, vmax1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupvmax1" + i, "C0+FC0" + i));
    }
    // Create two front-end storage ports VMAX2
    List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax2FE.length; i++) {
        vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network, vmax2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
    }
    // Create two front-end storage ports VMAX3
    List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax3FE.length; i++) {
        vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network, vmax3FE[i], varray3, StoragePort.PortType.frontend.name(), "portGroupvmax3" + i, "E0+FC0" + i));
    }
    // Create 2 VPLEX storage systems
    StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
    StorageSystem vplexStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex2");
    // Create two front-end storage ports VPLEX1
    List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex1FE.length; i++) {
        fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX1
    List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex1BE.length; i++) {
        bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1BE[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
    }
    // Create two front-end storage ports VPLEX2
    List<StoragePort> fePorts2 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex2FE.length; i++) {
        fePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupFE2-" + (i + 1), "F0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX2
    List<StoragePort> bePorts2 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex2BE.length; i++) {
        bePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2BE[i], varray2, StoragePort.PortType.backend.name(), "portGroupBE2-" + (i + 1), "G0+FC0" + i));
    }
    // Create two front-end storage ports VPLEX3
    List<StoragePort> fePorts3 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex3FE.length; i++) {
        fePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3FE[i], varray3, StoragePort.PortType.frontend.name(), "portGroupFE3-" + (i + 1), "H0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX3
    List<StoragePort> bePorts3 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex3BE.length; i++) {
        bePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3BE[i], varray3, StoragePort.PortType.backend.name(), "portGroupBE3-" + (i + 1), "I0+FC0" + i));
    }
    // Create RP system
    AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
    for (int i = 0; i < rp1FE.length; i++) {
        wwnSite1.add(rp1FE[i]);
    }
    StringSetMap initiatorsSiteMap = new StringSetMap();
    initiatorsSiteMap.put("site1", wwnSite1);
    AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
    for (int i = 0; i < rp2FE.length; i++) {
        wwnSite2.add(rp2FE[i]);
    }
    initiatorsSiteMap.put("site2", wwnSite2);
    StringSet storSystems = new StringSet();
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster1"));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster2"));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex2cluster1"));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex2cluster2"));
    StringSetMap rpVisibleSystems = new StringSetMap();
    StringSet storageIds = new StringSet();
    storageIds.add(vplexStorageSystem1.getId().toString());
    rpVisibleSystems.put("site1", storageIds);
    StringSet storageIds2 = new StringSet();
    storageIds2.add(vplexStorageSystem2.getId().toString());
    rpVisibleSystems.put("site2", storageIds2);
    StringMap siteVolCap = new StringMap();
    siteVolCap.put("site1", "3221225472");
    siteVolCap.put("site2", "3221225472");
    StringMap siteVolCnt = new StringMap();
    siteVolCnt.put("site1", "10");
    siteVolCnt.put("site2", "10");
    ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", null, "IP", initiatorsSiteMap, storSystems, rpVisibleSystems, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
    // RP Site Array objects
    RPSiteArray rpSiteArray1 = new RPSiteArray();
    rpSiteArray1.setId(URI.create("rsa1"));
    rpSiteArray1.setStorageSystem(URI.create("vplex1"));
    rpSiteArray1.setRpInternalSiteName("site1");
    rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray1);
    RPSiteArray rpSiteArray2 = new RPSiteArray();
    rpSiteArray2.setId(URI.create("rsa2"));
    rpSiteArray2.setStorageSystem(URI.create("vplex2"));
    rpSiteArray2.setRpInternalSiteName("site2");
    rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray2);
    // Create a storage pool for vmax1
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool1", "Pool1", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool3", "Pool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool4", "Pool4", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool5", "Pool5", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 50), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool6", "Pool6", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool pool7 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool7", "Pool7", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool pool8 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool8", "Pool8", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool pool9 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool9", "Pool9", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create HA virtual pool
    VirtualPool haVpool = new VirtualPool();
    haVpool.setId(URI.create(haVpoolUri));
    haVpool.setLabel("haVpool");
    haVpool.setType("block");
    haVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    haVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    haVpool.setMatchedStoragePools(matchedPools);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(varray1.getId().toString());
    haVpool.setVirtualArrays(virtualArrays1);
    haVpool.setUseMatchedPools(true);
    _dbClient.createObject(haVpool);
    // Create RP target vpool
    VirtualPool rpTgtVpool = new VirtualPool();
    rpTgtVpool.setId(URI.create("rpTgtVpool"));
    rpTgtVpool.setLabel("rpTgtVpool");
    rpTgtVpool.setType("block");
    rpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    rpTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    matchedPools = new StringSet();
    matchedPools.add(pool7.getId().toString());
    matchedPools.add(pool8.getId().toString());
    matchedPools.add(pool9.getId().toString());
    rpTgtVpool.setMatchedStoragePools(matchedPools);
    rpTgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays3 = new StringSet();
    virtualArrays3.add(varray3.getId().toString());
    rpTgtVpool.setVirtualArrays(virtualArrays3);
    _dbClient.createObject(rpTgtVpool);
    // Create a RP VPLEX source virtual pool
    VirtualPool rpVplexSrcVpool = new VirtualPool();
    rpVplexSrcVpool.setId(URI.create(dummyVpoolUri));
    rpVplexSrcVpool.setLabel("rpVplexSrcVpool");
    rpVplexSrcVpool.setType("block");
    rpVplexSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpVplexSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
    rpVplexSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
    StringMap vavpMap = new StringMap();
    vavpMap.put(varray1.getId().toString(), haVpool.getId().toString());
    rpVplexSrcVpool.setHaVarrayVpoolMap(vavpMap);
    VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
    protectionSettings.setVirtualPool(rpTgtVpool.getId());
    protectionSettings.setId(URI.create("protectionSettings"));
    _dbClient.createObject(protectionSettings);
    List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
    protectionSettingsList.add(protectionSettings);
    StringMap protectionVarray = new StringMap();
    protectionVarray.put(varray3.getId().toString(), protectionSettingsList.get(0).getId().toString());
    rpVplexSrcVpool.setProtectionVarraySettings(protectionVarray);
    rpVplexSrcVpool.setRpCopyMode("SYNCHRONOUS");
    rpVplexSrcVpool.setRpRpoType("MINUTES");
    rpVplexSrcVpool.setRpRpoValue(Long.valueOf("5"));
    matchedPools = new StringSet();
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    rpVplexSrcVpool.setMatchedStoragePools(matchedPools);
    rpVplexSrcVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(varray2.getId().toString());
    rpVplexSrcVpool.setVirtualArrays(virtualArrays2);
    _dbClient.createObject(rpVplexSrcVpool);
    // Create Tenant
    TenantOrg tenant = new TenantOrg();
    tenant.setId(URI.create("tenant"));
    _dbClient.createObject(tenant);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create block consistency group
    BlockConsistencyGroup cg = new BlockConsistencyGroup();
    cg.setProject(new NamedURI(project.getId(), project.getLabel()));
    cg.setId(URI.create("blockCG"));
    _dbClient.createObject(cg);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, cg);
    // Run single volume placement: Run 10 times to make sure pool6 never comes up for source and pool9 for target.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray2, project, rpVplexSrcVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
        assertNotNull(rec.getSourceRecommendations());
        assertNotNull(!rec.getSourceRecommendations().isEmpty());
        assertNotNull(rec.getProtectionDevice());
        assertTrue("rp1".equals(rec.getProtectionDevice().toString()));
        for (RPRecommendation sourceRec : rec.getSourceRecommendations()) {
            assertNotNull(sourceRec.getInternalSiteName());
            assertNotNull(sourceRec.getVirtualArray());
            assertNotNull(sourceRec.getVirtualPool());
            assertNotNull(sourceRec.getVirtualVolumeRecommendation());
            assertNotNull(sourceRec.getHaRecommendation());
            assertNotNull(sourceRec.getTargetRecommendations());
            assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
            assertTrue("site1".equals(sourceRec.getInternalSiteName()));
            assertTrue("vmax2".equals(sourceRec.getSourceStorageSystem().toString()));
            assertTrue(("pool5".equals(sourceRec.getSourceStoragePool().toString())) || ("pool4".equals(sourceRec.getSourceStoragePool().toString())));
            if (VirtualPool.vPoolSpecifiesHighAvailability(sourceRec.getVirtualPool())) {
                assertNotNull(sourceRec.getVirtualVolumeRecommendation());
            }
            assertNotNull(sourceRec.getHaRecommendation().getVirtualVolumeRecommendation());
            assertTrue("vplex1".equals(sourceRec.getHaRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
            assertTrue("varray1".equals(sourceRec.getHaRecommendation().getVirtualArray().toString()));
            assertTrue(haVpoolUri.equals(sourceRec.getHaRecommendation().getVirtualPool().getId().toString()));
            assertTrue("vmax1".equals(sourceRec.getHaRecommendation().getSourceStorageSystem().toString()));
            assertTrue(("pool2".equals(sourceRec.getHaRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(sourceRec.getHaRecommendation().getSourceStoragePool().toString())));
            assertNotNull(sourceRec.getTargetRecommendations());
            assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
            for (RPRecommendation targetRec : sourceRec.getTargetRecommendations()) {
                assertNotNull(targetRec.getInternalSiteName());
                assertNotNull(targetRec.getVirtualArray());
                assertNotNull(targetRec.getVirtualPool());
                if (VirtualPool.vPoolSpecifiesHighAvailability(targetRec.getVirtualPool())) {
                    assertNotNull(targetRec.getVirtualVolumeRecommendation());
                }
                assertTrue("varray3".equals(targetRec.getVirtualArray().toString()));
                assertTrue(rpTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
                assertTrue("site2".equals(targetRec.getInternalSiteName()));
                assertTrue("vmax3".equals(targetRec.getSourceStorageSystem().toString()));
                assertTrue(("pool8".equals(targetRec.getSourceStoragePool().toString())) || ("pool7".equals(targetRec.getSourceStoragePool().toString())));
            }
        }
        // source journal
        assertNotNull(rec.getSourceJournalRecommendation());
        RPRecommendation sourceJournalRec = rec.getSourceJournalRecommendation();
        if (VirtualPool.vPoolSpecifiesHighAvailability(sourceJournalRec.getVirtualPool())) {
            assertNotNull(sourceJournalRec.getVirtualVolumeRecommendation());
        }
        assertTrue(("pool5".equals(sourceJournalRec.getSourceStoragePool().toString())) || ("pool4".equals(sourceJournalRec.getSourceStoragePool().toString())));
        // target journals
        assertNotNull(rec.getTargetJournalRecommendations());
        assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
        for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
            assertNotNull(targetJournalRec.getInternalSiteName());
            assertNotNull(targetJournalRec.getVirtualArray());
            assertNotNull(targetJournalRec.getVirtualPool());
            if (VirtualPool.vPoolSpecifiesHighAvailability(targetJournalRec.getVirtualPool())) {
                assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
            }
            assertTrue("vmax3".equals(targetJournalRec.getSourceStorageSystem().toString()));
            assertTrue(("pool8".equals(targetJournalRec.getSourceStoragePool().toString())) || ("pool7".equals(targetJournalRec.getSourceStoragePool().toString())));
        }
        _log.info("Recommendation : " + rec.toString(_dbClient));
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) NamedURI(com.emc.storageos.db.client.model.NamedURI) ArrayList(java.util.ArrayList) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Example 54 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTests method testBasicRPPlacement2.

/**
 * Simple block placement with RP
 * Basic RP Placement test - VMAX
 * In this test, Pool1 from VMAX1 and Pool3 from VMAX3 are available as candidates for source and source journal.
 * However, Pool3 doesnt have connectivity to the RP site and should not be chosen.
 * Placement also should not fail here, and Pool1 should be chosen for both source and its journal.
 */
@Test
public void testBasicRPPlacement2() {
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax3FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
    String[] rp1FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    String[] rp2FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    // Create 2 Virtual Arrays
    VirtualArray rpSrcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "rpSrcVarray");
    VirtualArray rpTgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "rpTgtVarray");
    // Create 2 Networks
    StringSet connVA = new StringSet();
    connVA.add(rpSrcVarray.getId().toString());
    Network network1 = PlacementTestUtils.createNetwork(_dbClient, rp1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
    connVA = new StringSet();
    connVA.add(rpTgtVarray.getId().toString());
    Network network2 = PlacementTestUtils.createNetwork(_dbClient, rp2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    // Create 2 storage systems
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
    StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
    // Create two front-end storage ports VMAX1
    List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network1, vmax1FE[i], rpSrcVarray, StoragePort.PortType.frontend.name(), "portGroupSite1vmax" + i, "C0+FC0" + i));
    }
    // Create two front-end storage ports VMAX2
    List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax2FE.length; i++) {
        vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network2, vmax2FE[i], rpTgtVarray, StoragePort.PortType.frontend.name(), "portGroupSite2vmax" + i, "D0+FC0" + i));
    }
    // Create two front-end storage ports VMAX3
    List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax3FE.length; i++) {
        vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network1, vmax3FE[i], rpSrcVarray, StoragePort.PortType.frontend.name(), "portGroupSite3vmax" + i, "E0+FC0" + i));
    }
    // Create RP system
    AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
    for (int i = 0; i < rp1FE.length; i++) {
        wwnSite1.add(rp1FE[i]);
    }
    StringSetMap initiatorsSiteMap = new StringSetMap();
    initiatorsSiteMap.put("site1", wwnSite1);
    AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
    for (int i = 0; i < rp2FE.length; i++) {
        wwnSite2.add(rp2FE[i]);
    }
    initiatorsSiteMap.put("site2", wwnSite2);
    StringSet storSystems = new StringSet();
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", storageSystem1.getSerialNumber()));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem2.getSerialNumber()));
    StringMap siteVolCap = new StringMap();
    siteVolCap.put("site1", "3221225472");
    siteVolCap.put("site2", "3221225472");
    StringMap siteVolCnt = new StringMap();
    siteVolCnt.put("site1", "10");
    siteVolCnt.put("site2", "10");
    ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", null, "IP", initiatorsSiteMap, storSystems, null, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
    // RP Site Array objects
    RPSiteArray rpSiteArray1 = new RPSiteArray();
    rpSiteArray1.setId(URI.create("rsa1"));
    rpSiteArray1.setStorageSystem(URI.create("vmax1"));
    rpSiteArray1.setRpInternalSiteName("site1");
    rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray1);
    RPSiteArray rpSiteArray2 = new RPSiteArray();
    rpSiteArray2.setId(URI.create("rsa2"));
    rpSiteArray2.setStorageSystem(URI.create("vmax2"));
    rpSiteArray2.setRpInternalSiteName("site2");
    rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray2);
    // Create a storage pool for vmax1
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem1, "pool1", "Pool1", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem1, "pool2", "Pool2", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem3, "pool3", "Pool3", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool4", "Pool4", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool5", "Pool5", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool6", "Pool6", Long.valueOf(SIZE_GB * 1), Long.valueOf(SIZE_GB * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a virtual pool
    VirtualPool rpTgtVpool = new VirtualPool();
    rpTgtVpool.setId(URI.create("rpTgtVpool"));
    rpTgtVpool.setLabel("RP Target Vpool");
    rpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    rpTgtVpool.setMatchedStoragePools(matchedPools);
    rpTgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(rpTgtVarray.getId().toString());
    rpTgtVpool.setVirtualArrays(virtualArrays2);
    _dbClient.createObject(rpTgtVpool);
    // Create a RP virtual pool
    VirtualPool rpSrcVpool = new VirtualPool();
    rpSrcVpool.setId(URI.create("rpSrcVpool"));
    rpSrcVpool.setLabel("RP Source Vpool");
    rpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
    VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
    protectionSettings.setVirtualPool(rpTgtVpool.getId());
    protectionSettings.setId(URI.create("protectionSettings"));
    _dbClient.createObject(protectionSettings);
    List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
    protectionSettingsList.add(protectionSettings);
    StringMap protectionVarray = new StringMap();
    protectionVarray.put(rpTgtVarray.getId().toString(), protectionSettingsList.get(0).getId().toString());
    rpSrcVpool.setProtectionVarraySettings(protectionVarray);
    rpSrcVpool.setRpCopyMode("SYNCHRONOUS");
    rpSrcVpool.setRpRpoType("MINUTES");
    rpSrcVpool.setRpRpoValue(Long.valueOf("5"));
    matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    // matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    rpSrcVpool.setMatchedStoragePools(matchedPools);
    rpSrcVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(rpSrcVarray.getId().toString());
    rpSrcVpool.setVirtualArrays(virtualArrays1);
    _dbClient.createObject(rpSrcVpool);
    // Create Tenant
    TenantOrg tenant = new TenantOrg();
    tenant.setId(URI.create("tenant"));
    _dbClient.createObject(tenant);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create block consistency group
    BlockConsistencyGroup cg = new BlockConsistencyGroup();
    cg.setProject(new NamedURI(project.getId(), project.getLabel()));
    cg.setId(URI.create("blockCG"));
    _dbClient.createObject(cg);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, cg);
    // Run single volume placement: Run 10 times to make sure pool3 never comes up for source and pool6 for target.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, rpSrcVarray, project, rpSrcVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
        assertNotNull(rec.getSourceRecommendations());
        assertTrue(!rec.getSourceRecommendations().isEmpty());
        assertNotNull(rec.getProtectionDevice());
        assertNotNull(rec.getPlacementStepsCompleted().name());
        assertTrue("rp1".equals(rec.getProtectionDevice().toString()));
        for (RPRecommendation rpRec : rec.getSourceRecommendations()) {
            assertNotNull(rpRec.getInternalSiteName());
            assertNotNull(rpRec.getSourceStorageSystem());
            assertNotNull(rpRec.getSourceStoragePool());
            assertTrue("site1".equals(rpRec.getInternalSiteName()));
            assertTrue("vmax1".equals(rpRec.getSourceStorageSystem().toString()));
            assertTrue(("pool2".equals(rpRec.getSourceStoragePool().toString())) || ("pool1".equals(rpRec.getSourceStoragePool().toString())));
            assertNotNull(rpRec.getTargetRecommendations());
            assertTrue(!rpRec.getTargetRecommendations().isEmpty());
            for (RPRecommendation targetRec : rpRec.getTargetRecommendations()) {
                assertNotNull(targetRec.getSourceStoragePool());
                assertTrue("vmax2".equals(targetRec.getSourceStorageSystem().toString()));
                assertTrue("site2".equals(targetRec.getInternalSiteName()));
                assertTrue("pool5".equals(targetRec.getSourceStoragePool().toString()) || "pool4".equals(targetRec.getSourceStoragePool().toString()));
            }
        }
        // source journal
        assertNotNull(rec.getSourceJournalRecommendation());
        assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
        assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
        assertTrue(("pool2".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
        // target journal
        assertNotNull(rec.getTargetJournalRecommendations());
        assertNotNull(!rec.getTargetJournalRecommendations().isEmpty());
        for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
            assertNotNull(targetJournalRec.getSourceStoragePool());
            assertTrue("pool5".equals(targetJournalRec.getSourceStoragePool().toString()) || "pool4".equals(targetJournalRec.getSourceStoragePool().toString()));
            assertTrue("site2".equals(targetJournalRec.getInternalSiteName()));
            assertTrue("vmax2".equals(targetJournalRec.getSourceStorageSystem().toString()));
        }
        _log.info(rec.toString(_dbClient));
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) NamedURI(com.emc.storageos.db.client.model.NamedURI) ArrayList(java.util.ArrayList) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Example 55 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTests method testPlacementRpMetropointCdp.

/*
     * MetroPoint placement - 2 local copies, one on each side
     * 
     * NOTE: Force negative MP CDP test by following instructions labeled with "NEGATIVE-TEST"
     */
@Test
public void testPlacementRpMetropointCdp() {
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax1BE = { "50:BE:BE:BE:BE:BE:BE:00", "50:BE:BE:BE:BE:BE:BE:01" };
    String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2BE = { "51:BE:BE:BE:BE:BE:BE:00", "51:BE:BE:BE:BE:BE:BE:01" };
    String[] vmax3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax3BE = { "52:BE:BE:BE:BE:BE:BE:00", "52:BE:BE:BE:BE:BE:BE:01" };
    String[] vnx1FE = { "60:FE:FE:FE:FE:FE:FE:00", "60:FE:FE:FE:FE:FE:FE:01" };
    String[] vnx1BE = { "60:BE:BE:BE:BE:BE:BE:00", "60:BE:BE:BE:BE:BE:BE:01" };
    String[] vnx2FE = { "61:FE:FE:FE:FE:FE:FE:00", "61:FE:FE:FE:FE:FE:FE:01" };
    String[] vnx2BE = { "61:BE:BE:BE:BE:BE:BE:00", "62:BE:BE:BE:BE:BE:BE:01" };
    String[] vnx3FE = { "62:FE:FE:FE:FE:FE:FE:00", "62:FE:FE:FE:FE:FE:FE:01" };
    String[] vnx3BE = { "62:BE:BE:BE:BE:BE:BE:00", "62:BE:BE:BE:BE:BE:BE:01" };
    String[] rp1FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    String[] rp2FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
    String[] rp3FE = { "55:FE:FE:FE:FE:FE:FE:00", "55:FE:FE:FE:FE:FE:FE:01" };
    // vplex1 cluster1
    String[] vplex11FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex11BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    // vplex1 cluster2
    String[] vplex12FE = { "FE:FE:FE:FE:FE:FE:FE:02", "FE:FE:FE:FE:FE:FE:FE:03" };
    String[] vplex12BE = { "BE:BE:BE:BE:BE:BE:BE:02", "BE:BE:BE:BE:BE:BE:BE:03" };
    // vplex2 cluster1
    String[] vplex21FE = { "FE:FE:FE:FE:FE:FE:FE:04", "FE:FE:FE:FE:FE:FE:FE:05" };
    String[] vplex21BE = { "BE:BE:BE:BE:BE:BE:BE:04", "BE:BE:BE:BE:BE:BE:BE:05" };
    // Create 3 Virtual Arrays
    VirtualArray srcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcVarray");
    VirtualArray haVarray = PlacementTestUtils.createVirtualArray(_dbClient, "haVarray");
    VirtualArray activeTgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "activeTgtVarray");
    VirtualArray standbyTgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "standbyTgtVarray");
    // Create Journal Varrays
    VirtualArray srcJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcJournalVarray");
    VirtualArray haJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "haJournalVarray");
    VirtualArray tgtJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtJournalVarray");
    // Create network for VPLEX source side
    StringSet sourceConnectedVa = new StringSet();
    sourceConnectedVa.add(srcVarray.getId().toString());
    sourceConnectedVa.add(activeTgtVarray.getId().toString());
    sourceConnectedVa.add(srcJournalVarray.getId().toString());
    // create network for VPLEX HA side
    StringSet haConnectedVa = new StringSet();
    haConnectedVa.add(haVarray.getId().toString());
    haConnectedVa.add(standbyTgtVarray.getId().toString());
    haConnectedVa.add(haJournalVarray.getId().toString());
    Network sourceNetwork = PlacementTestUtils.createNetwork(_dbClient, vplex11FE, "VSAN", "FC+BROCADE", sourceConnectedVa);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vplex11BE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, rp1FE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, rp3FE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax1FE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax1BE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax3FE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax3BE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx1FE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx1BE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx3FE);
    PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx3BE);
    Network haNetwork = PlacementTestUtils.createNetwork(_dbClient, vplex12FE, "VSAN", "FC+BROCADE", haConnectedVa);
    PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vplex12BE);
    PlacementTestUtils.addEndpoints(_dbClient, haNetwork, rp2FE);
    PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vmax2FE);
    PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vmax2BE);
    PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vnx2FE);
    PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vnx2BE);
    // Create 3 storage systems
    StorageSystem vmaxStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    StorageSystem vmaxStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
    StorageSystem vmaxStorageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
    StorageSystem vnxStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx1");
    StorageSystem vnxStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx2");
    StorageSystem vnxStorageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx3");
    // Create two front-end storage ports VMAX1
    List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem1, sourceNetwork, vmax1FE[i], srcVarray, StoragePort.PortType.frontend.name(), "portGroupvmax1" + i, "FE0+FC0" + i));
    }
    // Create two front-end storage ports VMAX1
    vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1BE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem1, sourceNetwork, vmax1BE[i], srcVarray, StoragePort.PortType.backend.name(), "portGroupvmax1" + i, "BE0+FC0" + i));
    }
    // Create two front-end storage ports VMAX2
    List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax2FE.length; i++) {
        vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem2, haNetwork, vmax2FE[i], haVarray, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
    }
    for (int i = 0; i < vmax2FE.length; i++) {
        vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem2, haNetwork, vmax2FE[i], standbyTgtVarray, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
    }
    // Create two front-end storage ports VMAX3
    List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax3FE.length; i++) {
        vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem3, sourceNetwork, vmax3FE[i], srcVarray, StoragePort.PortType.frontend.name(), "portGroupvmax3" + i, "E0+FC0" + i));
    }
    // Create two front-end storage ports VNX1
    List<StoragePort> vnx1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vnx1FE.length; i++) {
        vnx1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem1, sourceNetwork, vnx1FE[i], srcJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx1" + i, "C1+FC1" + i));
    }
    // Create two front-end storage ports VNX2
    List<StoragePort> vnx2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vnx2FE.length; i++) {
        vnx2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem2, sourceNetwork, vnx2FE[i], haJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx2" + i, "D1+FC1" + i));
    }
    // Create two front-end storage ports VNX3
    List<StoragePort> vnx3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vnx1FE.length; i++) {
        vnx3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem3, sourceNetwork, vnx3FE[i], tgtJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx3" + i, "E1+FC1" + i));
    }
    // Create 2 VPLEX storage systems
    StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
    StorageSystem vplexStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex2");
    // Create two back-end storage ports VPLEX1cluster1
    List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex11FE.length; i++) {
        fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, sourceNetwork, vplex11FE[i], srcVarray, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX1cluster1
    List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex11BE.length; i++) {
        bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, sourceNetwork, vplex11BE[i], srcVarray, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
    }
    // Create two front-end storage ports VPLEX1cluster2
    List<StoragePort> fePorts2 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex12FE.length; i++) {
        fePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, haNetwork, vplex12FE[i], haVarray, StoragePort.PortType.frontend.name(), "portGroupFE2-" + (i + 1), "F0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX1cluster2
    List<StoragePort> bePorts2 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex12BE.length; i++) {
        bePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, haNetwork, vplex12BE[i], haVarray, StoragePort.PortType.backend.name(), "portGroupBE2-" + (i + 1), "G0+FC0" + i));
    }
    // List<StoragePort> fePorts3 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex21FE.length; i++) {
        fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, sourceNetwork, vplex21FE[i], activeTgtVarray, StoragePort.PortType.frontend.name(), "portGroupFE3-" + (i + 1), "H0+FC0" + i));
    }
    // List<StoragePort> bePorts3 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex21BE.length; i++) {
        bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, sourceNetwork, vplex21BE[i], activeTgtVarray, StoragePort.PortType.backend.name(), "portGroupBE3-" + (i + 1), "I0+FC0" + i));
    }
    // Create RP system
    AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
    for (int i = 0; i < rp1FE.length; i++) {
        wwnSite1.add(rp1FE[i]);
    }
    StringSetMap initiatorsSiteMap = new StringSetMap();
    initiatorsSiteMap.put("site1", wwnSite1);
    AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
    for (int i = 0; i < rp2FE.length; i++) {
        wwnSite2.add(rp2FE[i]);
    }
    initiatorsSiteMap.put("site2", wwnSite2);
    AbstractChangeTrackingSet<String> wwnSite3 = new StringSet();
    for (int i = 0; i < rp3FE.length; i++) {
        wwnSite3.add(rp3FE[i]);
    }
    initiatorsSiteMap.put("site3", wwnSite3);
    StringSet storageSystems = new StringSet();
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster1"));
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vnxStorageSystem1.getSerialNumber()));
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vmaxStorageSystem1.getSerialNumber()));
    // ////////////////////////////////////////////////////////////////
    // NEGATIVE-TEST Step 1/2:
    // Change vmaxStorageSystem3 and vnxStorageSystem3 to site3 visibility below.
    // What this will do is allow site1 to place to site3 as a REMOTE copy but will be invalid for a
    // MP CDP setup as there is no LOCAL copy on the Active Source side.
    // 
    // Need to ensure that the VPLEX is not fronting the Storage Systems, see Step 2/2.
    // 
    // Result: Placement should exhaust it's options and fail.
    // ////////////////////////////////////////////////////////////////
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vnxStorageSystem3.getSerialNumber()));
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vmaxStorageSystem3.getSerialNumber()));
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex1cluster2"));
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", vnxStorageSystem2.getSerialNumber()));
    storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", vmaxStorageSystem2.getSerialNumber()));
    StringSetMap rpVisibleSystems = new StringSetMap();
    StringSet storageIds = new StringSet();
    storageIds.add(vplexStorageSystem1.getId().toString());
    storageIds.add(vmaxStorageSystem1.getId().toString());
    storageIds.add(vnxStorageSystem1.getId().toString());
    storageIds.add(vmaxStorageSystem3.getId().toString());
    storageIds.add(vnxStorageSystem3.getId().toString());
    rpVisibleSystems.put("site1", storageIds);
    StringSet storageIds2 = new StringSet();
    storageIds2.add(vplexStorageSystem1.getId().toString());
    storageIds2.add(vmaxStorageSystem2.getId().toString());
    storageIds2.add(vnxStorageSystem2.getId().toString());
    rpVisibleSystems.put("site2", storageIds2);
    StringMap siteVolCap = new StringMap();
    siteVolCap.put("site1", "3221225472");
    siteVolCap.put("site2", "3221225472");
    StringMap siteVolCnt = new StringMap();
    siteVolCnt.put("site1", "10");
    siteVolCnt.put("site2", "10");
    ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", "site3", "IP", initiatorsSiteMap, storageSystems, rpVisibleSystems, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
    // RP Site Array objects
    RPSiteArray rpSiteArray1 = new RPSiteArray();
    rpSiteArray1.setId(URI.create("rsa1"));
    rpSiteArray1.setStorageSystem(URI.create("vplex1"));
    rpSiteArray1.setRpInternalSiteName("site1");
    rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray1);
    RPSiteArray rpSiteArray2 = new RPSiteArray();
    rpSiteArray2.setId(URI.create("rsa2"));
    rpSiteArray2.setStorageSystem(URI.create("vplex1"));
    rpSiteArray2.setRpInternalSiteName("site2");
    rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray2);
    RPSiteArray rpSiteArray3 = new RPSiteArray();
    rpSiteArray3.setId(URI.create("rsa3"));
    rpSiteArray3.setStorageSystem(URI.create("vplex2"));
    rpSiteArray3.setRpInternalSiteName("site3");
    rpSiteArray3.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray3);
    // Create a storage pool for vmax1
    StoragePool srcPool1 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool1", "SrcPool1", Long.valueOf(SIZE_GB * 75), Long.valueOf(SIZE_GB * 150), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool srcPool2 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool2", "SrcPool2", Long.valueOf(SIZE_GB * 75), Long.valueOf(SIZE_GB * 150), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool srcPool3 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool3", "SrcPool3", Long.valueOf(SIZE_GB * 200), Long.valueOf(SIZE_GB * 200), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool haPool4 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "HaPool4", "HaPool4", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool haPool5 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "HaPool5", "HaPool5", Long.valueOf(SIZE_GB * 300), Long.valueOf(SIZE_GB * 300), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    // StoragePool haPool6 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "Hapool6", "HaPool6",
    // Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100,
    // StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    StoragePool haPool6 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem3, "Hapool6", "HaPool6", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 300), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool tgtPool7 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem3, "TgtPool7", "TgtPool7", Long.valueOf(SIZE_GB * 300), Long.valueOf(SIZE_GB * 300), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool tgtPool8 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem3, "Tgtpool8", "TgtPool8", Long.valueOf(SIZE_GB * 300), Long.valueOf(SIZE_GB * 300), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vnx1
    StoragePool sjPool9 = PlacementTestUtils.createStoragePool(_dbClient, srcJournalVarray, vnxStorageSystem1, "Sjpool9", "SjPool9", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vnx1
    StoragePool hajPool10 = PlacementTestUtils.createStoragePool(_dbClient, haJournalVarray, vnxStorageSystem2, "HaJpool10", "HaJPool10", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vnx1
    StoragePool tjPool11 = PlacementTestUtils.createStoragePool(_dbClient, tgtJournalVarray, vnxStorageSystem3, "Tjpool11", "TjPool11", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create HA vpool
    // haPool6 should never be selected by placement
    VirtualPool haVpool = new VirtualPool();
    haVpool.setId(URI.create("urn:storageos:VirtualPool:11111111-2222-3333-4444-555555555555:vdc1"));
    haVpool.setLabel("haVpool");
    haVpool.setType("block");
    haVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    haVpool.setDriveType(SupportedDriveTypes.FC.name());
    haVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(haPool4.getId().toString());
    matchedPools.add(haPool5.getId().toString());
    haVpool.setMatchedStoragePools(matchedPools);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(haVarray.getId().toString());
    haVpool.setVirtualArrays(virtualArrays1);
    haVpool.setUseMatchedPools(true);
    _dbClient.createObject(haVpool);
    // Create HA Journal Vpool
    VirtualPool haJournalVpool = new VirtualPool();
    haJournalVpool.setId(URI.create("haJournalVpool"));
    haJournalVpool.setLabel("haJournalVpool");
    haJournalVpool.setType("block");
    haJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    // haJournalVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name()); //Uncomment this line to fail placement.
    // haJournalVpool doesnt have a storagesystem that VPLEX can see
    haJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
    matchedPools = new StringSet();
    matchedPools.add(hajPool10.getId().toString());
    haJournalVpool.setMatchedStoragePools(matchedPools);
    StringSet haJournalVarrays = new StringSet();
    haJournalVarrays.add(haJournalVarray.getId().toString());
    haJournalVpool.setVirtualArrays(haJournalVarrays);
    haJournalVpool.setUseMatchedPools(true);
    _dbClient.createObject(haJournalVpool);
    // Create tgt journal vpool
    VirtualPool tgtJournalVpool = new VirtualPool();
    tgtJournalVpool.setId(URI.create("tgtJournalVpool"));
    tgtJournalVpool.setLabel("tgtJournalVpool");
    tgtJournalVpool.setType("block");
    tgtJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    tgtJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
    matchedPools = new StringSet();
    matchedPools.add(tjPool11.getId().toString());
    tgtJournalVpool.setMatchedStoragePools(matchedPools);
    StringSet tgtJournalVarrays = new StringSet();
    tgtJournalVarrays.add(tgtJournalVarray.getId().toString());
    tgtJournalVpool.setVirtualArrays(tgtJournalVarrays);
    tgtJournalVpool.setUseMatchedPools(true);
    _dbClient.createObject(tgtJournalVpool);
    // Create src journal vpool
    VirtualPool srcJournalVpool = new VirtualPool();
    srcJournalVpool.setId(URI.create("srcJournalVpool"));
    srcJournalVpool.setLabel("srcJournalVpool");
    srcJournalVpool.setType("block");
    srcJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    srcJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
    matchedPools = new StringSet();
    matchedPools.add(sjPool9.getId().toString());
    srcJournalVpool.setMatchedStoragePools(matchedPools);
    StringSet srcJournalVarrays = new StringSet();
    srcJournalVarrays.add(srcJournalVarray.getId().toString());
    srcJournalVpool.setVirtualArrays(srcJournalVarrays);
    srcJournalVpool.setUseMatchedPools(true);
    _dbClient.createObject(srcJournalVpool);
    // Create RP MetroPoint active target vpool
    VirtualPool mpActiveTgtVpool = new VirtualPool();
    mpActiveTgtVpool.setId(URI.create("mpTargetVpool"));
    mpActiveTgtVpool.setLabel("mpTargetVpool");
    mpActiveTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    mpActiveTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    // ////////////////////////////////////////////////////////////////
    // NEGATIVE-TEST Step 2/2:
    // Comment out the below setHighAvailability() line so that this vpool is not
    // fronted by the VPLEX and will need to rely on the Storage System connectivity.
    // 
    // Result: Placement should exhaust it's options and fail.
    // ////////////////////////////////////////////////////////////////
    mpActiveTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    matchedPools = new StringSet();
    matchedPools.add(tgtPool7.getId().toString());
    matchedPools.add(tgtPool8.getId().toString());
    mpActiveTgtVpool.setMatchedStoragePools(matchedPools);
    mpActiveTgtVpool.setUseMatchedPools(true);
    StringSet activeTgtVarrays = new StringSet();
    activeTgtVarrays.add(srcVarray.getId().toString());
    mpActiveTgtVpool.setVirtualArrays(activeTgtVarrays);
    _dbClient.createObject(mpActiveTgtVpool);
    // Create RP MetroPoint standby target vpool
    VirtualPool mpStandbyTgtVpool = new VirtualPool();
    mpStandbyTgtVpool.setId(URI.create("mpStandbyTargetVpool"));
    mpStandbyTgtVpool.setLabel("mpStandbyTargetVpool");
    mpStandbyTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    mpStandbyTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    // mpTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    matchedPools = new StringSet();
    // matchedPools.add(tgtPool7.getId().toString());
    matchedPools.add(haPool4.getId().toString());
    mpStandbyTgtVpool.setMatchedStoragePools(matchedPools);
    mpStandbyTgtVpool.setUseMatchedPools(true);
    StringSet standbyTgtVarrays = new StringSet();
    standbyTgtVarrays.add(haVarray.getId().toString());
    mpStandbyTgtVpool.setVirtualArrays(standbyTgtVarrays);
    _dbClient.createObject(mpStandbyTgtVpool);
    // Create a RP VPLEX virtual pool
    // srcPool3 should never be chosen during placement
    VirtualPool mpSrcVpool = new VirtualPool();
    mpSrcVpool.setId(URI.create("mpSrcVpool"));
    mpSrcVpool.setLabel("mpSrcVpool");
    mpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    mpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
    mpSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
    matchedPools = new StringSet();
    matchedPools.add(srcPool1.getId().toString());
    matchedPools.add(srcPool2.getId().toString());
    mpSrcVpool.setMatchedStoragePools(matchedPools);
    mpSrcVpool.setUseMatchedPools(true);
    mpSrcVpool.setJournalVarray(srcJournalVarray.getId().toString());
    mpSrcVpool.setJournalVpool(srcJournalVpool.getId().toString());
    mpSrcVpool.setStandbyJournalVarray(haJournalVarray.getId().toString());
    mpSrcVpool.setStandbyJournalVpool(haJournalVpool.getId().toString());
    mpSrcVpool.setJournalSize("2X");
    StringMap vavpMap = new StringMap();
    vavpMap.put(haVarray.getId().toString(), haVpool.getId().toString());
    mpSrcVpool.setHaVarrayVpoolMap(vavpMap);
    mpSrcVpool.setMetroPoint(true);
    // Active Source Local Target
    VpoolProtectionVarraySettings activeProtectionSettings = new VpoolProtectionVarraySettings();
    activeProtectionSettings.setVirtualPool(mpActiveTgtVpool.getId());
    activeProtectionSettings.setJournalVpool(mpActiveTgtVpool.getId());
    activeProtectionSettings.setId(URI.create("activeProtectionSettings"));
    _dbClient.createObject(activeProtectionSettings);
    // Standby Source Local Target
    VpoolProtectionVarraySettings standbyProtectionSettings = new VpoolProtectionVarraySettings();
    standbyProtectionSettings.setVirtualPool(mpStandbyTgtVpool.getId());
    standbyProtectionSettings.setJournalVpool(mpStandbyTgtVpool.getId());
    standbyProtectionSettings.setId(URI.create("standbyProtectionSettings"));
    _dbClient.createObject(standbyProtectionSettings);
    // Define the targets
    StringMap protectionVarray = new StringMap();
    protectionVarray.put(srcVarray.getId().toString(), activeProtectionSettings.getId().toString());
    protectionVarray.put(haVarray.getId().toString(), standbyProtectionSettings.getId().toString());
    mpSrcVpool.setProtectionVarraySettings(protectionVarray);
    mpSrcVpool.setRpCopyMode("SYNCHRONOUS");
    mpSrcVpool.setRpRpoType("MINUTES");
    mpSrcVpool.setRpRpoValue(Long.valueOf("5"));
    StringSet srcVarrays = new StringSet();
    srcVarrays.add(srcVarray.getId().toString());
    mpSrcVpool.setVirtualArrays(srcVarrays);
    _dbClient.createObject(mpSrcVpool);
    // Create Tenant
    TenantOrg tenant = new TenantOrg();
    tenant.setId(URI.create("tenant"));
    _dbClient.createObject(tenant);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create block consistency group
    BlockConsistencyGroup cg = new BlockConsistencyGroup();
    cg.setProject(new NamedURI(project.getId(), project.getLabel()));
    cg.setId(URI.create("blockCG"));
    _dbClient.createObject(cg);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("10GB", 13, cg);
    // Run single volume placement: Run 10 times to make sure pool6 never comes up for source and pool9 for target.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, srcVarray, project, mpSrcVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
        for (RPRecommendation rpRec : rec.getSourceRecommendations()) {
            assertNotNull(rpRec.getVirtualArray());
            assertNotNull(rpRec.getVirtualPool());
            assertNotNull(rpRec.getInternalSiteName());
            assertNotNull(rpRec.getSourceStorageSystem());
            assertNotNull(rpRec.getSourceStoragePool());
            assertTrue("site1".equals(rpRec.getInternalSiteName()));
            assertTrue(vmaxStorageSystem1.getId().toString().equals(rpRec.getSourceStorageSystem().toString()));
            assertTrue((srcPool1.getId().toString().equals(rpRec.getSourceStoragePool().toString())) || (srcPool2.getId().toString().equals(rpRec.getSourceStoragePool().toString())) || (srcPool3.getId().toString().equals(rpRec.getSourceStoragePool().toString())));
            assertNotNull(rpRec.getVirtualVolumeRecommendation());
            assertNotNull(rpRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
            assertTrue("vplex1".equals(rpRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
            assertNotNull(rpRec.getHaRecommendation());
            assertNotNull(rpRec.getHaRecommendation().getInternalSiteName());
            assertTrue("vplex1".equals(rpRec.getHaRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
            assertTrue("site2".equals(rpRec.getHaRecommendation().getInternalSiteName()));
            assertTrue(haVarray.getId().toString().equals(rpRec.getHaRecommendation().getVirtualArray().toString()));
            assertTrue("urn:storageos:VirtualPool:11111111-2222-3333-4444-555555555555:vdc1".equals(rpRec.getHaRecommendation().getVirtualPool().getId().toString()));
            assertTrue(vmaxStorageSystem2.getId().toString().equals(rpRec.getHaRecommendation().getSourceStorageSystem().toString()));
            assertTrue((haPool4.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())) || (haPool5.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())) || (haPool6.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())));
            assertNotNull(rpRec.getTargetRecommendations());
            assertTrue(!rpRec.getTargetRecommendations().isEmpty());
            for (RPRecommendation targetRec : rpRec.getTargetRecommendations()) {
                assertNotNull(targetRec.getInternalSiteName());
                assertNotNull(targetRec.getVirtualArray());
                assertNotNull(targetRec.getVirtualPool());
                assertNotNull(targetRec.getSourceStorageSystem());
                assertNotNull(targetRec.getSourceStoragePool());
                if (VirtualPool.vPoolSpecifiesHighAvailability(mpActiveTgtVpool)) {
                    assertNotNull(targetRec.getVirtualVolumeRecommendation());
                    assertNotNull(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
                    assertTrue(vplexStorageSystem1.getId().toString().equals(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
                    assertTrue(vmaxStorageSystem3.getId().toString().equals(targetRec.getSourceStorageSystem().toString()));
                    assertTrue(srcVarray.getId().toString().equals(targetRec.getVirtualArray().toString()));
                    assertTrue("site1".equals(targetRec.getInternalSiteName()));
                    assertTrue(mpActiveTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
                    assertTrue((tgtPool7.getId().toString().equals(targetRec.getSourceStoragePool().toString())) || (tgtPool8.getId().toString().equals(targetRec.getSourceStoragePool().toString())));
                }
                if (VirtualPool.vPoolSpecifiesHighAvailability(mpStandbyTgtVpool)) {
                    assertNotNull(targetRec.getVirtualVolumeRecommendation());
                    assertNotNull(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
                    assertTrue(vplexStorageSystem2.getId().toString().equals(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
                    assertTrue(vmaxStorageSystem3.getId().toString().equals(targetRec.getSourceStorageSystem().toString()));
                    assertTrue(standbyTgtVarray.getId().toString().equals(targetRec.getVirtualArray().toString()));
                    assertTrue("site2".equals(targetRec.getInternalSiteName()));
                    assertTrue(mpActiveTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
                    assertTrue((tgtPool7.getId().toString().equals(targetRec.getSourceStoragePool().toString())) || (tgtPool8.getId().toString().equals(targetRec.getSourceStoragePool().toString())));
                }
            }
        }
        // Source journal
        assertNotNull(rec.getSourceJournalRecommendation());
        assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
        assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
        assertNotNull(rec.getSourceJournalRecommendation().getSourceStorageSystem());
        assertNotNull(rec.getSourceJournalRecommendation().getVirtualArray());
        assertNotNull(rec.getSourceJournalRecommendation().getVirtualPool());
        assertTrue("site1".equals(rec.getSourceJournalRecommendation().getInternalSiteName()));
        assertTrue(vnxStorageSystem1.getId().toString().equals(rec.getSourceJournalRecommendation().getSourceStorageSystem().toString()));
        assertTrue((sjPool9.getId().toString().equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
        if (VirtualPool.vPoolSpecifiesHighAvailability(srcJournalVpool)) {
            assertNotNull(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation());
            assertNotNull(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem());
            assertTrue(vplexStorageSystem1.getId().toString().equals(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem()));
        }
        // Source HA journal
        assertNotNull(rec.getStandbyJournalRecommendation());
        assertNotNull(rec.getStandbyJournalRecommendation().getInternalSiteName());
        assertNotNull(rec.getStandbyJournalRecommendation().getSourceStoragePool());
        assertNotNull(rec.getStandbyJournalRecommendation().getSourceStorageSystem());
        assertNotNull(rec.getStandbyJournalRecommendation().getVirtualArray());
        assertNotNull(rec.getStandbyJournalRecommendation().getVirtualPool());
        assertTrue("site2".equals(rec.getStandbyJournalRecommendation().getInternalSiteName()));
        assertTrue(vnxStorageSystem2.getId().toString().equals(rec.getStandbyJournalRecommendation().getSourceStorageSystem().toString()));
        assertTrue((hajPool10.getId().toString().equals(rec.getStandbyJournalRecommendation().getSourceStoragePool().toString())));
        if (VirtualPool.vPoolSpecifiesHighAvailability(haJournalVpool)) {
            assertNotNull(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation());
            assertNotNull(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem());
            assertTrue(vplexStorageSystem1.getId().toString().equals(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem()));
        }
        // TargetJournal
        assertNotNull(rec.getTargetJournalRecommendations());
        assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
        for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
            assertNotNull(targetJournalRec);
            assertNotNull(targetJournalRec.getInternalSiteName());
            assertNotNull(targetJournalRec.getSourceStoragePool());
            assertNotNull(targetJournalRec.getSourceStorageSystem());
            assertNotNull(targetJournalRec.getVirtualArray());
            assertNotNull(targetJournalRec.getVirtualPool());
            if (targetJournalRec.getVirtualArray().toString().equals(srcVarray.getId().toString())) {
                assertTrue("site1".equals(targetJournalRec.getInternalSiteName()));
                assertTrue(mpActiveTgtVpool.getId().toString().equals(targetJournalRec.getVirtualPool().getId().toString()));
                assertTrue((tgtPool7.getId().toString().equals(targetJournalRec.getSourceStoragePool().toString())) || haPool4.getId().toString().equals(targetJournalRec.getSourceStoragePool().toString()));
                assertTrue(vmaxStorageSystem3.getId().toString().equals(targetJournalRec.getSourceStorageSystem().toString()));
                if (VirtualPool.vPoolSpecifiesHighAvailability(mpActiveTgtVpool)) {
                    assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
                    assertNotNull(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
                    assertTrue(vplexStorageSystem1.getId().toString().equals(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
                }
            }
            if (targetJournalRec.getVirtualArray().toString().equals(haVarray.getId().toString())) {
                assertTrue("site2".equals(targetJournalRec.getInternalSiteName()));
                assertTrue(mpStandbyTgtVpool.getId().toString().equals(targetJournalRec.getVirtualPool().getId().toString()));
                assertTrue((haPool4.getId().toString().equals(targetJournalRec.getSourceStoragePool().toString())));
                assertTrue(vmaxStorageSystem2.getId().toString().equals(targetJournalRec.getSourceStorageSystem().toString()));
                if (VirtualPool.vPoolSpecifiesHighAvailability(mpStandbyTgtVpool)) {
                    assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
                    assertNotNull(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
                    assertTrue(vplexStorageSystem2.getId().toString().equals(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
                }
            }
        }
        _log.info(String.format("Placement results (#%s) : \n %s", i, rec.toString(_dbClient)));
    }
    _log.info("### PASS ###");
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) NamedURI(com.emc.storageos.db.client.model.NamedURI) ArrayList(java.util.ArrayList) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Aggregations

StoragePort (com.emc.storageos.db.client.model.StoragePort)477 URI (java.net.URI)285 ArrayList (java.util.ArrayList)261 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)143 HashMap (java.util.HashMap)134 List (java.util.List)130 NetworkLite (com.emc.storageos.util.NetworkLite)110 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)107 StringSet (com.emc.storageos.db.client.model.StringSet)92 PortAllocationContext (com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)84 HashSet (java.util.HashSet)81 Initiator (com.emc.storageos.db.client.model.Initiator)78 Map (java.util.Map)64 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)62 StoragePool (com.emc.storageos.db.client.model.StoragePool)51 IOException (java.io.IOException)48 StringMap (com.emc.storageos.db.client.model.StringMap)45 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)43 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)42 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)34