frr defaults traditional
-!
+
hostname r1
password zebra
log stdout notifications
log monitor notifications
log commands
+
+log file /tmp/topotests/bgp_l3vpn_to_bgp_vrf.test_bgp_l3vpn_to_bgp_vrf/r1-bgpd.log debugging
+
+debug bgp vpn leak-to-vrf
+debug bgp vpn leak-from-vrf
+debug bgp vpn label
+
router bgp 5226
bgp router-id 1.1.1.1
bgp cluster-id 1.1.1.1
neighbor 2.2.2.2 remote-as 5226
neighbor 2.2.2.2 update-source 1.1.1.1
-!
+
address-family ipv4 unicast
no neighbor 2.2.2.2 activate
exit-address-family
-!
+
address-family ipv4 vpn
neighbor 2.2.2.2 activate
exit-address-family
-!
-#wait for new syntax
-# vrf-policy r1-cust1
-# label 101
-# rd 10:1
-# rt both 52:100
-# !nexthop 192.168.1.1
-# exit-vrf-policy
-!
- !vnc export bgp mode group-nve
- !vnc export bgp group-nve group r1-cust1
- !vnc redistribute mode resolve-nve
- !vnc redistribute ipv4 bgp-direct
+
router bgp 5227 vrf r1-cust1
+
bgp router-id 192.168.1.1
+
neighbor 192.168.1.2 remote-as 5227
neighbor 192.168.1.2 update-source 192.168.1.1
- ! neighbor 192.168.1.2 route-reflector-client
+
+ vpn-policy ipv4
+ label 101
+ rd 10:1
+ rt both 52:100
+ ! nexthop 192.168.1.1
+ exit
+
address-family ipv4 unicast
-# redistribute vnc-direct
neighbor 192.168.1.2 activate
neighbor 192.168.1.2 next-hop-self
+
+ redistribute vpn
+ export vpn
exit-address-family
+
+
!
end
log stdout notifications
log monitor notifications
log commands
+log file /tmp/topotests/bgp_l3vpn_to_bgp_vrf.test_bgp_l3vpn_to_bgp_vrf/r2-bgpd.log debugging
+
router bgp 5226
bgp router-id 2.2.2.2
bgp cluster-id 2.2.2.2
frr defaults traditional
-!
+
hostname r3
password zebra
log stdout notifications
log monitor notifications
log commands
+debug bgp vpn label
+
router bgp 5226
bgp router-id 3.3.3.3
bgp cluster-id 3.3.3.3
neighbor 2.2.2.2 remote-as 5226
neighbor 2.2.2.2 update-source 3.3.3.3
-!
+
address-family ipv4 unicast
no neighbor 2.2.2.2 activate
exit-address-family
-!
+
address-family ipv4 vpn
neighbor 2.2.2.2 activate
exit-address-family
-!
-#wait for new syntax
-# vrf-policy r3-cust1
-# label 103
-# rd 10:3
-# rt both 52:100
-#! nexthop 192.168.1.1
-# exit-vrf-policy
-!
-! vnc export bgp mode group-nve
-! vnc export bgp group-nve group r3-cust1
-! vnc redistribute mode resolve-nve
-! vnc redistribute ipv4 bgp-direct
-!
+
router bgp 5227 vrf r3-cust1
+
bgp router-id 192.168.1.1
+
neighbor 192.168.1.2 remote-as 5227
neighbor 192.168.1.2 update-source 192.168.1.1
-! neighbor 192.168.1.2 route-reflector-client
+
+ vpn-policy ipv4
+ label 103
+ rd 10:3
+ rt both 52:100
+ exit
+
address-family ipv4 unicast
-# redistribute vnc-direct
neighbor 192.168.1.2 activate
neighbor 192.168.1.2 next-hop-self
+
+ redistribute vpn
+ export vpn
exit-address-family
-!
-end
\ No newline at end of file
+
+
+end
log stdout notifications
log monitor notifications
log commands
+
+debug bgp vpn label
+
router bgp 5226
bgp router-id 4.4.4.4
bgp cluster-id 4.4.4.4
address-family ipv4 unicast
no neighbor 2.2.2.2 activate
exit-address-family
+
address-family ipv4 vpn
neighbor 2.2.2.2 activate
exit-address-family
+
+
+
!
#wait for new syntax
# vrf-policy r4-cust1
# rt both 52:100
#! nexthop 192.168.2.1
# exit-vrf-policy
-!
-! vnc export bgp mode group-nve
-! vnc export bgp group-nve group r4-cust2
-! vnc redistribute mode resolve-nve
-! vnc redistribute ipv4 bgp-direct
-!
+
+
router bgp 5227 vrf r4-cust1
+
bgp router-id 192.168.1.1
+
neighbor 192.168.1.2 remote-as 5227
neighbor 192.168.1.2 update-source 192.168.1.1
-! neighbor 192.168.1.2 route-reflector-client
+
+ vpn-policy ipv4
+ label 1041
+ rd 10:4
+ rt both 52:100
+ ! nexthop 192.168.1.1
+ exit
+
address-family ipv4 unicast
-# redistribute vnc-direct
neighbor 192.168.1.2 activate
neighbor 192.168.1.2 next-hop-self
+
+ redistribute vpn
+ export vpn
exit-address-family
!
router bgp 5228 vrf r4-cust2
+
bgp router-id 192.168.2.1
+
neighbor 192.168.2.2 remote-as 5228
neighbor 192.168.2.2 update-source 192.168.2.1
-! neighbor 192.168.2.2 route-reflector-client
+
+ vpn-policy ipv4
+ label 1042
+ rd 10:4
+ #note RT same as r4-cust1 for inter-vrf route leaking (???)
+ rt both 52:100
+ ! nexthop 192.168.1.1
+ exit
+
address-family ipv4 unicast
-# redistribute vnc-direct
neighbor 192.168.2.2 activate
neighbor 192.168.2.2 next-hop-self
+
+ redistribute vpn
+ export vpn
exit-address-family
!
end
luCommand('ce1','ip route add default via 192.168.1.1')
luCommand('r1','ip route add 99.0.0.1 vrf r1-cust1 dev r1-eth4 via 192.168.1.2')
luCommand('r4','ip route add 99.0.0.4 vrf r4-cust2 dev r4-eth5 via 192.168.2.2')
- luCommand('r1','ip -M route add 101 dev r1-cust1')
- luCommand('r4','ip -M route add 104 dev r4-cust2')
- luCommand('r1','ip route add 99.0.0.4/32 vrf r1-cust1 nexthop encap mpls %s/104 via 10.0.1.2 dev r1-eth0'%label4r4)
- luCommand('r4','ip route add 99.0.0.1/32 vrf r4-cust2 nexthop encap mpls %s/101 via 10.0.2.2 dev r4-eth0'%label4r1)
+
+
+# luCommand('r1','ip -M route add 101 dev r1-cust1')
+# luCommand('r4','ip -M route add 104 dev r4-cust2')
+
+# luCommand('r1','ip route add 99.0.0.4/32 vrf r1-cust1 nexthop encap mpls %s/104 via 10.0.1.2 dev r1-eth0'%label4r4)
+# luCommand('r4','ip route add 99.0.0.1/32 vrf r4-cust2 nexthop encap mpls %s/101 via 10.0.2.2 dev r4-eth0'%label4r1)
+
luCommand('r1','ip route show vrf r1-cust1','99.0.0.4','pass', 'VRF->MPLS PHP route installed')
luCommand('r4','ip route show vrf r4-cust2','99.0.0.1','pass', 'VRF->MPLS PHP route installed')
luCommand('r1','ip -M route show','101','MPLS->VRF route installed')
luCommand('r2','vtysh -c "show bgp ipv4 uni"','No BGP prefixes displayed','pass','Core Unicast SAFI clean')
luCommand('r3','vtysh -c "show bgp ipv4 uni"','No BGP prefixes displayed','pass','Core Unicast SAFI clean')
luCommand('r4','vtysh -c "show bgp ipv4 uni"','No BGP prefixes displayed','pass','Core Unicast SAFI clean')
-luCommand('r1','vtysh -c "show bgp ipv4 vpn"','No BGP prefixes displayed','pass','Core VPN SAFI clean')
-luCommand('r2','vtysh -c "show bgp ipv4 vpn"','No BGP prefixes displayed','pass','Core VPN SAFI clean')
-luCommand('r3','vtysh -c "show bgp ipv4 vpn"','No BGP prefixes displayed','pass','Core VPN SAFI clean')
-luCommand('r4','vtysh -c "show bgp ipv4 vpn"','No BGP prefixes displayed','pass','Core VPN SAFI clean')
+
+# Core VPN routes
+luCommand('r1','vtysh -c "show bgp ipv4 vpn"','5.1.0.0/24 .*1.1.1.1 .*5.1.1.0/24 .*1.1.1.1 .*2 routes and 2','pass','vrf->vpn routes')
+luCommand('r3','vtysh -c "show bgp ipv4 vpn"','5.1.0.0/24 .*3.3.3.3 .*5.1.1.0/24 .*3.3.3.3 .*2 routes and 2','pass','vrf->vpn routes')
+luCommand('r4','vtysh -c "show bgp ipv4 vpn"','5.1.2.0/24 .*4.4.4.4 .*5.1.3.0/24 .*4.4.4.4 .*5.4.2.0/24 .*4.4.4.4 .*5.4.3.0/24 .*4.4.4.4 .*4 routes and 4','pass','vrf->vpn routes')
+
+# MPLS vrf labels
+luCommand('r1','vtysh -c "show mpls table"',' 101 *BGP *r1-cust1','pass','vrf labels')
+luCommand('r3','vtysh -c "show mpls table"',' 103 *BGP *r3-cust1','pass','vrf labels')
+luCommand('r4','vtysh -c "show mpls table"',' 1041 *BGP *r4-cust1 .*1042 *BGP *r4-cust2','pass','vrf labels')
+
#CliOnFail = 'tgen.mininet_cli'
CheckFunc = 'ltemplateVersionCheck(\'3.1\', iproute2=\'4.9\')'
#uncomment next line to start cli *before* script is run
- #CheckFunc = 'ltemplateVersionCheck(\'3.1\', cli=True, iproute2=\'4.9\')'
+ CheckFunc = 'ltemplateVersionCheck(\'3.1\', cli=True, iproute2=\'4.9\')'
ltemplateTest('scripts/check_linux_mpls.py', False, CliOnFail, CheckFunc)
def SKIP_test_cleanup_all():