import java.util.List;\r
import java.util.Map;\r
import java.util.StringTokenizer;\r
-\r
import javax.xml.XMLConstants;\r
import javax.xml.parsers.DocumentBuilder;\r
import javax.xml.parsers.DocumentBuilderFactory;\r
import javax.xml.transform.TransformerFactory;\r
import javax.xml.transform.dom.DOMSource;\r
import javax.xml.transform.stream.StreamResult;\r
-\r
import org.commscope.tr069adapter.acs.common.DeviceRPCRequest;\r
import org.commscope.tr069adapter.acs.common.DeviceRPCResponse;\r
import org.commscope.tr069adapter.acs.common.OperationOptions;\r
\r
@Autowired\r
MOMetaDataUtil metaDataUtil;\r
- \r
+\r
@Autowired\r
MapperConfigProperties config;\r
\r
return deviceRPCRequest;\r
}\r
\r
- public NetConfResponse getNetconfResponse(DeviceRPCResponse opResult, boolean isCustomparameter) {\r
+ public NetConfResponse getNetconfResponse(DeviceRPCResponse opResult, String swVersion,\r
+ String hwVersion, boolean isCustomparameter) {\r
NetConfResponse netConfResponse = new NetConfResponse();\r
ErrorCodeDetails errorCodeDetails = errorCodeUtil.getErrorCodeMetaData(opResult.getFaultKey());\r
ErrorCodeDetails errorCode = new ErrorCodeDetails();\r
netConfResponse.setErrorCode(errorCode);\r
netConfResponse.setErrorMessage(opResult.getFaultString());\r
}\r
- netConfResponse.setNetconfResponseXml(getNetconfResponseXML(\r
- opResult.getOperationResponse().getParameterDTOs(), isCustomparameter));\r
+ netConfResponse.setNetconfResponseXml(\r
+ getNetconfResponseXML(opResult.getOperationResponse().getParameterDTOs(), swVersion,\r
+ hwVersion, isCustomparameter));\r
return netConfResponse;\r
}\r
\r
- public NetConfResponse getNetconfResponseForSoftwareInventory(DeviceRPCResponse opResult) {\r
+ public NetConfResponse getNetconfResponseForSoftwareInventory(DeviceRPCResponse opResult,\r
+ String swVersion, String hwVersion) {\r
\r
NetConfResponse netConfResponse = new NetConfResponse();\r
ErrorCodeDetails errorCodeDetails = errorCodeUtil.getErrorCodeMetaData(opResult.getFaultKey());\r
paramDTOList.add(new ParameterDTO("software-inventory.software-slot.access", "READ_ONLY"));\r
paramDTOList\r
.add(new ParameterDTO("software-inventory.software-slot.product-code", productClass));\r
- paramDTOList.add(new ParameterDTO("software-inventory.software-slot.vendor-code", config.getVendorName()));\r
+ paramDTOList.add(\r
+ new ParameterDTO("software-inventory.software-slot.vendor-code", config.getVendorName()));\r
paramDTOList.add(new ParameterDTO("software-inventory.software-slot.build-id", buildId));\r
paramDTOList.add(new ParameterDTO("software-inventory.software-slot.build-version",\r
buildVersion.toString()));\r
paramDTOList.add(new ParameterDTO("software-inventory.software-slot.files.name", "BC_ONE"));\r
paramDTOList.add(new ParameterDTO("software-inventory.software-slot.files.integrity", "OK"));\r
\r
- String XmlStr = getNetconfResponseXML(paramDTOList, true);\r
+ String XmlStr = getNetconfResponseXML(paramDTOList, swVersion, hwVersion, true);\r
\r
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\r
DocumentBuilder builder;\r
return netConfResponse;\r
}\r
\r
- private String getNetconfResponseXML(List<ParameterDTO> parameters, boolean isCustomparameter) {\r
+ private String getNetconfResponseXML(List<ParameterDTO> parameters, String swVersion,\r
+ String hwVersion, boolean isCustomparameter) {\r
if (null == parameters || parameters.isEmpty()) {\r
\r
return null;\r
Element dataNode = null; // root of all nodes\r
\r
for (ParameterDTO paramDto : parameters) {\r
- String paramName =\r
- metaDataUtil.getNetconfNameByTR69NameWithIndexes(paramDto.getParamName());\r
+ String paramName = metaDataUtil.getNetconfNameByTR69NameWithIndexes(paramDto.getParamName(),\r
+ swVersion, hwVersion);\r
if (paramName == null && isCustomparameter) {\r
paramName = paramDto.getParamName();\r
}\r
\r
// create a tabular parent node if doesn't exit in MAP\r
if (null == node) {\r
- if (metaDataUtil.getMetaDataByNetConfName(parentNodeKey + ".") != null\r
- && metaDataUtil.getMetaDataByNetConfName(parentNodeKey + ".").getURI() != null) {\r
- node = doc.createElementNS(\r
- metaDataUtil.getMetaDataByNetConfName(parentNodeKey + ".").getURI(),\r
+ if (metaDataUtil.getMetaDataByNetConfName(parentNodeKey + ".", swVersion,\r
+ hwVersion) != null\r
+ && metaDataUtil\r
+ .getMetaDataByNetConfName(parentNodeKey + ".", swVersion, hwVersion)\r
+ .getURI() != null) {\r
+ node = doc.createElementNS(metaDataUtil\r
+ .getMetaDataByNetConfName(parentNodeKey + ".", swVersion, hwVersion).getURI(),\r
parentNodeName);\r
} else {\r
node = doc.createElement(parentNodeName);\r
// construct intermediate nodes\r
Element node = parentNodeMap.get(parentNodeKey);\r
if (null == node) {\r
- if (metaDataUtil.getMetaDataByNetConfName(parentNodeKey) != null\r
- && metaDataUtil.getMetaDataByNetConfName(parentNodeKey).getURI() != null) {\r
- node = doc.createElementNS(\r
- metaDataUtil.getMetaDataByNetConfName(parentNodeKey).getURI(), parentNodeName);\r
+ if (metaDataUtil.getMetaDataByNetConfName(parentNodeKey, swVersion, hwVersion) != null\r
+ && metaDataUtil.getMetaDataByNetConfName(parentNodeKey, swVersion, hwVersion)\r
+ .getURI() != null) {\r
+ node = doc.createElementNS(metaDataUtil\r
+ .getMetaDataByNetConfName(parentNodeKey, swVersion, hwVersion).getURI(),\r
+ parentNodeName);\r
if (dataNode == null)\r
dataNode = node;\r
} else {\r