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

restconf to netconf translation doesn't honor the order of the keys for lists with multiple keys

XMLWordPrintable

      Yang snippet of my device:

      module ibn { 
        namespace "http://www.nokia.com/management-solutions/ibn";
        prefix "ibn";
        import ietf-yang-types { prefix yang; }
        import ibn-administration { prefix ibn-administration; }
      
        organization "Nokia";
        revision "2017-11-28" {
      
          description "Initial version.";
          reference "ibn";
        }
       
        container ibn {
          list intent {
            key "target intent-type";
            leaf target {
              type string {
                length "1..300";
              }
              mandatory true;
              description "Uniquely identifies an intent within an intent-type";
            }
            leaf intent-type {
              type leafref {
                path "/ibn-administration:ibn-administration/ibn-administration:intent-type-catalog"
                   + "/ibn-administration:intent-type/ibn-administration:name";
              }
              mandatory true;
              description "Name of the intent type";
            }
      [...] 
      

       

      So we have a list of intents with two keys.

       

      When I create an entity through the ODL restconf API I pass the following body:

      {
        "intent":
        {
          "target": "test4",
          "intent-type": "sddpu-cfas-h-infra",
          "configuration": {
            "sddpu-cfas-h-infra:sddpu-cfas-h-infra": {
            "mcast-network-vlan": 1002
          }
        },
        "sync-directly": false,
        "intent-type-version" : 1
        }
      }

       

      However what comes out is:

       

      <rpc message-id="m-19" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
       <target>
       <running/>
       </target>
       <error-option>rollback-on-error</error-option>
       <config>
       <ibn xmlns="http://www.nokia.com/management-solutions/ibn">
       <intent xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0" a:operation="replace">
       <intent-type>sddpu-cfas-h-infra</intent-type>
       <target>test4</target>
       <sync-directly>false</sync-directly>
       <configuration>
       <sddpu-cfas-h-infra xmlns="http://www.nokia.com/management-solutions/sddpu-cfas-h-infra">
       <mcast-network-vlan>1002</mcast-network-vlan>
       </sddpu-cfas-h-infra>
       </configuration>
       <intent-type-version>1</intent-type-version>
       </intent>
       </ibn>
       </config>
       </edit-config>
       </rpc>
       , response: <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-19">
       <rpc-error>
       <error-type>application</error-type>
       <error-tag>missing-element</error-tag>
       <error-severity>error</error-severity>
       <error-path xmlns:ibn="http://www.nokia.com/management-solutions/ibn">/ibn:ibn/ibn:intent[ibn:intent-type='sddpu-cfas-h-infra'][ibn:target='test4']</error-path>
       <error-message>Expected list key(s) [target, intent-type] is not placed in the proper location in the message</error-message>
       <error-info>
       <bad-element>target</bad-element>
       <bad-element>intent-type</bad-element>
       </error-info>
       </rpc-error>
       </rpc-reply>

       

      So the keys are swapped

       

            svanhoof Steven Van Hoof
            svanhoof Steven Van Hoof
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: