use of com.emc.storageos.model.protection.ProtectionSystemConnectivityRestRep in project coprhd-controller by CoprHD.
the class ProtectionSystemService method getConnectivity.
/**
* This method will assemble a connectivity table that expresses all of the storage systems
* that are connected via this protection system. We will mark which RP site each storage
* system is visible on.
*
* @param system protection system
* @return rest response
*/
private ProtectionSystemConnectivityRestRep getConnectivity(ProtectionSystem system) {
ProtectionSystemConnectivityRestRep response = new ProtectionSystemConnectivityRestRep();
// Dig through the RPSiteArray table for now and return connectivity
Map<String, Set<URI>> siteStorageSystemMap = new HashMap<String, Set<URI>>();
// Get the rp system's array mappings from the RP client
URIQueryResultList sitelist = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getRPSiteArrayProtectionSystemConstraint(system.getId().toString()), sitelist);
List<RPSiteArray> rpSiteArrays = new ArrayList<RPSiteArray>();
Iterator<URI> it = sitelist.iterator();
while (it.hasNext()) {
URI rpSiteArrayId = it.next();
RPSiteArray siteArray = _dbClient.queryObject(RPSiteArray.class, rpSiteArrayId);
if (siteArray != null) {
rpSiteArrays.add(siteArray);
}
}
for (RPSiteArray rpSiteArray : rpSiteArrays) {
_log.info("dicoverProtectionSystem(): analyzing rpsitearray: " + rpSiteArray.toString());
if (siteStorageSystemMap.get(rpSiteArray.getRpSiteName()) == null) {
siteStorageSystemMap.put(rpSiteArray.getRpSiteName(), new HashSet<URI>());
}
// Add this storage system associated with this RP Site
siteStorageSystemMap.get(rpSiteArray.getRpSiteName()).add(rpSiteArray.getStorageSystem());
}
// Translate the primitive type into a presentable type
for (String siteId : siteStorageSystemMap.keySet()) {
ProtectionSystemConnectivitySiteRestRep site = new ProtectionSystemConnectivitySiteRestRep();
site.setSiteID(siteId);
Set<URI> addedStorageSystems = new HashSet<URI>();
for (URI storageID : siteStorageSystemMap.get(siteId)) {
if (!addedStorageSystems.contains(storageID)) {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storageID);
site.getStorageSystems().add(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, storageSystem.getId()));
addedStorageSystems.add(storageID);
}
}
if (response.getProtectionSites() == null) {
response.setProtectionSites(new ArrayList<ProtectionSystemConnectivitySiteRestRep>());
}
response.getProtectionSites().add(site);
}
response.setProtectionSystem(toNamedRelatedResource(ResourceTypeEnum.PROTECTION_SYSTEM, system.getId(), system.getLabel()));
return response;
}
use of com.emc.storageos.model.protection.ProtectionSystemConnectivityRestRep in project coprhd-controller by CoprHD.
the class DataProtectionSystems method itemDetails.
public static void itemDetails(String id) {
ProtectionSystemRestRep protectionSystem = ProtectionSystemUtils.getProtectionSystem(id);
if (protectionSystem == null) {
error(MessagesUtils.get(UNKNOWN, id));
}
ProtectionSystemConnectivityRestRep connectivity = ProtectionSystemUtils.getConnectivity(protectionSystem);
Map<URI, StorageSystemRestRep> storageSystemMap = ProtectionSystemUtils.getStorageSystemMap(connectivity);
render(protectionSystem, connectivity, storageSystemMap);
}
Aggregations