Search in sources :

Example 76 with VirtualArray

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

the class DbClientTest method testCfWithMutipleRelationIndex.

@Test
public void testCfWithMutipleRelationIndex() {
    _logger.info("Starting testCompareIndexes");
    DbClient dbClient = _dbClient;
    URI varrayId1 = URIUtil.createId(VirtualArray.class);
    VirtualArray varray1 = new VirtualArray();
    varray1.setId(varrayId1);
    varray1.setLabel("varray1");
    dbClient.createObject(varray1);
    Network nw1 = new Network();
    nw1.setId(URIUtil.createId(Network.class));
    nw1.setLabel("networkObj");
    StringSet varrayStrSet1 = new StringSet();
    varrayStrSet1.add(varrayId1.toString());
    nw1.setAssignedVirtualArrays(varrayStrSet1);
    dbClient.createObject(nw1);
    List<Network> assignedNetworks = CustomQueryUtility.queryActiveResourcesByRelation(dbClient, varrayId1, Network.class, "assignedVirtualArrays");
    Assert.assertTrue(assignedNetworks.iterator().hasNext());
    Assert.assertEquals(assignedNetworks.size(), 1);
    List<Network> connectedNetworks = CustomQueryUtility.queryActiveResourcesByRelation(dbClient, varrayId1, Network.class, "connectedVirtualArrays");
    Assert.assertFalse(connectedNetworks.iterator().hasNext());
    URI varrayId2 = URIUtil.createId(VirtualArray.class);
    VirtualArray varray2 = new VirtualArray();
    varray2.setId(varrayId2);
    varray2.setLabel("varray2");
    dbClient.createObject(varray2);
    StringSet varrayStrSet2 = new StringSet();
    varrayStrSet2.add(varrayId1.toString());
    varrayStrSet2.add(varrayId2.toString());
    nw1.setConnectedVirtualArrays(varrayStrSet2);
    dbClient.persistObject(nw1);
    assignedNetworks.clear();
    assignedNetworks = CustomQueryUtility.queryActiveResourcesByRelation(dbClient, varrayId1, Network.class, "assignedVirtualArrays");
    Assert.assertTrue(assignedNetworks.iterator().hasNext());
    Assert.assertEquals(assignedNetworks.size(), 1);
    connectedNetworks.clear();
    connectedNetworks = CustomQueryUtility.queryActiveResourcesByRelation(dbClient, varrayId2, Network.class, "connectedVirtualArrays");
    Assert.assertTrue(connectedNetworks.iterator().hasNext());
    Assert.assertEquals(connectedNetworks.size(), 1);
    connectedNetworks.clear();
    connectedNetworks = CustomQueryUtility.queryActiveResourcesByRelation(dbClient, varrayId1, Network.class, "connectedVirtualArrays");
    Assert.assertTrue(connectedNetworks.iterator().hasNext());
    Assert.assertEquals(connectedNetworks.size(), 1);
    assignedNetworks.clear();
    assignedNetworks = CustomQueryUtility.queryActiveResourcesByRelation(dbClient, varrayId2, Network.class, "assignedVirtualArrays");
    Assert.assertFalse(assignedNetworks.iterator().hasNext());
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) DbClient(com.emc.storageos.db.client.DbClient) InternalDbClient(com.emc.storageos.db.client.upgrade.InternalDbClient) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) Test(org.junit.Test)

Example 77 with VirtualArray

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

the class NetworkAssignedVirtualArraysMigrationTest method prepareData.

@SuppressWarnings("deprecation")
@Override
protected void prepareData() throws Exception {
    // Create a virtual array.
    VirtualArray varray = new VirtualArray();
    varrayURI = URIUtil.createId(VirtualArray.class);
    varray.setId(varrayURI);
    _dbClient.createObject(varray);
    // Create a network and set the virtual array.
    Network network = new Network();
    network.setId(URIUtil.createId(Network.class));
    network.setLabel("NetworkWithVarray");
    network.setVirtualArray(varrayURI);
    _dbClient.createObject(network);
    // Create another network without a virtual array.
    network = new Network();
    network.setId(URIUtil.createId(Network.class));
    network.setLabel("NetworkWithoutVArray");
    _dbClient.createObject(network);
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) Network(com.emc.storageos.db.client.model.Network)

Example 78 with VirtualArray

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

the class RecoverPointBlockSnapshotMigrationTest method prepareSnapData.

/**
 * Prepares the data for RP BlockSnapshot migration tests.
 *
 * @throws Exception When an error occurs preparing the BlockSnapshot migration data.
 */
private void prepareSnapData() throws Exception {
    log.info("Preparing BlockSnapshots for RecoverPointBlockSnapshotMigration");
    ProtectionSystem ps = new ProtectionSystem();
    URI protectionSystemUri = URIUtil.createId(ProtectionSystem.class);
    ps.setId(protectionSystemUri);
    _dbClient.createObject(ps);
    VirtualArray targetVarray = new VirtualArray();
    URI targetVarrayUri = URIUtil.createId(VirtualArray.class);
    targetVarray.setId(targetVarrayUri);
    _dbClient.createObject(targetVarray);
    Volume targetVolume = new Volume();
    URI targetVolumeUri = URIUtil.createId(Volume.class);
    targetVolume.setId(targetVolumeUri);
    targetVolume.setLabel("targetVolume");
    targetVolume.setDeviceLabel(DEVICE_LABEL);
    targetVolume.setVirtualArray(targetVarrayUri);
    _dbClient.createObject(targetVolume);
    Volume parentVolume = new Volume();
    URI volumeUri = URIUtil.createId(Volume.class);
    parentVolume.setId(volumeUri);
    parentVolume.setLabel("parentVolume");
    StringSet rpTargets = new StringSet();
    rpTargets.add(targetVolume.getId().toString());
    parentVolume.setRpTargets(rpTargets);
    _dbClient.createObject(parentVolume);
    BlockSnapshot snapshot = new BlockSnapshot();
    snapURI = URIUtil.createId(BlockSnapshot.class);
    snapshot.setId(snapURI);
    snapshot.setProtectionController(protectionSystemUri);
    NamedURI parentVolNamedUri = new NamedURI(parentVolume.getId(), parentVolume.getLabel());
    snapshot.setParent(parentVolNamedUri);
    snapshot.setVirtualArray(targetVarrayUri);
    _dbClient.createObject(snapshot);
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) Volume(com.emc.storageos.db.client.model.Volume) NamedURI(com.emc.storageos.db.client.model.NamedURI) StringSet(com.emc.storageos.db.client.model.StringSet) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI)

Example 79 with VirtualArray

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

the class StoragePortConnectedVirtualArraysMigrationTest method prepareData.

@SuppressWarnings("deprecation")
@Override
protected void prepareData() throws Exception {
    // Create a virtual array.
    VirtualArray varray = new VirtualArray();
    varrayURI = URIUtil.createId(VirtualArray.class);
    varray.setId(varrayURI);
    _dbClient.createObject(varray);
    // Create a network and set the virtual array.
    Network networkWithVArray = new Network();
    URI networkWithVArrayURI = URIUtil.createId(Network.class);
    networkWithVArray.setId(networkWithVArrayURI);
    networkWithVArray.setLabel("NetworkWithVarray");
    networkWithVArray.setVirtualArray(varrayURI);
    _dbClient.createObject(networkWithVArray);
    // Create another network without a virtual array.
    Network networkWithoutVArray = new Network();
    URI networkWithoutVArrayURI = URIUtil.createId(Network.class);
    networkWithoutVArray.setId(networkWithoutVArrayURI);
    networkWithoutVArray.setLabel("NetworkWithoutVArray");
    _dbClient.createObject(networkWithoutVArray);
    // Create a storage port and set the network for
    // storage port to the network assigned to the
    // virtual array.
    StoragePort storagePortWithConnectedVArray = new StoragePort();
    storagePortWithConnectedVArray.setId(URIUtil.createId(Network.class));
    storagePortWithConnectedVArray.setLabel("StoragePortWithConnectedVArray");
    storagePortWithConnectedVArray.setNetwork(networkWithVArrayURI);
    _dbClient.createObject(storagePortWithConnectedVArray);
    // Create a storage port and set the network for
    // storage port to the network that is not assigned
    // to the virtual array.
    StoragePort storagePortWithoutConnectedVArray = new StoragePort();
    storagePortWithoutConnectedVArray.setId(URIUtil.createId(Network.class));
    storagePortWithoutConnectedVArray.setLabel("StoragePortWithoutConnectedVArray");
    storagePortWithoutConnectedVArray.setNetwork(networkWithoutVArrayURI);
    _dbClient.createObject(storagePortWithoutConnectedVArray);
    // Create s storage port without and assigned network.
    StoragePort storagePortWithoutNetwork = new StoragePort();
    storagePortWithoutNetwork.setId(URIUtil.createId(Network.class));
    storagePortWithoutNetwork.setLabel("StoragePortWithoutNetwork");
    _dbClient.createObject(storagePortWithoutNetwork);
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) Network(com.emc.storageos.db.client.model.Network) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI)

