Merge "Add subscribeToStream to JSONRestConfService"
authorTom Pantelis <tompantelis@gmail.com>
Tue, 30 Oct 2018 12:47:36 +0000 (12:47 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 30 Oct 2018 12:47:36 +0000 (12:47 +0000)
features/netconf/odl-netconf-netty-util/pom.xml
netconf/netconf-netty-util/pom.xml
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/MasterSalFacade.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/NetconfMessageTransformerTest.java

index ee7fa62eb24f38867b3952b19ced01c485d0167e..6294139ec0b42dc84f056a7aa1cf5a60f2fa1d0c 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>netconf-netty-util</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.siemens.ct.exi</groupId>
-            <artifactId>exificient</artifactId>
-            <version>1.0.1</version>
-        </dependency>
     </dependencies>
 </project>
index 0f7254bd24d7b444bd09586ace16dffd56360da8..89f2c85190e26b58d803c579c10e647e9e1dd6fc 100644 (file)
       <groupId>org.apache.sshd</groupId>
       <artifactId>sshd-netty</artifactId>
     </dependency>
+
     <dependency>
       <groupId>com.siemens.ct.exi</groupId>
       <artifactId>exificient</artifactId>
     </dependency>
+    <dependency>
+      <!-- Override until exificient ships a newer version -->
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <version>2.12.0</version>
+    </dependency>
+
     <dependency>
       <groupId>xml-apis</groupId>
       <artifactId>xml-apis</artifactId>
index 3a70ed700cb847ceecec8dde871dd13df8357868..8e13f630d8fc267a34ce5af2786ff56871f8e7b0 100644 (file)
@@ -18,6 +18,7 @@ import com.google.common.base.Preconditions;
 import java.util.List;
 import java.util.stream.Collectors;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMActionService;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
@@ -66,6 +67,19 @@ class MasterSalFacade implements AutoCloseable, RemoteDeviceHandler<NetconfSessi
         this.actorResponseWaitTime = actorResponseWaitTime;
     }
 
+    @Override
+    public void onDeviceConnected(final SchemaContext remoteSchemaContext,
+                                  final NetconfSessionPreferences sessionPreferences,
+                                  final DOMRpcService domRpcService, final DOMActionService domActionService) {
+        // We do not support actions in clustered topology yet
+        if (domActionService != null) {
+            LOG.warn("{}: YANG 1.1 actions are not supported in clustered netconf topology, "
+                    + "DOMActionService will not be exposed for the device");
+        }
+
+        onDeviceConnected(remoteSchemaContext, sessionPreferences, domRpcService);
+    }
+
     @Override
     public void onDeviceConnected(final SchemaContext remoteSchemaContext,
                                   final NetconfSessionPreferences sessionPreferences,
index 19b000322884895426e7968cd1f05cc39b00442d..5214d8f77be0cd869f674e0d95a076244d9c1abd 100644 (file)
@@ -42,7 +42,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import javax.xml.transform.dom.DOMSource;
-import org.apache.xerces.dom.TextImpl;
 import org.custommonkey.xmlunit.Diff;
 import org.custommonkey.xmlunit.ElementNameAndAttributeQualifier;
 import org.custommonkey.xmlunit.XMLUnit;
@@ -433,8 +432,8 @@ public class NetconfMessageTransformerTest {
         Node childName = childServer.getFirstChild();
         checkNode(childName, "name", "name", qname.getNamespace().toString());
 
-        TextImpl childTest = (TextImpl) childName.getFirstChild();
-        assertEquals(childTest.getData(), "test");
+        Node childTest = childName.getFirstChild();
+        assertEquals(childTest.getNodeValue(), "test");
 
         checkAction(actionResetQName, childName.getNextSibling(), "reset-at", "reset-at", "now");
     }
@@ -507,18 +506,18 @@ public class NetconfMessageTransformerTest {
         assertEquals("now", leaf.getValue());
     }
 
-    private void checkAction(final QName actionQname, final Node action , final String inputLocalName,
+    private static void checkAction(final QName actionQname, final Node action , final String inputLocalName,
             final String inputNodeName, final String inputValue) {
         checkNode(action, null, actionQname.getLocalName(), null);
 
         Node childResetAt = action.getFirstChild();
         checkNode(childResetAt, inputLocalName, inputNodeName, actionQname.getNamespace().toString());
 
-        TextImpl firstChild = (TextImpl) childResetAt.getFirstChild();
-        assertEquals(firstChild.getData(), inputValue);
+        Node firstChild = childResetAt.getFirstChild();
+        assertEquals(firstChild.getNodeValue(), inputValue);
     }
 
-    private Node checkBasePartOfActionRequest(final NetconfMessage actionRequest) {
+    private static Node checkBasePartOfActionRequest(final NetconfMessage actionRequest) {
         Node baseRpc = actionRequest.getDocument().getFirstChild();
         checkNode(baseRpc, "rpc", "rpc", NetconfMessageTransformUtil.NETCONF_QNAME.getNamespace().toString());
         assertTrue(baseRpc.getLocalName().equals("rpc"));
@@ -533,7 +532,7 @@ public class NetconfMessageTransformerTest {
         return childAction;
     }
 
-    private DOMDataTreeIdentifier prepareDataTreeId(final Set<PathArgument> nodeIdentifiers) {
+    private static DOMDataTreeIdentifier prepareDataTreeId(final Set<PathArgument> nodeIdentifiers) {
         YangInstanceIdentifier yangInstanceIdentifier =
                 YangInstanceIdentifier.builder().append(nodeIdentifiers).build();
         DOMDataTreeIdentifier domDataTreeIdentifier =
@@ -542,7 +541,7 @@ public class NetconfMessageTransformerTest {
         return domDataTreeIdentifier;
     }
 
-    private ContainerNode initInputAction(final QName qname, final String value) {
+    private static ContainerNode initInputAction(final QName qname, final String value) {
         ImmutableLeafNodeBuilder<String> immutableLeafNodeBuilder = new ImmutableLeafNodeBuilder<>();
         DataContainerChild<NodeIdentifier, String> build = immutableLeafNodeBuilder.withNodeIdentifier(
                 NodeIdentifier.create(qname)).withValue(value).build();
@@ -551,7 +550,7 @@ public class NetconfMessageTransformerTest {
         return data;
     }
 
-    private void checkNode(final Node childServer, final String expectedLocalName, final String expectedNodeName,
+    private static void checkNode(final Node childServer, final String expectedLocalName, final String expectedNodeName,
             final String expectedNamespace) {
         assertNotNull(childServer);
         assertEquals(childServer.getLocalName(), expectedLocalName);
@@ -559,11 +558,11 @@ public class NetconfMessageTransformerTest {
         assertEquals(childServer.getNamespaceURI(), expectedNamespace);
     }
 
-    private SchemaContext getActionSchema() {
+    private static SchemaContext getActionSchema() {
         return YangParserTestUtils.parseYangResource("/schemas/example-server-farm.yang");
     }
 
-    private NetconfMessageTransformer getActionMessageTransformer() {
+    private static NetconfMessageTransformer getActionMessageTransformer() {
         return new NetconfMessageTransformer(getActionSchema(), true);
     }
 }