Search in sources :

Example 1 with ProtectionSystemConnectivityRestRep

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;
}
Also used : RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) ProtectionSet(com.emc.storageos.db.client.model.ProtectionSet) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) ProtectionSystemConnectivitySiteRestRep(com.emc.storageos.model.protection.ProtectionSystemConnectivitySiteRestRep) ArrayList(java.util.ArrayList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) ProtectionSystemConnectivityRestRep(com.emc.storageos.model.protection.ProtectionSystemConnectivityRestRep) HashSet(java.util.HashSet) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 2 with ProtectionSystemConnectivityRestRep

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);
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ProtectionSystemConnectivityRestRep(com.emc.storageos.model.protection.ProtectionSystemConnectivityRestRep) ProtectionSystemRestRep(com.emc.storageos.model.protection.ProtectionSystemRestRep) URI(java.net.URI)

Aggregations

ProtectionSystemConnectivityRestRep (com.emc.storageos.model.protection.ProtectionSystemConnectivityRestRep)2 URI (java.net.URI)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 ProtectionSet (com.emc.storageos.db.client.model.ProtectionSet)1 RPSiteArray (com.emc.storageos.db.client.model.RPSiteArray)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 ProtectionSystemConnectivitySiteRestRep (com.emc.storageos.model.protection.ProtectionSystemConnectivitySiteRestRep)1 ProtectionSystemRestRep (com.emc.storageos.model.protection.ProtectionSystemRestRep)1 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1