07-28-2020 11:35 AM
This is a L2VPN service for IOS-XR. The YANG compiles just fine, but when I reload packages I get this error:
Error: Internal error: {failed,
{invalid_xpath,
"/ncs:devices/ncs:device[ncs:name=current()/../device]/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:Loopback[cisco-ios-xr:id='1']/cisco-ios-xr:ipv4/cisco-ios-xr:address/cisco-ios-xr:ip",
[neighbor_ip,link,orloVpn],
{callback,cs_xpath,
{no_mount_id_found,
[config,
{{'$KEY',1,1}},
device,
['http://tail-f.com/ns/ncs'|devices]]}}}}
The error is coming from a line where I'm trying to get the remote end IP "neighbor_ip"
module orloVpn {
namespace "http://example.com/orloVpn";
prefix orloVpn;
import ietf-inet-types {
prefix inet;
}
import tailf-common {
prefix tailf;
}
import tailf-ncs {
prefix ncs;
}
import tailf-ned-cisco-ios-xr {
prefix cisco-ios-xr;
}
description
"This service creates L2VPNs across the Optical Routing and Orchestration Lab - V1";
revision 2016-01-01 {
description
"Initial revision. v1";
}
// Global service information
list orloVpn {
description "This is an RFS skeleton service";
key name;
unique pwID;
uses ncs:service-data;
ncs:servicepoint orloVpn-servicepoint;
leaf name {
tailf:info "Service instance name / Customer name";
tailf:cli-allow-range;
mandatory true;
type string;
}
leaf pwID {
tailf:info "Unique Pseudowire ID";
mandatory true;
type uint32 {
range "1..4294967295";
}
}
leaf vlanID {
tailf:info "Select a VLAN ID, this will be the same at both ends of the circuit (number from 1 to 1000)";
mandatory true;
type int32 {
range "1..1000";
}
}
leaf transportMode {
tailf:info "Select the tranport encapsulation";
mandatory true;
type enumeration {
enum "l2transport";
}
}
// This section creates a list with two elements (link 1 and link 2) describing the service at either end of the circuit
list link {
tailf:info "Service parms for each end of the circuit. NOTE: This service assumes both ends are ASR9Ks";
min-elements 2;
max-elements 2;
key device;
leaf device {
tailf:info "Pick a device for this end of the circuit";
mandatory true;
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
}
leaf gigEPort {
tailf:info "Select the client side port";
mandatory true;
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../device]/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";
}
}
leaf bridgeGroupName {
tailf:info "Input the L2VPN bridge group for the service";
mandatory true;
type string;
}
leaf bridgeDomainName {
tailf:info "Input a name to apply to the Bridge Group and the VFI";
mandatory true;
type string;
}
leaf neighbor_ip {
mandatory true;
type inet:ipv4-address;
tailf:link
"/ncs:devices/ncs:device[ncs:name=current()/../device]/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:Loopback[cisco-ios-xr:id='1']/cisco-ios-xr:ipv4/cisco-ios-xr:address/cisco-ios-xr:ip";
}
}
}
}<config-template xmlns="http://tail-f.com/ns/config/1.0"
servicepoint="orloVpn-servicepoint">
<devices xmlns="http://tail-f.com/ns/ncs">
<!-- This is the A End of the Circuit -->
<device>
<name>{/link[1]/device}</name>
<config>
<interface xmlns="http://tail-f.com/ned/cisco-ios-xr">
<GigabitEthernet-subinterface>
<GigabitEthernet>
<id>{/link[1]/gigEPort}.{/vlanID}</id>
<mode>{/transportMode}</mode>
<encapsulation>
<dot1q>
<vlan-id>{/vlanID}</vlan-id>
</dot1q>
</encapsulation>
</GigabitEthernet>
</GigabitEthernet-subinterface>
</interface>
<l2vpn xmlns="http://tail-f.com/ned/cisco-ios-xr">
<bridge>
<group>
<group-name>{/bridgeGroupName}</group-name>
<bridge-domain>
<bridge-domain-name>{/bridgeDomainName}</bridge-domain-name>
<interface>
<name>GigabitEthernet{/link[1]/gigEPort}.{/vlanID}</name>
</interface>
<vfi>
<name>{/bridgeDomainName}</name>
<neighbor>
<address>{/link[2]/*/neighbor_ip}</address>
<pw-id>{/pwID}</pw-id>
</neighbor>
</vfi>
</bridge-domain>
</group>
</bridge>
</l2vpn>
</config>
</device>
<!-- This is the Z End of the Circuit -->
<device>
<name>{/link[2]/device}</name>
<config>
<interface xmlns="http://tail-f.com/ned/cisco-ios-xr">
<GigabitEthernet-subinterface>
<GigabitEthernet>
<id>{/link[2]/gigEPort}.{/vlanID}</id>
<mode>{/transportMode}</mode>
<encapsulation>
<dot1q>
<vlan-id>{/vlanID}</vlan-id>
</dot1q>
</encapsulation>
</GigabitEthernet>
</GigabitEthernet-subinterface>
</interface>
<l2vpn xmlns="http://tail-f.com/ned/cisco-ios-xr">
<bridge>
<group>
<group-name>{/bridgeGroupName}</group-name>
<bridge-domain>
<bridge-domain-name>{/bridgeDomainName}</bridge-domain-name>
<interface>
<name>GigabitEthernet{/link[2]/gigEPort}.{/vlanID}</name>
</interface>
<vfi>
<name>{/bridgeDomainName}</name>
<neighbor>
<address>{/link[1]/*/neighbor_ip}</address>
<pw-id>{/pwID}</pw-id>
</neighbor>
</vfi>
</bridge-domain>
</group>
</bridge>
</l2vpn>
</config>
</device>
</devices>
</config-template>
07-31-2020 08:27 AM
So, I think the node "/devices/device/[my device]/interface/Loopback/1/ipv4/address/ip" doesn't render in xpath. It looks like the furthest down you can retrieve is loopback 1/iipv4/address
admin@ncs(config)# show full-configuration devices device ASR9001A config cisco-ios-xr:interface Loopback 1 ipv4 address | display xpath
/devices/device[name='ASR9001A']/config/cisco-ios-xr:interface/Loopback[id='1']/ipv4/address/ip 10.0.0.1
/devices/device[name='ASR9001A']/config/cisco-ios-xr:interface/Loopback[id='1']/ipv4/address/mask 255.255.255.255
It returns a tuple (/ipv4/address/ip and /ipv4/address/mask)
My goal is to do a link to just the ipv4/address/ip leaf
So... can I do that or am I forced to make it a manual input (i.e. user input for ipv4 address)
Thanks
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide