Skip to content

Must-statements #349

@hansthienpondt

Description

@hansthienpondt

When evaluating must statements for arista models, a couple of errors are returned by either leafref lookups of must statment validation

missing leaf reference: failed resolving leafref ../../../../tables/table[protocol=current()/../src-protocol]/config/address-family for /network-instances/network-instance[name=VRF_B]/table-connections/table-connection[address-family=openconfig-policy-types:DIRECTLY_CONNECTED][dst-protocol=openconfig-policy-types:BGP][src-protocol=openconfig-types:IPV4]/config/address-family: navigating tree, reached /network-instances/network-instance[name=VRF_B]/tables/table[protocol=openconfig-types:IPV4] but child config does not exist, trying to load defaults yielded error trying to load defaults for config: elem:{name:"config"}: key not found
missing leaf reference: failed resolving leafref ../../../../tables/table[protocol=current()/../src-protocol]/config/address-family for /network-instances/network-instance[name=VRF_A]/table-connections/table-connection[address-family=openconfig-policy-types:DIRECTLY_CONNECTED][dst-protocol=openconfig-policy-types:BGP][src-protocol=openconfig-types:IPV6]/config/address-family: navigating tree, reached /network-instances/network-instance[name=VRF_A]/tables/table[protocol=openconfig-types:IPV4] but child config does not exist, trying to load defaults yielded error trying to load defaults for config: elem:{name:"config"}: key not found
missing leaf reference: failed resolving leafref ../../../../tables/table[protocol=current()/../src-protocol]/config/address-family for /network-instances/network-instance[name=VRF_A]/table-connections/table-connection[address-family=openconfig-policy-types:DIRECTLY_CONNECTED][dst-protocol=openconfig-policy-types:BGP][src-protocol=openconfig-types:IPV4]/config/address-family: navigating tree, reached /network-instances/network-instance[name=VRF_A]/tables/table[protocol=openconfig-types:IPV4] but child config does not exist, trying to load defaults yielded error trying to load defaults for config: elem:{name:"config"}: key not found
missing leaf reference: failed resolving leafref ../../../../tables/table[protocol=current()/../src-protocol]/config/address-family for /network-instances/network-instance[name=VRF_SPIRENT]/table-connections/table-connection[address-family=openconfig-policy-types:DIRECTLY_CONNECTED][dst-protocol=openconfig-policy-types:BGP][src-protocol=openconfig-types:IPV6]/config/address-family: navigating tree, reached /network-instances/network-instance[name=VRF_SPIRENT]/tables/table[protocol=openconfig-types:IPV4] but child config does not exist, trying to load defaults yielded error trying to load defaults for config: elem:{name:"config"}: key not found
missing leaf reference: failed resolving leafref ../../../../tables/table[protocol=current()/../src-protocol]/config/address-family for /network-instances/network-instance[name=VRF_SPIRENT]/table-connections/table-connection[address-family=openconfig-policy-types:DIRECTLY_CONNECTED][dst-protocol=openconfig-policy-types:BGP][src-protocol=openconfig-types:IPV4]/config/address-family: navigating tree, reached /network-instances/network-instance[name=VRF_SPIRENT]/tables/table[protocol=openconfig-types:IPV4] but child config does not exist, trying to load defaults yielded error trying to load defaults for config: elem:{name:"config"}: key not found
missing leaf reference: failed resolving leafref ../../../../tables/table[protocol=current()/../src-protocol]/config/address-family for /network-instances/network-instance[name=VRF_B]/table-connections/table-connection[address-family=openconfig-policy-types:DIRECTLY_CONNECTED][dst-protocol=openconfig-policy-types:BGP][src-protocol=openconfig-types:IPV6]/config/address-family: navigating tree, reached /network-instances/network-instance[name=VRF_B]/tables/table[protocol=openconfig-types:IPV6] but child config does not exist, trying to load defaults yielded error trying to load defaults for config: elem:{name:"config"}: key not found

and

error path: /network-instances/network-instance[name=default]/protocols/protocol[identifier=openconfig-policy-types:BGP][name=BGP]/bgp/neighbors/neighbor[neighbor-address=10.199.248.251]/config/peer-group, must-statement [../peer-group = /network-instances/network-instance[name='default']/protocols/protocol[name='BGP'][identifier='oc-pol-types:BGP']/bgp/peer-groups/peer-group/config/peer-group-name] peer-groups should be shared with the default network-instance
error path: /network-instances/network-instance[name=default]/protocols/protocol[identifier=openconfig-policy-types:BGP][name=BGP]/bgp/neighbors/neighbor[neighbor-address=10.199.248.250]/config/peer-group, must-statement [../peer-group = /network-instances/network-instance[name='default']/protocols/protocol[name='BGP'][identifier='oc-pol-types:BGP']/bgp/peer-groups/peer-group/config/peer-group-name] peer-groups should be shared with the default network-instance

For lookups in the Tree, it uses the prefix which is defined in the various yang files, which is local to the yang file.

  import openconfig-policy-types {
    prefix oc-pol-types;
  }

however this prefix can be anything defined locally. However this does not match tree lookups (pathElemName) which hold the module name openconfig-policy-types prefix. We need to look into resolving this prefix at yang parsing, or ignoring the prefix value in Tree lookups in key values (and potentially later match again against the prefix in the actual value).

before we implement potential fixes, we need to confirm if this behaviour is in fact the way the RFC stipulates it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions