Add import for netconf-node-optional 09/90909/11
authorNikhil Soni <nsoni@luminanetworks.com>
Fri, 3 Jul 2020 07:35:54 +0000 (13:05 +0530)
committerRobert Varga <nite@hq.sk>
Sat, 1 Aug 2020 12:22:23 +0000 (12:22 +0000)
This was missed in the initial work to add the
optional schema first added here:
  https://git.opendaylight.org/gerrit/c/netconf/+/82521

Because of that, adding any of the optional configs
(e.g., datastore-lock) to the body of the create device
RPC was failing. importing it in netconf-node-topology
fixes that.

JIRA: NETCONF-670
Change-Id: I5fc72d9714e0fb4f1dfd26f161d2eb3dcfe8862a
Signed-off-by: Nikhil Soni <nsoni@luminanetworks.com>
netconf/netconf-console/src/test/java/org/opendaylight/netconf/console/impl/NetconfCommandsImplTest.java
netconf/netconf-console/src/test/resources/schemas/netconf-node-optional.yang [new file with mode: 0644]
netconf/netconf-console/src/test/resources/schemas/netconf-node-topology.yang
netconf/sal-netconf-connector/src/main/yang/netconf-node-topology.yang
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapterTest.java
netconf/sal-netconf-connector/src/test/resources/schemas/netconf-node-optional.yang [new file with mode: 0644]
netconf/sal-netconf-connector/src/test/resources/schemas/netconf-node-topology.yang

index 28b8eff6087b2fd638205cc285ec5496e815c61b..03f7331720a5984ac21b536e2ed6f6c1fa0307cb 100644 (file)
@@ -77,7 +77,7 @@ public class NetconfCommandsImplTest {
     public static void beforeClass() {
         SCHEMA_CONTEXT = YangParserTestUtils.parseYangResources(NetconfCommandsImplTest.class,
             "/schemas/network-topology@2013-10-21.yang", "/schemas/ietf-inet-types@2013-07-15.yang",
-            "/schemas/yang-ext.yang", "/schemas/netconf-node-topology.yang");
+            "/schemas/yang-ext.yang", "/schemas/netconf-node-topology.yang", "/schemas/netconf-node-optional.yang");
     }
 
     @AfterClass
diff --git a/netconf/netconf-console/src/test/resources/schemas/netconf-node-optional.yang b/netconf/netconf-console/src/test/resources/schemas/netconf-node-optional.yang
new file mode 100644 (file)
index 0000000..9ecbe6e
--- /dev/null
@@ -0,0 +1,69 @@
+module netconf-node-optional {
+    namespace "urn:opendaylight:netconf-node-optional";
+    prefix "netnopt";
+
+    import network-topology { prefix nt; revision-date 2013-10-21; }
+    import yang-ext { prefix ext; revision-date "2013-07-09";}
+
+    revision "2019-06-14" {
+        description "Initial revision of Node Optional model";
+    }
+
+    grouping netconf-node-augmented-optional-fields {
+        container ignore-missing-schema-sources {
+            description "Allows mount point to reconnect on the 'missing schema sources' error.
+                WARNING - enabling the reconnection on the 'missing schema sources' error can lead
+                to unexpected errors at runtime.";
+            leaf allowed {
+                type boolean;
+                default false;
+                description "Allows reconnection of the mount point. Default false.";
+            }
+            leaf reconnect-time {
+                type uint32;
+                default 5000;
+                description "Time for reconnection - in units milliseconds. Default 5000 ms.";
+            }
+        }
+    }
+
+    container netconf-node-fields-optional {
+        description "Allows to create node's optional value with the path mapping according to
+            the network-topology -> topology -> node";
+        list topology {
+            key topology-id;
+            leaf topology-id {
+                type nt:topology-id;
+                description "The name of node's topology";
+            }
+            list node {
+                key node-id;
+                leaf node-id {
+                    type nt:node-id;
+                    description "The identifier of a node in the topology";
+                }
+                // Containers allow to create specific data-change-listener directly on a node's optional value.
+                // In the future, it'll be easy to extend the node by optional node fields in this way. Do not create
+                // direct leafs here, please.
+                container datastore-lock {
+                    description "Allows to ignore lock/unlock node's datastare.";
+                    leaf datastore-lock-allowed {
+                        type boolean;
+                        default true;
+                        description "The operation allows the client to lock the entire configuration datastore
+                            system of a device.
+                            WARNING - With blocking the lock/unlock operations, the user is coming to operate
+                            in a manner which is not supported. Concurrent access to the data store may interfere
+                            with data consistency.";
+                    }
+                }
+            }
+        }
+    }
+
+    augment "/nt:network-topology/nt:topology/nt:node/" {
+        when "../../nt:topology-types/topology-netconf";
+        ext:augment-identifier "netconf-node-augmented-optional";
+        uses netconf-node-augmented-optional-fields;
+    }
+}
index 231a382f53dc63416b8b258daef35b0a3152f065..cb1948d8f92240baeb848c3c1e5f6dd897d139ca 100644 (file)
@@ -5,6 +5,7 @@ module netconf-node-topology {
     import network-topology { prefix nt; revision-date 2013-10-21; }
     import yang-ext { prefix ext; revision-date "2013-07-09";}
     import ietf-inet-types { prefix inet; revision-date "2013-07-15"; }
+    import netconf-node-optional {prefix nno; revision-date "2019-06-14";  }
 
     revision "2015-01-14" {
         description "Initial revision of Topology model";
@@ -335,6 +336,7 @@ module netconf-node-topology {
         uses netconf-node-connection-status;
 
         uses netconf-schema-storage;
+        uses nno:netconf-node-augmented-optional-fields ;
 
     }
 
index 143cc2a3b2a5438c0575e4db1eafc0844c0cf924..207441828b49b9e788fd0071a178cf260a4ebbaf 100644 (file)
@@ -5,6 +5,7 @@ module netconf-node-topology {
     import network-topology { prefix nt; revision-date 2013-10-21; }
     import yang-ext { prefix ext; revision-date "2013-07-09";}
     import ietf-inet-types { prefix inet; revision-date "2013-07-15"; }
+    import netconf-node-optional { prefix nno; revision-date "2019-06-14"; }
 
     revision "2015-01-14" {
         description "Initial revision of Topology model";
@@ -338,6 +339,7 @@ module netconf-node-topology {
         uses netconf-node-connection-status;
 
         uses netconf-schema-storage;
+        uses nno:netconf-node-augmented-optional-fields ;
 
     }
 
index 24d521440b089a539e7740c1ee165c42643ede4b..cb43fe3581f7dc480da1b0f6f7a9d43ab494fe1c 100644 (file)
@@ -76,7 +76,7 @@ public class NetconfDeviceTopologyAdapterTest {
         SCHEMA_CONTEXT = YangParserTestUtils.parseYangResources(NetconfDeviceTopologyAdapterTest.class,
             "/schemas/network-topology@2013-10-21.yang", "/schemas/ietf-inet-types@2013-07-15.yang",
             "/schemas/yang-ext.yang", "/schemas/netconf-node-topology.yang",
-            "/schemas/network-topology-augment-test@2016-08-08.yang");
+            "/schemas/network-topology-augment-test@2016-08-08.yang", "/schemas/netconf-node-optional.yang");
     }
 
     @AfterClass
diff --git a/netconf/sal-netconf-connector/src/test/resources/schemas/netconf-node-optional.yang b/netconf/sal-netconf-connector/src/test/resources/schemas/netconf-node-optional.yang
new file mode 100644 (file)
index 0000000..9ecbe6e
--- /dev/null
@@ -0,0 +1,69 @@
+module netconf-node-optional {
+    namespace "urn:opendaylight:netconf-node-optional";
+    prefix "netnopt";
+
+    import network-topology { prefix nt; revision-date 2013-10-21; }
+    import yang-ext { prefix ext; revision-date "2013-07-09";}
+
+    revision "2019-06-14" {
+        description "Initial revision of Node Optional model";
+    }
+
+    grouping netconf-node-augmented-optional-fields {
+        container ignore-missing-schema-sources {
+            description "Allows mount point to reconnect on the 'missing schema sources' error.
+                WARNING - enabling the reconnection on the 'missing schema sources' error can lead
+                to unexpected errors at runtime.";
+            leaf allowed {
+                type boolean;
+                default false;
+                description "Allows reconnection of the mount point. Default false.";
+            }
+            leaf reconnect-time {
+                type uint32;
+                default 5000;
+                description "Time for reconnection - in units milliseconds. Default 5000 ms.";
+            }
+        }
+    }
+
+    container netconf-node-fields-optional {
+        description "Allows to create node's optional value with the path mapping according to
+            the network-topology -> topology -> node";
+        list topology {
+            key topology-id;
+            leaf topology-id {
+                type nt:topology-id;
+                description "The name of node's topology";
+            }
+            list node {
+                key node-id;
+                leaf node-id {
+                    type nt:node-id;
+                    description "The identifier of a node in the topology";
+                }
+                // Containers allow to create specific data-change-listener directly on a node's optional value.
+                // In the future, it'll be easy to extend the node by optional node fields in this way. Do not create
+                // direct leafs here, please.
+                container datastore-lock {
+                    description "Allows to ignore lock/unlock node's datastare.";
+                    leaf datastore-lock-allowed {
+                        type boolean;
+                        default true;
+                        description "The operation allows the client to lock the entire configuration datastore
+                            system of a device.
+                            WARNING - With blocking the lock/unlock operations, the user is coming to operate
+                            in a manner which is not supported. Concurrent access to the data store may interfere
+                            with data consistency.";
+                    }
+                }
+            }
+        }
+    }
+
+    augment "/nt:network-topology/nt:topology/nt:node/" {
+        when "../../nt:topology-types/topology-netconf";
+        ext:augment-identifier "netconf-node-augmented-optional";
+        uses netconf-node-augmented-optional-fields;
+    }
+}
index 231a382f53dc63416b8b258daef35b0a3152f065..cb1948d8f92240baeb848c3c1e5f6dd897d139ca 100644 (file)
@@ -5,6 +5,7 @@ module netconf-node-topology {
     import network-topology { prefix nt; revision-date 2013-10-21; }
     import yang-ext { prefix ext; revision-date "2013-07-09";}
     import ietf-inet-types { prefix inet; revision-date "2013-07-15"; }
+    import netconf-node-optional {prefix nno; revision-date "2019-06-14";  }
 
     revision "2015-01-14" {
         description "Initial revision of Topology model";
@@ -335,6 +336,7 @@ module netconf-node-topology {
         uses netconf-node-connection-status;
 
         uses netconf-schema-storage;
+        uses nno:netconf-node-augmented-optional-fields ;
 
     }