Search in sources :

Example 1 with LogicalNetworkDevice

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

the class VNXDataMoverInterfaceProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    // TODO Auto-generated method stub
    final PostMethod result = (PostMethod) resultObj;
    _logger.info("processing PortMetrics 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();
            LogicalNetworkDevice logicalNetworkDevice = null;
            // this interface to pysical port map.
            Map<String, List<String>> interPortMap = null;
            // this is mover to interportMap
            Map<String, Map<String, List<String>>> moverInterMap = new HashMap<String, Map<String, List<String>>>();
            Map<String, String> portSpeedMap = new HashMap<String, String>();
            while (queryRespItr.hasNext()) {
                Object responseObj = queryRespItr.next();
                if (responseObj instanceof LogicalNetworkDevice) {
                    logicalNetworkDevice = (LogicalNetworkDevice) responseObj;
                    // get logical device map
                    interPortMap = moverInterMap.get(logicalNetworkDevice.getMover());
                    if (interPortMap == null) {
                        interPortMap = new HashMap<String, List<String>>();
                    }
                    // process logical network device
                    processNetworkDevice(logicalNetworkDevice, interPortMap);
                    // add to map <movername, Map<interfaceIP, List<physicalport>>
                    if (!interPortMap.isEmpty()) {
                        moverInterMap.put(logicalNetworkDevice.getMover(), interPortMap);
                    }
                    // process logical network device speed
                    processPortSpeed(logicalNetworkDevice, portSpeedMap);
                }
            }
            keyMap.put(VNXFileConstants.INTREFACE_PORT_MAP, moverInterMap);
            // STORAGE_PORT_SPEED_MAP
            keyMap.put(VNXFileConstants.LOGICAL_NETWORK_SPEED_MAP, portSpeedMap);
            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 Port Metrics information from the Server.");
            }
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the Port Metrics response due to {}", ex.getMessage());
    } finally {
        result.releaseConnection();
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) PostMethod(org.apache.commons.httpclient.methods.PostMethod) HashMap(java.util.HashMap) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) LogicalNetworkDevice(com.emc.nas.vnxfile.xmlapi.LogicalNetworkDevice) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header) ArrayList(java.util.ArrayList) NameList(com.emc.nas.vnxfile.xmlapi.NameList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

LogicalNetworkDevice (com.emc.nas.vnxfile.xmlapi.LogicalNetworkDevice)1 NameList (com.emc.nas.vnxfile.xmlapi.NameList)1 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 Status (com.emc.nas.vnxfile.xmlapi.Status)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Header (org.apache.commons.httpclient.Header)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1