Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-747

Unable execute YANG patch request when targeting augmented element

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • 3.0.9, 4.0.6, 5.0.3
    • Magnesium SR2, 1.13.0, Aluminium SR1, 3.0.8, 4.0.5, 5.0.2
    • None

      Error 500 is returned when executing yang-patch request that targets augmented element.

      Tested on master and stable/magnesium branch with simulated netconf device.

      Tested models look like this (full models in attachments):

        container container-root {
          ...
          container container-lvl1 {
            ...
          }
        }
      
        augment /tm:container-root/tm:container-lvl1 {
          container container-aug {
            leaf leaf-aug {
              type string;
            }
            ...
          }
        }
      

      YANG patch request:

      {
          "ietf-yang-patch:yang-patch": {
              "patch-id": "test-patch",
              "comment": "comment",
              "edit": [
                  {
                      "edit-id": "edit1",
                      "operation": "replace",
                      "target": "/test-model:container-root/test-model:container-lvl1/test-model-aug:container-aug",
                      "value": {
                          "container-aug": {
                              "leaf-aug": "data"
                          }
                      }
                  }
              ]
          }
      }
      

      Exception from logs on master branch (full logs in attachments):

      14:27:21.286 WARN [qtp910831865-121] /rests/data/network-topology:network-topology/topology=topology-netconf/node=device/yang-ext:mount
      javax.servlet.ServletException: javax.servlet.ServletException: java.lang.IllegalArgumentException: Could not find schema for node (test-ns-aug)container-aug in container container-aug
      	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:90) ~[?:?]
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.28.v20200408]
      	at org.eclipse.jetty.server.Server.handle(Server.java:500) ~[bundleFile:9.4.28.v20200408]
      	...
      Caused by: javax.servlet.ServletException: java.lang.IllegalArgumentException: Could not find schema for node (test-ns-aug)container-aug in container container-aug
      	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:432) ~[?:?]
      	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370) ~[?:?]
      	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389) ~[?:?]
          ...
      Caused by: java.lang.IllegalArgumentException: Could not find schema for node (test-ns-aug)container-aug in container container-aug
      	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:441) ~[?:?]
      	at org.opendaylight.yangtools.yang.data.impl.codec.SchemaTracker.getSchema(SchemaTracker.java:153) ~[?:?]
      	at org.opendaylight.yangtools.yang.data.impl.codec.SchemaTracker.startContainerNode(SchemaTracker.java:233) ~[?:?]
          ...
      

      Targeting `leaf-aug` directly (one layer lower) works OK:

                      "target": "/test-model:container-root/test-model:container-lvl1/test-model-aug:container-aug/test-model-aug:leaf-aug",
                      "value": {
                          "leaf-aug": "data"
                      }
      

      And targeting `container-lvl1` that's being augmented (one level higher) works too:

                      "target": "/test-model:container-root/test-model:container-lvl1",
                      "value": {
                          "container-lvl1": {
                              "container-aug": {
                                  "leaf-aug": "data"
                              }
                          }
                      }
      

        1. [NETCONF-747] Steps to reproduce.odt
          15 kB
        2. log.txt
          35 kB
        3. test-model.yang
          0.4 kB
        4. test-model-aug.yang
          0.5 kB

            ojo Oleksandr Zharov
            samuel.kontris Samuel Kontris
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: