import org.commscope.tr069adapter.acs.common.ParameterDTO;\r
import org.commscope.tr069adapter.mapper.MOMetaData;\r
import org.commscope.tr069adapter.mapper.MapperConfigProperties;\r
+import org.commscope.tr069adapter.mapper.model.NetConfNotificationDTO;\r
import org.commscope.tr069adapter.mapper.util.MOMetaDataUtil;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
try {\r
LOG.debug("deviceInform : {} {}", deviceInform.getInformTypeList(),\r
deviceInform.getParameters());\r
- convertTR069ToNetConfParams(deviceInform);\r
+ NetConfNotificationDTO netConfDTO =\r
+ new NetConfNotificationDTO(deviceInform.getDeviceDetails().getDeviceId(),\r
+ deviceInform.getInformType().toString(), false);\r
+ netConfDTO.setParameters(deviceInform.getParameters());\r
+ convertTR069ToNetConfParams(netConfDTO);\r
LOG.debug("Posting notification to netconf server");\r
- response = restTemplate.postForObject(uri, deviceInform, ResponseEntity.class);\r
+ response = restTemplate.postForObject(uri, netConfDTO, ResponseEntity.class);\r
LOG.debug("Posting notification to netconf server completed ");\r
} catch (Exception e) {\r
LOG.error("Exception while sending the notification.", e);\r
return response;\r
}\r
\r
- private void convertTR069ToNetConfParams(DeviceInform deviceInform) {\r
+ public ResponseEntity sendCustomNotification(NetConfNotificationDTO netConfDTO) {\r
+ ResponseEntity response = null;\r
+ final String uri = getUri();\r
+ LOG.debug("Posting custom notification to netconf server " + uri);\r
+ try {\r
+ response = restTemplate.postForObject(uri, netConfDTO, ResponseEntity.class);\r
+ LOG.debug("Posting custom notification to netconf server sucessfull");\r
+ } catch (Exception e) {\r
+ LOG.error("Exception while sending the custom notification.", e.toString());\r
+ }\r
+ return response;\r
+ }\r
+\r
+ private void convertTR069ToNetConfParams(NetConfNotificationDTO netConfDTO) {\r
List<ParameterDTO> removeList = new ArrayList<>();\r
- if (null != deviceInform) {\r
- for (ParameterDTO param : deviceInform.getParameters()) {\r
+ if (null != netConfDTO) {\r
+ for (ParameterDTO param : netConfDTO.getParameters()) {\r
if (param.getParamValue() == null || param.getParamValue().trim().length() <= 0) {\r
continue;\r
}\r
removeList.add(param); // unknown parameter found.\r
}\r
}\r
- deviceInform.getParameters().removeAll(removeList); // remove unknown\r
- // parameters\r
+ netConfDTO.getParameters().removeAll(removeList);\r
}\r
}\r
\r