use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXFileSystemsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final PostMethod result = (PostMethod) 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.");
}
Status status = null;
if (null != responsePacket.getPacketFault()) {
status = responsePacket.getPacketFault();
processErrorStatus(status, keyMap);
} else {
List<Object> filesystemList = getQueryResponse(responsePacket);
List<VNXFileSystem> processedFileSystems = processFilesystemList(filesystemList, keyMap);
keyMap.put(VNXFileConstants.FILESYSTEMS, processedFileSystems);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the vnx fileShare response due to {}", ex.getMessage());
keyMap.put(com.emc.storageos.plugins.metering.vnxfile.VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(com.emc.storageos.plugins.metering.vnxfile.VNXFileConstants.CMD_RESULT, com.emc.storageos.plugins.metering.vnxfile.VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXAllQuotaDirsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("processing quota dir id response" + resultObj);
final PostMethod result = (PostMethod) resultObj;
try {
ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
if (null != responsePacket.getPacketFault()) {
Status status = responsePacket.getPacketFault();
processErrorStatus(status, keyMap);
} else {
List<Object> quotaDirList = getQueryResponse(responsePacket);
List<TreeQuota> quotaDirs = new ArrayList<TreeQuota>();
_logger.info("Received the response size {} ", quotaDirList.size());
Iterator<Object> quotaDirItr = quotaDirList.iterator();
if (quotaDirItr.hasNext()) {
Status status = (Status) quotaDirItr.next();
if (status.getMaxSeverity() == Severity.OK) {
while (quotaDirItr.hasNext()) {
TreeQuota quotaDir = (TreeQuota) quotaDirItr.next();
_logger.debug("searching quota dir: {}", quotaDir.getTree());
String id = quotaDir.getTree();
quotaDirs.add(quotaDir);
_logger.info("Found matching quota dir id: {}", id);
}
keyMap.put(VNXFileConstants.QUOTA_DIR_LIST, quotaDirs);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
}
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the quota dir response due to {}", ex.getMessage());
keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
use of com.emc.nas.vnxfile.xmlapi.ResponsePacket 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();
}
}
use of com.emc.nas.vnxfile.xmlapi.ResponsePacket 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();
}
}
use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXFileQuotaDirectoryIdProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("processing quota dir id response" + resultObj);
final PostMethod result = (PostMethod) resultObj;
try {
ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
if (null != responsePacket.getPacketFault()) {
Status status = responsePacket.getPacketFault();
processErrorStatus(status, keyMap);
} else {
boolean isQuotaDirFound = false;
List<Object> quotaDirList = getQueryResponse(responsePacket);
final String quotaDirName = (String) keyMap.get(VNXFileConstants.QUOTA_DIR_NAME);
String quotaDirPath = "/" + quotaDirName;
_logger.info("Quota dir name to match: {} Size of quotadir found {} ", quotaDirName, quotaDirList.size());
Iterator<Object> quotaDirItr = quotaDirList.iterator();
if (quotaDirItr.hasNext()) {
Status status = (Status) quotaDirItr.next();
if (status.getMaxSeverity() == Severity.OK) {
while (quotaDirItr.hasNext()) {
TreeQuota quotaDir = (TreeQuota) quotaDirItr.next();
_logger.debug("searching quota dir: {}", quotaDir.getTree());
if (quotaDir.getPath().equals(quotaDirPath)) {
String id = quotaDir.getTree();
_logger.info("Found matching quota dir: {}", id);
keyMap.put(VNXFileConstants.QUOTA_DIR_ID, id);
keyMap.put(VNXFileConstants.QUOTA_DIR_PATH, quotaDir.getPath());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
isQuotaDirFound = true;
break;
}
}
if (!isQuotaDirFound) {
_logger.error("Error in getting the quota dir information.");
}
} else {
_logger.error("Error in getting the quota dir information.");
}
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the quota dir response due to {}", ex.getMessage());
keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
Aggregations