Hello,
I've been using Netconf for L3VPN services quite extensively and everything's fine but data structure for import RTs. Examine fragment of XML file retrieved from IOS XR 6.1.2:
<vrfs xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-rsi-cfg">
<vrf>
<vrf-name>XXX</vrf-name>
<create/>
<afs>
<af>
<af-name>ipv4</af-name>
<saf-name>unicast</saf-name>
<topology-name>default</topology-name>
<create/>
<bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-cfg">
<import-route-targets>
<route-targets>
<route-target>
<type>as</type>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>10500</as>
<as-index>1</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>20500</as>
<as-index>2</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
</route-target>
</route-targets>
</import-route-targets>
<export-route-targets>
<route-targets>
<route-target>
<type>as</type>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>30500</as>
<as-index>3</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
</route-target>
<route-target>
<type>four-byte-as</type>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>100500</as>
<as-index>1</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
</route-target>
</route-targets>
</export-route-targets>
</bgp>
</af>
</afs>
</vrf>
</vrfsTake a look specifically at this fragment:
<export-route-targets>
<route-targets>
<route-target>
<type>as</type>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>30500</as>
<as-index>3</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
</route-target>
<route-target>
<type>four-byte-as</type>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>100500</as>
<as-index>1</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
</route-target>
</route-targets>
</export-route-targets>One can see here two route-target elements for each of the route targets. This is going to be as follows in the CLI:
vrf XXX
address-family ipv4 unicast
export route-target
30500:3
100500:1
Which is perfectly fine from my perspective. Though for import RT:
<import-route-targets>
<route-targets>
<route-target>
<type>as</type>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>10500</as>
<as-index>1</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
<as-or-four-byte-as>
<as-xx>0</as-xx>
<as>20500</as>
<as-index>2</as-index>
<stitching-rt>0</stitching-rt>
</as-or-four-byte-as>
</route-target>
</route-targets>
</import-route-targets>One can see than for some reason RTs are separated using as-or-four-byte-as inside of singe route-target element. Though configuration in the CLI is essentially the same:
vrf XXX
address-family ipv4 unicast
import route-target
10500:1
20500:2
The actual problem arises when parsing XML file programmatically: it's not very convenient to use one tree in order to obtain export RT, and another one to obtain import ones. Any thoughts on that?