Search in sources :

Example 1 with XtremIOInitiatorsInfo

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiatorsInfo in project coprhd-controller by CoprHD.

the class XtremIOV2Client method getXtremIOInitiatorsInfo.

@Override
public List<XtremIOInitiator> getXtremIOInitiatorsInfo(String clusterName) throws Exception {
    String uriString = XtremIOConstants.XTREMIO_V2_INITIATORS_STR.concat(XtremIOConstants.getInputClusterString(clusterName));
    ClientResponse response = get(URI.create(uriString));
    XtremIOInitiatorsInfo initiatorPortLinks = getResponseObject(XtremIOInitiatorsInfo.class, response);
    log.info("Returned Initiator Links size : {}", initiatorPortLinks.getInitiators().length);
    List<XtremIOInitiator> initiatorPortList = new ArrayList<XtremIOInitiator>();
    for (XtremIOObjectInfo initiatorPortInfo : initiatorPortLinks.getInitiators()) {
        URI initiatorPortUri = URI.create(URIUtil.getFromPath(initiatorPortInfo.getHref().concat(XtremIOConstants.getInputClusterString(clusterName))));
        try {
            response = get(initiatorPortUri);
            XtremIOInitiators initiatorPorts = getResponseObject(XtremIOInitiators.class, response);
            log.info("Initiator Port {}", initiatorPorts.getContent().getName() + "-" + initiatorPorts.getContent().getPortAddress());
            initiatorPortList.add(initiatorPorts.getContent());
        } catch (Exception e) {
            if (null != e.getMessage() && !e.getMessage().contains(XtremIOConstants.OBJECT_NOT_FOUND)) {
                throw e;
            } else {
                log.warn("GET initiator - {} failed with obj_not_found. Initiator might be deleted from the system", initiatorPortUri.toString());
            }
        }
    }
    return initiatorPortList;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOInitiators(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiators) ArrayList(java.util.ArrayList) XtremIOObjectInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOObjectInfo) XtremIOInitiatorsInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiatorsInfo) URI(java.net.URI) XtremIOApiException(com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException) XtremIOInitiator(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiator)

Example 2 with XtremIOInitiatorsInfo

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiatorsInfo in project coprhd-controller by CoprHD.

the class XtremIOV1Client method getXtremIOInitiatorsInfo.

@Override
public List<XtremIOInitiator> getXtremIOInitiatorsInfo(String clusterName) throws Exception {
    ClientResponse response = get(XtremIOConstants.XTREMIO_INITIATORS_URI);
    XtremIOInitiatorsInfo initiatorPortLinks = getResponseObject(XtremIOInitiatorsInfo.class, response);
    log.info("Returned Initiator Links size : {}", initiatorPortLinks.getInitiators().length);
    List<XtremIOInitiator> initiatorPortList = new ArrayList<XtremIOInitiator>();
    for (XtremIOObjectInfo initiatorPortInfo : initiatorPortLinks.getInitiators()) {
        URI initiatorPortUri = URI.create(URIUtil.getFromPath(initiatorPortInfo.getHref()));
        try {
            response = get(initiatorPortUri);
            XtremIOInitiators initiatorPorts = getResponseObject(XtremIOInitiators.class, response);
            log.info("Initiator Port {}", initiatorPorts.getContent().getName() + "-" + initiatorPorts.getContent().getPortAddress());
            initiatorPortList.add(initiatorPorts.getContent());
        } catch (Exception e) {
            if (null != e.getMessage() && !e.getMessage().contains(XtremIOConstants.OBJECT_NOT_FOUND)) {
                throw e;
            } else {
                log.warn("GET initiator - {} failed with obj_not_found. Initiator might be deleted from the system", initiatorPortUri.toString());
            }
        }
    }
    return initiatorPortList;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOInitiators(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiators) ArrayList(java.util.ArrayList) XtremIOObjectInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOObjectInfo) XtremIOInitiatorsInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiatorsInfo) URI(java.net.URI) XtremIOApiException(com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException) XtremIOInitiator(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiator)

Aggregations

XtremIOApiException (com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException)2 XtremIOInitiator (com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiator)2 XtremIOInitiators (com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiators)2 XtremIOInitiatorsInfo (com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiatorsInfo)2 XtremIOObjectInfo (com.emc.storageos.xtremio.restapi.model.response.XtremIOObjectInfo)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2