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());
}
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);
}
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);
}
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);
}
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);
}
}
Aggregations