use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class PlacementTestUtils method createSRDFStorageSystems.
/**
* Create SRDF paired vmax arrays.
* @param dbClient
* @param label1
* @param network1
* @param portWWNs1
* @param varray1
* @param label2
* @param network2
* @param portWWNs2
* @param varray2
* @return StorageSystem[1] and StorageSystem[2]; StorageSystem[0] not used.
*/
public static StorageSystem[] createSRDFStorageSystems(DbClient dbClient, String label1, Network network1, String[] portWWNs1, VirtualArray varray1, String label2, Network network2, String[] portWWNs2, VirtualArray varray2) {
StorageSystem[] storageSystems = new StorageSystem[3];
// Create 2 storage systems
StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(dbClient, "vmax", label1);
storageSystems[1] = storageSystem1;
StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(dbClient, "vmax", label2);
storageSystems[2] = storageSystem2;
// Mark them SRDF capable
StringSet supportedAsynchronousActions = new StringSet();
supportedAsynchronousActions.add(StorageSystem.AsyncActions.CreateElementReplica.name());
supportedAsynchronousActions.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
storageSystem1.setSupportedAsynchronousActions(supportedAsynchronousActions);
storageSystem2.setSupportedAsynchronousActions(supportedAsynchronousActions);
StringSet supportedReplicationTypes = new StringSet();
supportedReplicationTypes.add(StorageSystem.SupportedReplicationTypes.SRDF.name());
storageSystem1.setSupportedReplicationTypes(supportedReplicationTypes);
storageSystem2.setSupportedReplicationTypes(supportedReplicationTypes);
// Set connected to.
StringSet connectedTo = new StringSet();
connectedTo.add(storageSystem2.getId().toString());
storageSystem1.setRemotelyConnectedTo(connectedTo);
connectedTo = new StringSet();
connectedTo.add(storageSystem1.getId().toString());
storageSystem2.setRemotelyConnectedTo(connectedTo);
dbClient.updateObject(storageSystem1, storageSystem2);
// Create RemoteDirectorGroups
RemoteDirectorGroup rdg1 = new RemoteDirectorGroup();
rdg1.setActive(true);
rdg1.setConnectivityStatus(RemoteDirectorGroup.ConnectivityStatus.UP.name());
rdg1.setLabel("RDG1");
rdg1.setId(URI.create("RDG1" + label1));
rdg1.setNativeGuid("$label1+$label2+6");
rdg1.setRemoteGroupId("6");
rdg1.setRemoteStorageSystemUri(storageSystem2.getId());
rdg1.setSourceGroupId("6");
rdg1.setSourceStorageSystemUri(storageSystem1.getId());
rdg1.setSupportedCopyMode(RemoteDirectorGroup.SupportedCopyModes.ASYNCHRONOUS.name());
dbClient.createObject(rdg1);
RemoteDirectorGroup rdg2 = new RemoteDirectorGroup();
rdg2.setActive(true);
rdg2.setConnectivityStatus(RemoteDirectorGroup.ConnectivityStatus.UP.name());
rdg2.setLabel("RDG2");
rdg2.setId(URI.create("RDG2" + label1));
rdg2.setNativeGuid("$label2+$label1+6");
rdg2.setRemoteGroupId("6");
rdg2.setRemoteStorageSystemUri(storageSystem1.getId());
rdg2.setSourceGroupId("6");
rdg2.setSourceStorageSystemUri(storageSystem2.getId());
rdg2.setSupportedCopyMode(RemoteDirectorGroup.SupportedCopyModes.ASYNCHRONOUS.name());
dbClient.createObject(rdg2);
// Create two front-end storage ports system1.
List<StoragePort> system1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < portWWNs1.length; i++) {
system1Ports.add(PlacementTestUtils.createStoragePort(dbClient, storageSystem1, network1, portWWNs1[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1vmax" + i, "C0+FC0" + i));
}
// Create two front-end storage ports system2
List<StoragePort> system2Ports = new ArrayList<StoragePort>();
for (int i = 0; i < portWWNs2.length; i++) {
system2Ports.add(PlacementTestUtils.createStoragePort(dbClient, storageSystem2, network2, portWWNs2[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2vmax" + i, "D0+FC0" + i));
}
return storageSystems;
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class PlacementTestUtils method createVPlexTwoCluster.
/**
* Creates a two cluster distrubted system.
* @param dbClient - db client handle
* @param label - name of the Storage System
* @param varray1 - varray ckyster 1
* @param networkFE1 network for cluster 1 Front End ports WWN
* @param networkBE1 - network for cluster 1 Back End ports WWn
* @param vplexFE1 - Front End Ports cluster 1
* @param vplexBE1 - Back End ports cluster 1
* @param varray2 -- corresponding stuff for cluster 2
* @param networkFE2
* @param networkBE2
* @param vplexFE2
* @param vplexBE2
* @return Storage System created represending Vplex Metro System
*/
public static StorageSystem createVPlexTwoCluster(DbClient dbClient, String label, VirtualArray varray1, Network networkFE1, Network networkBE1, String[] vplexFE1, String[] vplexBE1, VirtualArray varray2, Network networkFE2, Network networkBE2, String[] vplexFE2, String[] vplexBE2) {
// Create a VPLEX storage system
StorageSystem vplexStorageSystem = PlacementTestUtils.createStorageSystem(dbClient, "vplex", label);
// Cluster one.
// Create two front-end storage ports VPLEX
List<StoragePort> fePorts = new ArrayList<StoragePort>();
for (int i = 0; i < vplexFE1.length; i++) {
fePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkFE1, vplexFE1[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE" + i, label + "_A0+FC0" + i));
}
// Create two back-end storage ports VPLEX
List<StoragePort> bePorts = new ArrayList<StoragePort>();
for (int i = 0; i < vplexBE1.length; i++) {
bePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkBE1, vplexBE1[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE" + i, label + "_B0+FC0" + i));
}
// Cluster two.
// Create two front-end storage ports VPLEX
fePorts = new ArrayList<StoragePort>();
for (int i = 0; i < vplexFE2.length; i++) {
fePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkFE2, vplexFE2[i], varray2, StoragePort.PortType.frontend.name(), "portGroupFE" + i, label + "_C0+FC0" + i));
}
// Create two back-end storage ports VPLEX
bePorts = new ArrayList<StoragePort>();
for (int i = 0; i < vplexBE2.length; i++) {
bePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkBE2, vplexBE2[i], varray2, StoragePort.PortType.backend.name(), "portGroupBE" + i, label + "_D0+FC0" + i));
}
return vplexStorageSystem;
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class PlacementTestUtils method createVPlexOneCluster.
public static StorageSystem createVPlexOneCluster(DbClient dbClient, String label, VirtualArray varray, Network networkFE, Network networkBE, String[] vplexFE, String[] vplexBE) {
// Create a VPLEX storage system
StorageSystem vplexStorageSystem = PlacementTestUtils.createStorageSystem(dbClient, "vplex", label);
// 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, label + "_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, label + "_B0+FC0" + i));
}
return vplexStorageSystem;
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class VplexExportGroupServiceApiImpl method getVirtualArrayTaggedPortsByNework.
/**
* This methods looks for tagged virtual array ports if it belongs to a
* network then adds it to a map.
*
* @param varray virtual array uri
* @return a map of network to storageport set
*/
private Map<Network, Set<StoragePort>> getVirtualArrayTaggedPortsByNework(URI varray) {
Map<URI, Set<StoragePort>> registeredNetworkStoragePorts = new HashMap<URI, Set<StoragePort>>();
URIQueryResultList storagePortURIs = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVirtualArrayStoragePortsConstraint(varray.toString()), storagePortURIs);
Iterator<URI> storagePortURIsIter = storagePortURIs.iterator();
while (storagePortURIsIter.hasNext()) {
URI storagePortURI = storagePortURIsIter.next();
StoragePort storagePort = _dbClient.queryObject(StoragePort.class, storagePortURI);
if (storagePort != null && !storagePort.getInactive() && !NullColumnValueGetter.isNullURI(storagePort.getNetwork()) && storagePort.getRegistrationStatus().equals(DiscoveredDataObject.RegistrationStatus.REGISTERED.name()) && !storagePort.getDiscoveryStatus().equalsIgnoreCase(DiscoveryStatus.NOTVISIBLE.name())) {
if (registeredNetworkStoragePorts.get(storagePort.getNetwork()) == null) {
Set<StoragePort> storageports = new HashSet<StoragePort>();
storageports.add(storagePort);
registeredNetworkStoragePorts.put(storagePort.getNetwork(), storageports);
} else {
registeredNetworkStoragePorts.get(storagePort.getNetwork()).add(storagePort);
}
}
}
Map<Network, Set<StoragePort>> networkToStoragePortsMap = new HashMap<Network, Set<StoragePort>>();
for (Map.Entry<URI, Set<StoragePort>> entry : registeredNetworkStoragePorts.entrySet()) {
Network network = _dbClient.queryObject(Network.class, entry.getKey());
networkToStoragePortsMap.put(network, entry.getValue());
}
return networkToStoragePortsMap;
}
use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.
the class VplexExportGroupServiceApiImpl method getNetworkTaggedPortsForHost.
/**
* This method returns all StoragePorts from networks containing initiators
* of a host.
*
* @param hostUri
* @param networkToPortsMap map of network to storageport set
*/
private Map<URI, StoragePort> getNetworkTaggedPortsForHost(URI hostUri, Map<Network, Set<StoragePort>> networkToPortsMap) {
URIQueryResultList initiatorURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getContainedObjectsConstraint(hostUri, Initiator.class, "host"), initiatorURIs);
Map<URI, StoragePort> networkStoragePorts = new HashMap<URI, StoragePort>();
Set<StoragePort> storagePorts = new HashSet<StoragePort>();
Iterator<URI> initiatorURIsIter = initiatorURIs.iterator();
while (initiatorURIsIter.hasNext()) {
URI initiatorURI = initiatorURIs.iterator().next();
Initiator initiator = _dbClient.queryObject(Initiator.class, initiatorURI);
if (!initiator.getInactive() && initiator.getRegistrationStatus().equals(DiscoveredDataObject.RegistrationStatus.REGISTERED.name())) {
for (Map.Entry<Network, Set<StoragePort>> entry : networkToPortsMap.entrySet()) {
if (entry.getKey().retrieveEndpoints().contains(initiator.getInitiatorPort())) {
storagePorts.addAll(entry.getValue());
}
}
}
}
for (StoragePort storagePort : storagePorts) {
networkStoragePorts.put(storagePort.getId(), storagePort);
}
return networkStoragePorts;
}
Aggregations