Search in sources :

Example 1 with CifsServer

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

the class VNXCifsConfigProcessor 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 cifs config response" + resultObj);
    try {
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        // 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("Received celerra session info from the Server.");
        }
        if (null != responsePacket.getPacketFault()) {
            Status status = responsePacket.getPacketFault();
            processErrorStatus(status, keyMap);
        } else {
            List<Object> queryResponse = getQueryResponse(responsePacket);
            Iterator<Object> queryRespItr = queryResponse.iterator();
            Boolean enabled = false;
            List<VNXCifsServer> cifsServers = new ArrayList<>();
            while (queryRespItr.hasNext()) {
                Object responseObj = queryRespItr.next();
                if (responseObj instanceof CifsServer) {
                    CifsServer config = (CifsServer) responseObj;
                    _logger.info("CIFS Interfaces: {}, for VDM: {}", config.getInterfaces(), config.getMover());
                    enabled = true;
                    // Get the domain of cifs server!!!
                    String domain = new String();
                    if (config.getNT40ServerData() != null) {
                        domain = config.getNT40ServerData().getDomain();
                    } else if (config.getW2KServerData() != null) {
                        domain = config.getW2KServerData().getDomain();
                    } else if (config.getStandaloneServerData() != null) {
                        domain = config.getStandaloneServerData().getWorkgroup();
                    }
                    if (!domain.isEmpty()) {
                        _logger.info("domain cofigured for cifs : {}", domain);
                    }
                    VNXCifsServer server = new VNXCifsServer(config.getName(), config.getMover(), config.getType().toString(), config.isMoverIdIsVdm(), config.getInterfaces(), domain);
                    cifsServers.add(server);
                    _logger.info("Add : {}", server.toString());
                }
            }
            keyMap.put(VNXFileConstants.CIFS_SUPPORTED, enabled);
            keyMap.put(VNXFileConstants.CIFS_SERVERS, cifsServers);
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the vnx cifs config response due to ", ex);
        keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
        keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
    } finally {
        result.releaseConnection();
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) VNXCifsServer(com.emc.storageos.vnx.xmlapi.VNXCifsServer) VNXCifsServer(com.emc.storageos.vnx.xmlapi.VNXCifsServer) CifsServer(com.emc.nas.vnxfile.xmlapi.CifsServer) PostMethod(org.apache.commons.httpclient.methods.PostMethod) ArrayList(java.util.ArrayList) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header)

Aggregations

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