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

Improve error reporting when controller-config mount operation fails

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • netconf
    • None
    • Operating System: All
      Platform: All

    • 3822
    • High

    Description

      After a new netconf connector config is POSTED, you can't update it via restconf (nor DELETE or GET). With POST you get "data already exists", which makes sense since POST is create-if-not-exists (although this erroneously worked in Helium).

      PUT with, eg, the following URL:

      http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/new-netconf-device

      should work but fails with error:

      "odl-sal-netconf-connector-cfg:sal-netconf-connector from URI can't be resolved. For key which is of type identityref it should be in format module_name:identity_name."

      Clearly "odl-sal-netconf-connector-cfg:sal-netconf-connector" is in the correct format.

      The problem is in RestCodec.ObjectCodec#deserialize:

      if (type instanceof IdentityrefTypeDefinition) {
      if (input instanceof IdentityValuesDTO)

      { return identityrefCodec.deserialize(maybeIdentityref); }

      logger.debug("Value is not instance of IdentityrefTypeDefinition but is {}. Therefore NULL is used as translation of - {}",
      input == null ? "null" : input.getClass(), String.valueOf(input));
      return null;
      }

      It expects the 'input' value to be of type IdentityValuesDTO but it's a String. In fact the calling code in ControllerContext#addKeyValue specifically treats the value as a String. So there's a disconnect between ControllerContext and RestCodec.ObjectCodec. I'm not sure what the intent is here, ie who is supposed to parse the identityref string into an IdentityValuesDTO instance.

      I locally changed ObjectCodec#deserialize to check for instanceof String and parse into an IdentityValuesDTO. This fixed the problem.

      Note: with this bug no config module can be updated via restconf, including OOB ones.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpantelis Tom Pantelis
            tpantelis Tom Pantelis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: