@Test public void processRequest() throws Exception { Map<NetConfResponse, List<Notification>> map = new HashMap<>(); NetConfResponse netConfResponse = DocumentToPojoTransformer.getNetconfResponse(DocumentUtils.stringToDocument(RESPONSE_OK_XML)); map.put(netConfResponse, Collections.emptyList()); when(m_pmaRegistry.executeNC(DEVICE_NAME_A, REQUEST_DEVICE_CONFIG_GET)).thenReturn(map); String response = m_pmaAdapter.processRequest(DEVICE_NAME_A, REQUEST_DEVICE_CONFIG_GET); TestUtil.assertXMLEquals(DocumentUtils.stringToDocument(RESPONSE_OK_XML).getDocumentElement(), DocumentUtils.stringToDocument(response).getDocumentElement()); }
@Override public String processRequest(String deviceName, String netconfRequest) throws DispatchException { try { NetconfRpcMessage netconfRpcMessage = NetconfRpcMessage.getInstance(netconfRequest); if (netconfRpcMessage.getOnlyOneTopXmlns().equals(PmaDeviceConfigRpc.NAMESPACE)) { return processPmaDeviceConfigRequest(deviceName, netconfRpcMessage); } Map<NetConfResponse, List<Notification>> netConfResponseListMap = getPmaRegistry().executeNC(deviceName, netconfRequest); Map.Entry<NetConfResponse, List<Notification>> entry = netConfResponseListMap.entrySet().iterator().next(); List<Notification> notificationList = entry.getValue(); if ((notificationList != null) && (!notificationList.isEmpty())) { for (Notification notification : notificationList) { m_aggregator.publishNotification(deviceName, notification); } } return entry.getKey().responseToString(); } catch (IllegalArgumentException | IllegalStateException | ExecutionException ex) { throw new DispatchException(ex); } }
PmaAdapter implements DeviceConfigProcessor, GlobalRequestProcessor { @Override public String processRequest(String deviceName, String netconfRequest) throws DispatchException { try { NetconfRpcMessage netconfRpcMessage = NetconfRpcMessage.getInstance(netconfRequest); if (netconfRpcMessage.getOnlyOneTopXmlns().equals(PmaDeviceConfigRpc.NAMESPACE)) { return processPmaDeviceConfigRequest(deviceName, netconfRpcMessage); } Map<NetConfResponse, List<Notification>> netConfResponseListMap = getPmaRegistry().executeNC(deviceName, netconfRequest); Map.Entry<NetConfResponse, List<Notification>> entry = netConfResponseListMap.entrySet().iterator().next(); List<Notification> notificationList = entry.getValue(); if ((notificationList != null) && (!notificationList.isEmpty())) { for (Notification notification : notificationList) { m_aggregator.publishNotification(deviceName, notification); } } return entry.getKey().responseToString(); } catch (IllegalArgumentException | IllegalStateException | ExecutionException ex) { throw new DispatchException(ex); } } }
PmaAdapter implements DeviceConfigProcessor, GlobalRequestProcessor { @Override public String processRequest(String deviceName, String netconfRequest) throws DispatchException { try { NetconfRpcMessage netconfRpcMessage = NetconfRpcMessage.getInstance(netconfRequest); if (netconfRpcMessage.getOnlyOneTopXmlns().equals(PmaDeviceConfigRpc.NAMESPACE)) { return processPmaDeviceConfigRequest(deviceName, netconfRpcMessage); } Map<NetConfResponse, List<Notification>> netConfResponseListMap = getPmaRegistry().executeNC(deviceName, netconfRequest); Map.Entry<NetConfResponse, List<Notification>> entry = netConfResponseListMap.entrySet().iterator().next(); List<Notification> notificationList = entry.getValue(); if ((notificationList != null) && (!notificationList.isEmpty())) { for (Notification notification : notificationList) { m_aggregator.publishNotification(deviceName, notification); } } return entry.getKey().responseToString(); } catch (IllegalArgumentException | IllegalStateException | ExecutionException ex) { throw new DispatchException(ex); } } PmaAdapter(Aggregator aggregator, PmaRegistry pmaRegistry,
                      AdapterDeployer actionHandler); }
PmaAdapter implements DeviceConfigProcessor, GlobalRequestProcessor { @Override public String processRequest(String deviceName, String netconfRequest) throws DispatchException { try { NetconfRpcMessage netconfRpcMessage = NetconfRpcMessage.getInstance(netconfRequest); if (netconfRpcMessage.getOnlyOneTopXmlns().equals(PmaDeviceConfigRpc.NAMESPACE)) { return processPmaDeviceConfigRequest(deviceName, netconfRpcMessage); } Map<NetConfResponse, List<Notification>> netConfResponseListMap = getPmaRegistry().executeNC(deviceName, netconfRequest); Map.Entry<NetConfResponse, List<Notification>> entry = netConfResponseListMap.entrySet().iterator().next(); List<Notification> notificationList = entry.getValue(); if ((notificationList != null) && (!notificationList.isEmpty())) { for (Notification notification : notificationList) { m_aggregator.publishNotification(deviceName, notification); } } return entry.getKey().responseToString(); } catch (IllegalArgumentException | IllegalStateException | ExecutionException ex) { throw new DispatchException(ex); } } PmaAdapter(Aggregator aggregator, PmaRegistry pmaRegistry,
                      AdapterDeployer actionHandler); void init(); void destroy(); @Override String processRequest(String deviceName, String netconfRequest); @Override String processRequest(NetconfClientInfo clientInfo, String netconfRequest); Aggregator getAggregator(); PmaRegistry getPmaRegistry(); }
PmaAdapter implements DeviceConfigProcessor, GlobalRequestProcessor { @Override public String processRequest(String deviceName, String netconfRequest) throws DispatchException { try { NetconfRpcMessage netconfRpcMessage = NetconfRpcMessage.getInstance(netconfRequest); if (netconfRpcMessage.getOnlyOneTopXmlns().equals(PmaDeviceConfigRpc.NAMESPACE)) { return processPmaDeviceConfigRequest(deviceName, netconfRpcMessage); } Map<NetConfResponse, List<Notification>> netConfResponseListMap = getPmaRegistry().executeNC(deviceName, netconfRequest); Map.Entry<NetConfResponse, List<Notification>> entry = netConfResponseListMap.entrySet().iterator().next(); List<Notification> notificationList = entry.getValue(); if ((notificationList != null) && (!notificationList.isEmpty())) { for (Notification notification : notificationList) { m_aggregator.publishNotification(deviceName, notification); } } return entry.getKey().responseToString(); } catch (IllegalArgumentException | IllegalStateException | ExecutionException ex) { throw new DispatchException(ex); } } PmaAdapter(Aggregator aggregator, PmaRegistry pmaRegistry,
                      AdapterDeployer actionHandler); void init(); void destroy(); @Override String processRequest(String deviceName, String netconfRequest); @Override String processRequest(NetconfClientInfo clientInfo, String netconfRequest); Aggregator getAggregator(); PmaRegistry getPmaRegistry();  }