Fix context-reference test 60/95960/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 28 Apr 2021 17:33:08 +0000 (19:33 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 28 Apr 2021 17:33:50 +0000 (19:33 +0200)
The test relies on overly-broad definition of context reference, but we
should only be binding to yang-ext. Fix that.

Change-Id: I43d6beecf2af50f275408fb103b60fbe4633dbee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/context-reference/foo.yang
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/context-reference/yang-ext.yang [new file with mode: 0644]

index 07cbb1eb2eedcc78b1d43c78241cb21ae07ee4b0..1607081fb736586611d5324c0fd2b4ced313ed84 100644 (file)
@@ -11,18 +11,15 @@ module foo {
     prefix "f";
 
     import bar { prefix "b"; }
+    import yang-ext { prefix ext; }
 
     revision "2013-10-08" {
     }
 
-    extension context-reference {
-        argument "context-type";
-    }
-
     container nodes {
         leaf id {
             type instance-identifier;
-            f:context-reference "b:identity-class";
+            ext:context-reference "b:identity-class";
         }
         leaf-list constraints {
             type string;
diff --git a/binding/mdsal-binding-java-api-generator/src/test/resources/compilation/context-reference/yang-ext.yang b/binding/mdsal-binding-java-api-generator/src/test/resources/compilation/context-reference/yang-ext.yang
new file mode 100644 (file)
index 0000000..2d89e61
--- /dev/null
@@ -0,0 +1,80 @@
+module yang-ext {
+    yang-version 1;
+    namespace "urn:opendaylight:yang:extension:yang-ext";
+    prefix "ext";
+
+    contact "Anton Tkacik <ttkacik@cisco.com>";
+
+    description
+            "Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+            This program and the accompanying materials are made available under the
+            terms of the Eclipse Public License v1.0 which accompanies this distribution,
+            and is available at http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-07-09" {
+        description "";
+    }
+
+    // Augmentation name
+
+    extension "augment-identifier" {
+        description
+           "YANG language extension which assigns an identifier to
+            augmentation. Augment identifier is used to identify
+            specific augment statement by name.
+
+            The identifier syntax is defined formally defined by the rule
+            'identifier' in Section 12 of RFC 6020.
+
+            All augment identifiers defined in a namespace MUST be unique.
+            The namespace of augment identifiers is shared by module and
+            its submodules.";
+
+            /*
+                Discussion:
+                This extension allows for ease of development / debug
+                of YANG modules and it is suitable for code generation,
+                where each augment statement is nicely identified by
+                unique name instead of combination of augment target
+                and when condition.
+            */
+        argument "identifier";
+    }
+
+
+    // Context-aware RPCs
+
+    grouping rpc-context-ref {
+        description
+           "A reference to RPC context.";
+        leaf context-instance {
+            type instance-identifier;
+            description "Pointer to the context. ";
+            mandatory true;
+        }
+    }
+
+    extension "rpc-context-instance" {
+        description
+           "YANG language extension which defines enclosing (parent)
+            schema node as referencable context for RPCs.
+
+            The argument is identity which is used to identify RPC context
+            type.";
+
+        argument "context-type";
+    }
+
+    extension "context-reference" {
+        argument "context-type";
+    }
+
+    extension "context-instance" {
+        argument "context-type";
+    }
+
+    extension "instance-target" {
+        argument "path";
+    }
+}