Search in sources :

Example 26 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class StorageProviders method discoveryCheckJson.

public static void discoveryCheckJson(@As(",") String[] ids) {
    List<String> failedDiscovery = new ArrayList<String>();
    for (String id : ids) {
        StorageProviderRestRep storageProvider = StorageProviderUtils.getStorageProvider(uri(id));
        if (storageProvider == null || storageProvider.getRegistrationStatus().equals(UNREGESTERD)) {
            // ignore for now
            continue;
        }
        if (!storageProvider.getScanStatus().equals("COMPLETE")) {
            failedDiscovery.add(storageProvider.getName());
            continue;
        }
        Set<NamedRelatedResourceRep> storageSystems = StorageProviderUtils.getConnectedStorageSystems(uri(id));
        boolean ssFound = false;
        for (NamedRelatedResourceRep storageSystem : storageSystems) {
            StorageSystemRestRep ss = StorageSystemUtils.getStorageSystem(storageSystem.getId());
            if (ss != null) {
                if (!ss.getDiscoveryJobStatus().equals("COMPLETE")) {
                    continue;
                } else {
                    ssFound = true;
                }
            }
        }
        if (!ssFound) {
            failedDiscovery.add(storageProvider.getName());
            continue;
        }
    }
    renderJSON(failedDiscovery);
}
Also used : StorageProviderRestRep(com.emc.storageos.model.smis.StorageProviderRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 27 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class StorageProviders method itemDetails.

public static void itemDetails(String id) {
    StorageProviderRestRep storageProvider = StorageProviderUtils.getStorageProvider(uri(id));
    if (storageProvider == null) {
        error(MessagesUtils.get(UNKNOWN, id));
    }
    Set<NamedRelatedResourceRep> storageSystems = StorageProviderUtils.getConnectedStorageSystems(uri(id));
    render(storageProvider, storageSystems);
}
Also used : StorageProviderRestRep(com.emc.storageos.model.smis.StorageProviderRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 28 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class StorageProviders method getAllFlashStorageSystemsList.

public static void getAllFlashStorageSystemsList(@As(",") String[] ids) {
    List<Map<String, String>> storagesystemslist = new ArrayList<Map<String, String>>();
    for (String id : ids) {
        if (id.contains(PROVIDER_TYPE)) {
            StorageProviderRestRep storageProvider = StorageProviderUtils.getStorageProvider(uri(id));
            if (storageProvider == null) {
                continue;
            }
            Set<NamedRelatedResourceRep> storageSystems = StorageProviderUtils.getConnectedStorageSystems(uri(id));
            for (NamedRelatedResourceRep storageSystem : storageSystems) {
                StorageSystemRestRep ss = StorageSystemUtils.getStorageSystem(storageSystem.getId());
                if (ss != null && !ss.getRegistrationStatus().equals(UNREGESTERD)) {
                    Map<String, String> ssMap = new HashMap<String, String>();
                    // Check if storage system is of type UNITY, VMAX or XtremIO
                    if (StringUtils.equals(XTREMIO, ss.getSystemType())) {
                        ssMap.put("id", ss.getId().toString());
                        ssMap.put("name", ss.getName());
                        storagesystemslist.add(ssMap);
                    }
                    if (StringUtils.equals(VMAX, ss.getSystemType())) {
                        String modelType = ss.getModel();
                        if (modelType != null && modelType.contains(SUFFIX_ALL_FLASH)) {
                            ssMap.put("id", ss.getId().toString());
                            ssMap.put("name", ss.getName());
                            storagesystemslist.add(ssMap);
                        }
                    }
                }
            }
        } else {
            StorageSystemRestRep ss = StorageSystemUtils.getStorageSystem(id);
            if (ss != null && !ss.getRegistrationStatus().equals(UNREGESTERD)) {
                Logger.info(ss.getId() + "-----" + ss.getSystemType());
                Map<String, String> ssMap = new HashMap<String, String>();
                // Check if storage system is of type UNITY, VMAX or XtremIO
                if (StringUtils.equals(XTREMIO, ss.getSystemType())) {
                    ssMap.put("id", ss.getId().toString());
                    ssMap.put("name", ss.getName());
                    storagesystemslist.add(ssMap);
                }
                if (StringUtils.equals(VMAX, ss.getSystemType()) || StringUtils.equals(UNITY, ss.getSystemType())) {
                    String modelType = ss.getModel();
                    if (modelType != null && modelType.contains(SUFFIX_ALL_FLASH)) {
                        ssMap.put("id", ss.getId().toString());
                        ssMap.put("name", ss.getName());
                        storagesystemslist.add(ssMap);
                    }
                }
            }
        }
    }
    renderJSON(storagesystemslist);
}
Also used : StorageProviderRestRep(com.emc.storageos.model.smis.StorageProviderRestRep) HashMap(java.util.HashMap) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) HashMap(java.util.HashMap) Map(java.util.Map) DefaultStorageProviderPortMap(util.DefaultStorageProviderPortMap)

Example 29 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class MobilityGroupSupportUtil method getMobilityGroups.

public static List<NamedRelatedResourceRep> getMobilityGroups() {
    List<VolumeGroupRestRep> volumeGroups = BourneUtil.getViprClient().application().getApplications(new ResourceFilter<VolumeGroupRestRep>() {

        @Override
        public boolean acceptId(URI id) {
            return true;
        }

        @Override
        public boolean accept(VolumeGroupRestRep item) {
            return !item.getRoles().isEmpty() && item.getRoles().contains(VolumeGroup.VolumeGroupRole.MOBILITY.name());
        }
    });
    List<NamedRelatedResourceRep> reps = Lists.newArrayList();
    for (VolumeGroupRestRep vg : volumeGroups) {
        reps.add(com.emc.vipr.client.core.util.ResourceUtils.createNamedRef(vg));
    }
    return reps;
}
Also used : VolumeGroupRestRep(com.emc.storageos.model.application.VolumeGroupRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 30 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class StorageSystemUtils method mapProtectionSystemConnectivity.

private static Map<String, Set<NamedRelatedResourceRep>> mapProtectionSystemConnectivity(List<StorageSystemConnectivityRestRep> connectivityList) {
    Map<String, Set<NamedRelatedResourceRep>> results = Maps.newTreeMap();
    for (StorageSystemConnectivityRestRep connectivity : connectivityList) {
        for (String connectionType : connectivity.getConnectionTypes()) {
            if (connectivity.getProtectionSystem() == null) {
                continue;
            }
            Set<NamedRelatedResourceRep> values = results.get(connectionType);
            if (values == null) {
                values = Sets.newTreeSet(new RelatedResourceComparator());
                results.put(connectionType, values);
            }
            values.add(connectivity.getProtectionSystem());
        }
    }
    return results;
}
Also used : StorageSystemConnectivityRestRep(com.emc.storageos.model.systems.StorageSystemConnectivityRestRep) Set(java.util.Set) RelatedResourceComparator(com.emc.vipr.client.core.util.RelatedResourceComparator) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5