Add binding v2 model for data structures at module top level 03/37003/5
authorVratko Polak <vrpolak@cisco.com>
Fri, 1 Apr 2016 14:53:24 +0000 (16:53 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 20 May 2016 20:39:38 +0000 (20:39 +0000)
Just a Yang file, no actual unit test.

Change-Id: Iebd5e7214989b6527d6d8c764db9ba9edcb87b97
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
binding/mdsal-binding-spec-2/src/test/resources/odl-test-toplevel.yang [new file with mode: 0644]

diff --git a/binding/mdsal-binding-spec-2/src/test/resources/odl-test-toplevel.yang b/binding/mdsal-binding-spec-2/src/test/resources/odl-test-toplevel.yang
new file mode 100644 (file)
index 0000000..7b488ca
--- /dev/null
@@ -0,0 +1,99 @@
+module odl-test-toplevel {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:mdsal:binding2:test:toplevel";
+    prefix "ott";
+
+    description
+        "Testing for various data structures at top level of module.
+        see http://tools.ietf.org/html/rfc6020#section-7.1.1";
+
+    revision "2016-03-31" {
+        description
+            "Initial revision, for ODL Boron.";
+    }
+
+    // TODO: Create model with other non-data structures, such as rpc and notification.
+    // TODO: Test definitions at top level of submodule.
+
+    grouping config-leaf {
+        leaf config-leaf {
+            type string;
+            config true;
+        }
+    }
+
+    grouping state-leaf {
+        leaf state-leaf {
+            type string;
+            config false;
+        }
+    }
+
+    uses state-leaf;  // Top level non-config string leaf named "state-leaf".
+
+    container non-presence-container {
+        uses config-leaf;
+    }
+
+    container presence-container {
+        presence "Container is present.";
+        uses config-leaf;
+    }
+
+    leaf-list ordered-leaflist {
+        ordered-by user;
+        type string;
+    }
+
+    leaf-list unordered-leaflist {
+        ordered-by system;
+        type string;
+    }
+
+    list ordered-keyed-list {
+        ordered-by user;
+        key config-leaf;
+        uses config-leaf;
+    }
+
+    list unordered-keyed-list {
+        ordered-by system;
+        key config-leaf;
+        uses config-leaf;
+    }
+
+    list ordered-unkeyed-list {
+        config false;  // 'The "key" statement, which MUST be present if the list represents configuration'
+        ordered-by user;
+        description
+            "http://tools.ietf.org/html/rfc6020#section-7.7.5
+            says \"This statement is ignored if the list represents state data\",
+            but we are still hoping for some kind of ordering (perhaps from MD-SAL application?)
+            to be preserved.";
+        uses state-leaf;
+    }
+
+    list unordered-unkeyed-list {
+        config false;  // 'The "key" statement, which MUST be present if the list represents configuration'
+        ordered-by system;
+        description
+            "http://tools.ietf.org/html/rfc6020#section-7.7.5
+            says \"This statement is ignored if the list represents state data\",
+            but we are still hoping the system responds with a reasonable ordering.
+
+            http://tools.ietf.org/html/rfc6020#section-7.7.5.1
+            \"An implementation SHOULD use the same order for
+            the same data, regardless of how the data were created.\"";
+        uses state-leaf;
+    }
+
+    choice choice {
+        case case {
+            uses config-leaf;
+        }
+    }
+
+    anyxml anyxml {
+    }
+
+}