cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
430
Views
2
Helpful
2
Replies

NSO YANG route-policy List

erikdoesNSO
Level 1
Level 1

I don't see much on this topic figured I would start a thread here:

NSO Version: 5.7.1
NED Version: cisco-iosxr-cli-7.13

I am trying to get a list of route-policy in the YANG model with path. 

What I am trying to do:

                    leaf bgp-route-policy-in {
                        tailf:info "Inbound BGP Route Policy";
                        mandatory true;
                        type leafref {
                            path "/ncs:devices/ncs:device[ncs:name=current()/../../device-name]/ncs:config/iosxr:route-policy";
                        }
                    }
 
What I am trying to avoid doing:

                    leaf bgp-route-policy-out {
                        tailf:info "Outbound BGP Route Policy";
                        mandatory true;
                        type enumeration {
                            enum NO-DEFAULT-ROUTE-POLICY;
                            enum CUST-STATIC;
                            enum PASS_ALL;
                            enum CUST_RIP-IPv6;
                            enum CLIENT-ADDPATH;
                            enum CUST-RIP;
                            enum CUST-STATIC-IPV6;
                            enum IPV6-CUSTOMER-LINKS;
                            enum IS-CUSTOMER-IN;
                            enum IS-CUSTOMER-IN-IPv6;
                            enum IS-FULL-ROUTES;
                            enum IS-FULL-ROUTES-IPv6;
                            enum IS-NO-ROUTES;
                            enum IS-NO-ROUTES-IPv6;
                        }
                    }
 
Error:
yang/cust-l3vpn.yang:280: error: the leafref refers to non-leaf and non-leaf-list node 'route-policy' in module 'tailf-ned-cisco-ios-xr' at ../../cisco-iosxr-cli-7.13/src/ncsc-out/modules/yang/tailf-ned-cisco-ios-xr.yang:84723
 
Here is the section from the NED line: 84723:
    list route-policy {
      tailf:ncs-device-type "cli-ned";
      tailf:display-when "not(../ncs:module) or ../ncs:module[ncs:name='tailf-ned-cisco-ios-xr']";
      when 'not(../tailfned/api/edit-route-policy)' {
        tailf:xpath-root 3;
        tailf:dependency "../tailfned/api/edit-route-policy";
      }
      tailf:info
        "Define a route policy";
      tailf:cli-mode-name "config-rpl";
      tailf:cli-exit-command "end-policy";
      tailf:cli-full-command;
      key "name";
      leaf name {
        tailf:cli-suppress-range;
        type string {
          tailf:info
            "WORD;;Route Policy name";
        }
      }
      leaf value {
        tailf:cli-drop-node-name;
        tailf:cli-disallow-value "end-policy";
        type string {
          tailf:info
            "WORD;;route-policy contents as a single quoted string.";
        }
      }
    }

2 Replies 2

erikdoesNSO
Level 1
Level 1

I think I resolved this:

                    leaf bgp-route-policy-in {
                        tailf:info "Inbound BGP Route Policy";
                        mandatory true;
                        type leafref {
                            path "/ncs:devices/ncs:device[ncs:name=current()/../../device-name]/ncs:config/iosxr:route-policy/iosxr:name";
                        }
                    }
 
It at least compiles now. Further testing needed will Update. 

Hi,
Your path in the leafref needs to refer to the name of the policy. Not the policy list element as a whole.
So just add /iosxr:name to the path.
The leafref must always reference a specific leaf.