cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
458
Views
0
Helpful
1
Replies
bjronmork
Beginner

tailf:link Usage

I am facing issues to use tailf:link. I have one node GigabitEthernet as per below 

leaf GigabitEthernet {
              tailf:info "GigabitEthernet Interface ID";
              mandatory true;
              type leafref {
                path "deref(../../../Switch)/../ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";
              }
            }

 I want data of GigabitEthernet node to be used automatically for other node intf-number...

	leaf intf-number {
              tailf:info "GigabitEthernet Interface ID";
              mandatory true;
              type leafref {
                path "deref(../../../Switch)/../ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";
              }
            }

For example, below is required

 

GigabitEthernet =  0/0/0/0 (Using dropdown of Infterfaces, we select 0/0/0/0)

intf-number = GigabitEthernet (Data in Node GigabitEthernet which is 0/0/0/0 should be assigned to node intf-number automatically)

i tried below code..but its not working. 

leaf intf-number {
 {
tailf:link "/ncs:devices/ncs:device[name=current()/../../../Switch]/ncs:config/cisco-ios-xr:interface/GigabitEthernet[id=current()/cisco-ios-xr:id]";
tailf:info "GigabitEthernet Interface ID"; mandatory true; type leafref { path "deref(../../../Switch)/../ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id"; } }

 

Someone Please guide. Thanks 

Regards,

Bjron Mork

1 REPLY 1
perander
Cisco Employee

What type is cisco-ios-xr:interface? If it's a list, the key needs to be specified.

From tailf_yang_extension(5):

The argument is an XPath absolute location path. If the target lies within lists, all keys must be specified. A key either has a value, or is a reference to a key in the path of the source node, using the function current() as starting point for an
XPath location path. For example:

/a/b[k1='paul'][k2=current()/../k]/c