Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-1176

Restconf deserialization of xpath for instance identifiers fails to handle "/" in string literals

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • None
    • None
    • restconf
    • None
    • Operating System: All
      Platform: All

    • 2766

      Given an instance identifier like:
      "/network-topology:network-topology/network-topology:topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node/network-topology:node[network-topology:node-id='ovsdb://127.0.0.1:16640']"

      Submitted via restconf, restconf fails to properly deserialize it (instead simple writing a null in the field containing that value).

      Some preliminary debugging showed that in controller/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestUtil.java

      what is going wrong is that on line 41 (in method asInstanceIdentifier()):

      final String[] xPathParts = valueTrimmed.split("/");

      This results in splitting the xpath expression mid-predicate: because the predicate:[network-topology:node-id='ovsdb://127.0.0.1:16640']

      contains a number of "/" characters within the literal 'ovsdb://127.0.0.1:16640' it contains.

      Looking at the XPath BNF:

      http://www.w3.org/2002/11/xquery-xpath-applets/xpath-bnf.html

      It appears that it is valid to have a "/" within a literal (which in this case it is.

      Please fix the parsing to correctly handle string literals.

            tony.tkacik@gmail.com Tony Tkacik
            hagbard Ed Warnicke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: