Search in sources :

Example 1 with MoverInterface

use of com.emc.nas.vnxfile.xmlapi.MoverInterface in project coprhd-controller by CoprHD.

the class VNXStoragePortsProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final PostMethod result = (PostMethod) resultObj;
    _logger.info("processing vnx storageport response" + resultObj);
    try {
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        if (null != responsePacket.getPacketFault()) {
            Status status = responsePacket.getPacketFault();
            processErrorStatus(status, keyMap);
        } else {
            List<Object> queryResponse = getQueryResponse(responsePacket);
            Iterator<Object> queryRespItr = queryResponse.iterator();
            List<VNXDataMoverIntf> dmIntfs = new ArrayList<VNXDataMoverIntf>();
            while (queryRespItr.hasNext()) {
                Object responseObj = queryRespItr.next();
                if (responseObj instanceof MoverInterface) {
                    MoverInterface mover = (MoverInterface) responseObj;
                    // Check that the interface is up and not an internal network interface.
                    String name = mover.getName();
                    if (mover.isUp() && !name.startsWith("el")) {
                        VNXDataMoverIntf vnxMover = new VNXDataMoverIntf(mover.getName(), mover.getIpAddress(), mover.getMover());
                        _logger.debug("Port Information : {}", vnxMover.toString());
                        dmIntfs.add(vnxMover);
                    }
                }
            }
            _logger.info("Number of Ports found  : {}", dmIntfs.size());
            keyMap.put(VNXFileConstants.STORAGE_PORTS, dmIntfs);
            // Extract session information from the response header.
            Header[] headers = result.getResponseHeaders(VNXFileConstants.CELERRA_SESSION);
            if (null != headers && headers.length > 0) {
                keyMap.put(VNXFileConstants.CELERRA_SESSION, headers[0].getValue());
                _logger.info("Recieved celerra storage ports information from the Server.");
            }
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the vnx storage ports info response due to ", ex);
    } finally {
        result.releaseConnection();
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) PostMethod(org.apache.commons.httpclient.methods.PostMethod) MoverInterface(com.emc.nas.vnxfile.xmlapi.MoverInterface) ArrayList(java.util.ArrayList) VNXDataMoverIntf(com.emc.storageos.vnx.xmlapi.VNXDataMoverIntf) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header)

Aggregations

MoverInterface (com.emc.nas.vnxfile.xmlapi.MoverInterface)1 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 Status (com.emc.nas.vnxfile.xmlapi.Status)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 VNXDataMoverIntf (com.emc.storageos.vnx.xmlapi.VNXDataMoverIntf)1 ArrayList (java.util.ArrayList)1 Header (org.apache.commons.httpclient.Header)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1