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

Error parsing namespace when using YANG PATCH with absolute target path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • 2.0.13
    • None
    • restconf-nb
    • Operating System: All
      Platform: All

    • 7949

      When we try to create and merge with an absolute target path, it works well.
      The namespace can be solved based on the value of the operation.
      Request as below:
      Request as below:
      PATCH http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/iosxrv-7/yang-ext:mount/
      Payload as below:
      <yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
      <patch-id>VPN-CREATION-1</patch-id>
      <comment>Create VPN-1</comment>
      <edit>
      <edit-id>1</edit-id>
      <operation>create</operation>
      <target>/Cisco-IOS-XR-infra-rsi-cfg:vrfs/vrf</target>
      <value>
      <vrf xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-rsi-cfg">
      <vrf-name>vpn-78</vrf-name>
      <create></create>
      <afs>
      <af>
      <af-name>ipv6</af-name>
      <saf-name>unicast</saf-name>
      <topology-name>default</topology-name>
      <create></create>
      </af>
      <af>
      <af-name>ipv4</af-name>
      <saf-name>unicast</saf-name>
      <topology-name>default</topology-name>
      <create></create>
      <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-cfg">
      <import-route-targets>
      <route-targets>
      <route-target>
      <type>as</type>
      <as-or-four-byte-as>
      <as-xx>0</as-xx>
      <as>4804</as>
      <as-index>1</as-index>
      <stitching-rt>0</stitching-rt>
      </as-or-four-byte-as>
      </route-target>
      </route-targets>
      </import-route-targets>
      <export-route-targets>
      <route-targets>
      <route-target>
      <type>as</type>
      <as-or-four-byte-as>
      <as-xx>0</as-xx>
      <as>4804</as>
      <as-index>1</as-index>
      <stitching-rt>0</stitching-rt>
      </as-or-four-byte-as>
      </route-target>
      </route-targets>
      </export-route-targets>
      </bgp>
      </af>
      </afs>
      <description>vrf for VPN which connects each site from iosxrv-7 and iosxrv-8</description>
      <vpn-id>
      <vpn-oui>4804</vpn-oui>
      <vpn-index>1</vpn-index>
      </vpn-id>
      </vrf>
      </value>
      </edit>
      <edit>
      <edit-id>2</edit-id>
      <operation>create</operation>
      <target>/Cisco-IOS-XR-ifmgr-cfg:interface-configurations/interface-configuration</target>
      <value>
      <interface-configuration xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
      <active>act</active>
      <interface-name>Loopback1</interface-name>
      <interface-virtual></interface-virtual>
      <ipv4-network xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-io-cfg">
      <addresses>
      <primary>
      <address>7.7.7.7</address>
      <netmask>255.255.255.255</netmask>
      </primary>
      </addresses>
      </ipv4-network>
      <vrf xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-rsi-cfg">vpn-78</vrf>
      </interface-configuration>
      </value>
      </edit>
      <edit>
      <edit-id>3</edit-id>
      <operation>merge</operation>
      <target>/Cisco-IOS-XR-ipv4-bgp-cfg:bgp/instance/default/instance-as/0/four-byte-as/4804/vrfs/vrf</target>
      <value>
      <vrf xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-cfg">
      <vrf-name>vpn-78</vrf-name>
      <vrf-global>
      <route-distinguisher>
      <as-xx>0</as-xx>
      <as>4804</as>
      <type>as</type>
      <as-index>1</as-index>
      </route-distinguisher>
      <exists></exists>
      <vrf-global-afs>
      <vrf-global-af>
      <af-name>ipv4-unicast</af-name>
      <enable></enable>
      <connected-routes></connected-routes>
      <static-routes></static-routes>
      </vrf-global-af>
      </vrf-global-afs>
      </vrf-global>
      </vrf>
      </value>
      </edit>
      </yang-patch>

      However, when we try to delete or remove with an absolute target path, restconf returns an error of 400. Message is "Error parsing input: null".
      Request as below:
      PATCH http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/iosxrv-7/yang-ext:mount/
      Payload as below:
      <yang-patch xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">
      <patch-id>VPN-DELETION-1</patch-id>
      <comment>Delete VPN-1</comment>
      <edit>
      <edit-id>1</edit-id>
      <operation>remove</operation>
      <target>/Cisco-IOS-XR-ipv4-bgp-cfg:bgp/instance/default/instance-as/0/four-byte-as/4804/vrfs/vrf/vpn-78</target>
      </edit>
      </yang-patch>

      According to my inspection, it can be located to org.opendaylight.netconf.sal.rest.impl.XmlToPATCHBodyReader:147-154
      The namespace is resolved to "netconf:base:1.0" because the request URI is root and there is no value can be used to resolve the namespace.

            SamoSchneider Samuel Schneider
            huwenbo1988@gmail.com Wenbo Hu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: