netopeer2
netopeer2 copied to clipboard
Leafref validation is not working for Netconf Validate operation
NETCONF Validate operation is returning error "Invalid leafref value" eventhough provided leafref data exists.
- DataModel: openconfig-network-instance.yang
module: openconfig-network-instance
+--rw network-instances
+--rw network-instance* [name]
+--rw name -> ../config/name
+--rw config
| +--rw name? string
+--rw interfaces
| +--rw interface* [id]
| +--rw id -> ../config/id
| +--rw config
| | +--rw id? string
| | +--rw interface? -> /oc-if:interfaces/interface/name
- Payload:
vrfbindc1.xml:
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>Vrf-1</name>
<config>
<name>Vrf-1</name>
</config>
<interfaces>
<interface>
<id>Ethernet4_int</id>
<config>
<id>Ethernet4_int</id>
<interface>Ethernet4</interface> ==> This is leafref to /oc-if:interfaces/interface/name
</config>
</interface>
</interfaces>
</network-instance>
</network-instances>
- Validate operation reported error "Invalid leafref value" even though provided leafref data exists.
> validate --src-config=/home/arpit/sonicp2/xml/xml_validate/vrfbind/vrfbindc1.xml
ERROR
type: application
tag: operation-failed
severity: error
message: Invalid leafref value "Ethernet4" - no target instance "/oc-if:interfaces/oc-if:interface/oc-if:name" with the same value.
- Here Ethernet4 interface exists.
> get-config --source running --filter-xpath /interfaces
DATA
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Ethernet4</name>
<config>
<name>Ethernet4</name>
</config>
</interface>
</interfaces>
</data>