Example 80 with VirtualArray

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

the class VirtualPoolMultiVolumeConsistencyMigrationTest method prepareVirtualPoolData.

/**
 * Prepares the data for RP volume tests.
 *
 * @throws Exception When an error occurs preparing the RP volume data.
 */
private void prepareVirtualPoolData() throws Exception {
    log.info("Preparing VirtualPool Data for VirtualPoolMultiVolumeConsistencyMigration.");
    VirtualArray virtualArray = new VirtualArray();
    URI virtualArrayURI = URIUtil.createId(VirtualArray.class);
    virtualArray.setId(virtualArrayURI);
    virtualArray.setLabel("virtualArray1");
    _dbClient.createObject(virtualArray);
    for (int i = 1; i <= 3; i++) {
        VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
        URI protectionSettingsURI = URIUtil.createId(VpoolProtectionVarraySettings.class);
        protectionSettings.setId(protectionSettingsURI);
        protectionSettings.setJournalSize("min");
        _dbClient.createObject(protectionSettings);
        VirtualPool virtualPool = new VirtualPool();
        URI virtualPoolURI = URIUtil.createId(VirtualPool.class);
        rpTestVirtualPoolURIs.add(virtualPoolURI);
        virtualPool.setId(virtualPoolURI);
        virtualPool.setLabel("rpVirtualPool" + i);
        StringMap protectionVarraySettings = new StringMap();
        protectionVarraySettings.put(virtualArrayURI.toString(), protectionSettingsURI.toString());
        virtualPool.setProtectionVarraySettings(protectionVarraySettings);
        _dbClient.createObject(virtualPool);
    }
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StringMap(com.emc.storageos.db.client.model.StringMap) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI)

Aggregations

VirtualArray (com.emc.storageos.db.client.model.VirtualArray)183 URI (java.net.URI)91 ArrayList (java.util.ArrayList)91 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)84 Project (com.emc.storageos.db.client.model.Project)53 NamedURI (com.emc.storageos.db.client.model.NamedURI)52 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)52 StringSet (com.emc.storageos.db.client.model.StringSet)50 Volume (com.emc.storageos.db.client.model.Volume)46 VirtualPoolCapabilityValuesWrapper (com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper)44 List (java.util.List)44 StoragePool (com.emc.storageos.db.client.model.StoragePool)43 HashMap (java.util.HashMap)38 StringMap (com.emc.storageos.db.client.model.StringMap)37 Recommendation (com.emc.storageos.volumecontroller.Recommendation)37 RPRecommendation (com.emc.storageos.volumecontroller.RPRecommendation)31 RPProtectionRecommendation (com.emc.storageos.volumecontroller.RPProtectionRecommendation)30 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)29 Network (com.emc.storageos.db.client.model.Network)27 VPlexRecommendation (com.emc.storageos.volumecontroller.VPlexRecommendation)27