Search in sources :

Example 6 with ScControllerPort

use of com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort in project coprhd-controller by CoprHD.

the class StorageCenterAPI method getFaultDomainPorts.

/**
 * Gets the virtual ports in a fault domain.
 *
 * @param instanceId The fault domain instance ID.
 * @param True to get virtual ports, false to get physical.
 * @return The controller ports.
 */
public ScControllerPort[] getFaultDomainPorts(String instanceId, boolean virtualPorts) {
    String portType = virtualPorts ? "Virtual" : "Physical";
    RestResult rr = restClient.get(String.format("StorageCenter/ScFaultDomain/%s/%sPortList", instanceId, portType));
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScControllerPort[].class);
    }
    LOG.warn(String.format("Error getting controller ports for fault domain %s: %s", instanceId, rr.getErrorMsg()));
    return new ScControllerPort[0];
}
Also used : ScControllerPort(com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 7 with ScControllerPort

use of com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort in project coprhd-controller by CoprHD.

the class StorageCenterAPI method getTargetPorts.

/**
 * Gets all controller target ports.
 *
 * @param ssn The Storage Center serial number.
 * @param type The type of port to get or Null for all types.
 * @return The controller ports.
 */
public ScControllerPort[] getTargetPorts(String ssn, String type) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("scSerialNumber", ssn);
    if (type != null && type.length() > 0) {
        filter.append("transportType", type);
    }
    RestResult rr = restClient.post("StorageCenter/ScControllerPort/GetList", filter.toJson());
    if (checkResults(rr)) {
        List<ScControllerPort> ports = new ArrayList<>();
        ScControllerPort[] scPorts = gson.fromJson(rr.getResult(), ScControllerPort[].class);
        for (ScControllerPort port : scPorts) {
            if (port.purpose.startsWith("FrontEnd") && !"FrontEndReserved".equals(port.purpose)) {
                ports.add(port);
            }
        }
        return ports.toArray(new ScControllerPort[0]);
    }
    return new ScControllerPort[0];
}
Also used : ScControllerPort(com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ArrayList(java.util.ArrayList)

Aggregations

ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)7 ArrayList (java.util.ArrayList)6 DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)3 StorageCenterAPIException (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)3 StoragePort (com.emc.storageos.storagedriver.model.StoragePort)3 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)2 StorageCenterAPI (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI)2 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)2 ScServerHba (com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)2 RestResult (com.emc.storageos.driver.dellsc.scapi.rest.RestResult)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ScConfiguration (com.emc.storageos.driver.dellsc.scapi.objects.ScConfiguration)1 ScFaultDomain (com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain)1 ScMapping (com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)1 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)1 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)1 ScVolumeConfiguration (com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeConfiguration)1 PayloadFilter (com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)1 HostExportInfo (com.emc.storageos.storagedriver.HostExportInfo)1