mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-02-01 18:56:52 +00:00
bgp_direct_to_bgp_vpn: initial version
Signed-off-by: Lou Berger <lberger@labn.net>
This commit is contained in:
parent
199a7c79c1
commit
6d0dbb7996
0
tests/topotests/bgp_direct_to_bgp_vpn/__init__.py
Executable file
0
tests/topotests/bgp_direct_to_bgp_vpn/__init__.py
Executable file
33
tests/topotests/bgp_direct_to_bgp_vpn/ce1/bgpd.conf
Normal file
33
tests/topotests/bgp_direct_to_bgp_vpn/ce1/bgpd.conf
Normal file
@ -0,0 +1,33 @@
|
||||
frr defaults traditional
|
||||
!
|
||||
hostname ce1
|
||||
password zebra
|
||||
log stdout notifications
|
||||
log monitor notifications
|
||||
log commands
|
||||
router bgp 5226
|
||||
bgp router-id 99.0.0.1
|
||||
neighbor 192.168.1.1 remote-as 5226
|
||||
neighbor 192.168.1.1 update-source 192.168.1.2
|
||||
address-family ipv4 unicast
|
||||
network 5.1.0.0/24 route-map rm-nh
|
||||
network 5.1.1.0/24 route-map rm-nh
|
||||
neighbor 192.168.1.1 activate
|
||||
exit-address-family
|
||||
!
|
||||
access-list al-any permit any
|
||||
!
|
||||
route-map rm-nh permit 10
|
||||
match ip address al-any
|
||||
set ip next-hop 99.0.0.1
|
||||
set local-preference 123
|
||||
set metric 98
|
||||
set large-community 12:34:56
|
||||
set extcommunity rt 89:123
|
||||
set community 0:67
|
||||
!
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
17
tests/topotests/bgp_direct_to_bgp_vpn/ce1/zebra.conf
Normal file
17
tests/topotests/bgp_direct_to_bgp_vpn/ce1/zebra.conf
Normal file
@ -0,0 +1,17 @@
|
||||
log file /tmp/ce1-zebra.log
|
||||
!
|
||||
hostname ce1
|
||||
!
|
||||
interface lo
|
||||
ip address 99.0.0.1/32
|
||||
!
|
||||
interface ce1-eth0
|
||||
description to r1
|
||||
ip address 192.168.1.2/24
|
||||
no link-detect
|
||||
!
|
||||
ip forwarding
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
33
tests/topotests/bgp_direct_to_bgp_vpn/ce2/bgpd.conf
Normal file
33
tests/topotests/bgp_direct_to_bgp_vpn/ce2/bgpd.conf
Normal file
@ -0,0 +1,33 @@
|
||||
frr defaults traditional
|
||||
!
|
||||
hostname ce2
|
||||
password zebra
|
||||
log stdout notifications
|
||||
log monitor notifications
|
||||
log commands
|
||||
router bgp 5226
|
||||
bgp router-id 99.0.0.2
|
||||
neighbor 192.168.1.1 remote-as 5226
|
||||
neighbor 192.168.1.1 update-source 192.168.1.2
|
||||
address-family ipv4 unicast
|
||||
network 5.1.0.0/24 route-map rm-nh
|
||||
network 5.1.1.0/24 route-map rm-nh
|
||||
neighbor 192.168.1.1 activate
|
||||
exit-address-family
|
||||
!
|
||||
access-list al-any permit any
|
||||
!
|
||||
route-map rm-nh permit 10
|
||||
match ip address al-any
|
||||
set ip next-hop 99.0.0.2
|
||||
set local-preference 100
|
||||
set metric 100
|
||||
set large-community 12:34:56
|
||||
set extcommunity rt 89:123
|
||||
set community 0:67
|
||||
!
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
17
tests/topotests/bgp_direct_to_bgp_vpn/ce2/zebra.conf
Normal file
17
tests/topotests/bgp_direct_to_bgp_vpn/ce2/zebra.conf
Normal file
@ -0,0 +1,17 @@
|
||||
log file /tmp/ce2-zebra.log
|
||||
!
|
||||
hostname ce2
|
||||
!
|
||||
interface lo
|
||||
ip address 99.0.0.2/32
|
||||
!
|
||||
interface ce2-eth0
|
||||
description to r3
|
||||
ip address 192.168.1.2/24
|
||||
no link-detect
|
||||
!
|
||||
ip forwarding
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
33
tests/topotests/bgp_direct_to_bgp_vpn/ce3/bgpd.conf
Normal file
33
tests/topotests/bgp_direct_to_bgp_vpn/ce3/bgpd.conf
Normal file
@ -0,0 +1,33 @@
|
||||
frr defaults traditional
|
||||
!
|
||||
hostname ce3
|
||||
password zebra
|
||||
log stdout notifications
|
||||
log monitor notifications
|
||||
log commands
|
||||
router bgp 5226
|
||||
bgp router-id 99.0.0.3
|
||||
neighbor 192.168.1.1 remote-as 5226
|
||||
neighbor 192.168.1.1 update-source 192.168.1.2
|
||||
address-family ipv4 unicast
|
||||
network 5.1.2.0/24 route-map rm-nh
|
||||
network 5.1.3.0/24 route-map rm-nh
|
||||
neighbor 192.168.1.1 activate
|
||||
exit-address-family
|
||||
!
|
||||
access-list al-any permit any
|
||||
!
|
||||
route-map rm-nh permit 10
|
||||
match ip address al-any
|
||||
set ip next-hop 99.0.0.3
|
||||
set local-preference 50
|
||||
set metric 200
|
||||
set large-community 12:34:56
|
||||
set extcommunity rt 89:123
|
||||
set community 0:67
|
||||
!
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
17
tests/topotests/bgp_direct_to_bgp_vpn/ce3/zebra.conf
Normal file
17
tests/topotests/bgp_direct_to_bgp_vpn/ce3/zebra.conf
Normal file
@ -0,0 +1,17 @@
|
||||
log file /tmp/ce3-zebra.log
|
||||
!
|
||||
hostname ce3
|
||||
!
|
||||
interface lo
|
||||
ip address 99.0.0.3/32
|
||||
!
|
||||
interface ce3-eth0
|
||||
description to r4
|
||||
ip address 192.168.1.2/24
|
||||
no link-detect
|
||||
!
|
||||
ip forwarding
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
40
tests/topotests/bgp_direct_to_bgp_vpn/r1/bgpd.conf
Normal file
40
tests/topotests/bgp_direct_to_bgp_vpn/r1/bgpd.conf
Normal file
@ -0,0 +1,40 @@
|
||||
frr defaults traditional
|
||||
!
|
||||
hostname r1
|
||||
password zebra
|
||||
log stdout notifications
|
||||
log monitor notifications
|
||||
log commands
|
||||
router bgp 5226
|
||||
bgp router-id 1.1.1.1
|
||||
bgp cluster-id 1.1.1.1
|
||||
neighbor 192.168.1.2 remote-as 5226
|
||||
neighbor 192.168.1.2 update-source 192.168.1.1
|
||||
neighbor 192.168.1.2 route-reflector-client
|
||||
neighbor 2.2.2.2 remote-as 5226
|
||||
neighbor 2.2.2.2 update-source 1.1.1.1
|
||||
!
|
||||
address-family ipv4 unicast
|
||||
redistribute vnc-direct
|
||||
neighbor 192.168.1.2 activate
|
||||
neighbor 192.168.1.2 next-hop-self
|
||||
no neighbor 2.2.2.2 activate
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv4 vpn
|
||||
neighbor 2.2.2.2 activate
|
||||
exit-address-family
|
||||
!
|
||||
vrf-policy 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 cust1
|
||||
vnc redistribute mode resolve-nve
|
||||
vnc redistribute ipv4 bgp-direct
|
||||
!
|
||||
end
|
||||
23
tests/topotests/bgp_direct_to_bgp_vpn/r1/ldpd.conf
Normal file
23
tests/topotests/bgp_direct_to_bgp_vpn/r1/ldpd.conf
Normal file
@ -0,0 +1,23 @@
|
||||
hostname r1
|
||||
log file /tmp/r1-ldpd.log
|
||||
!
|
||||
debug mpls ldp zebra
|
||||
debug mpls ldp event
|
||||
debug mpls ldp errors
|
||||
debug mpls ldp messages recv
|
||||
debug mpls ldp messages sent
|
||||
debug mpls ldp discovery hello recv
|
||||
debug mpls ldp discovery hello sent
|
||||
!
|
||||
mpls ldp
|
||||
router-id 1.1.1.1
|
||||
!
|
||||
address-family ipv4
|
||||
discovery transport-address 1.1.1.1
|
||||
!
|
||||
interface r1-eth0
|
||||
!
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
8
tests/topotests/bgp_direct_to_bgp_vpn/r1/ospfd.conf
Normal file
8
tests/topotests/bgp_direct_to_bgp_vpn/r1/ospfd.conf
Normal file
@ -0,0 +1,8 @@
|
||||
hostname r1
|
||||
log file /tmp/r1-ospfd.log
|
||||
!
|
||||
router ospf
|
||||
router-id 1.1.1.1
|
||||
network 0.0.0.0/4 area 0
|
||||
redistribute static
|
||||
!
|
||||
24
tests/topotests/bgp_direct_to_bgp_vpn/r1/zebra.conf
Normal file
24
tests/topotests/bgp_direct_to_bgp_vpn/r1/zebra.conf
Normal file
@ -0,0 +1,24 @@
|
||||
log file /tmp/r1-zebra.log
|
||||
!
|
||||
hostname r1
|
||||
!
|
||||
interface lo
|
||||
ip address 1.1.1.1/32
|
||||
!
|
||||
interface r1-eth0
|
||||
description to sw0
|
||||
ip address 10.0.1.1/24
|
||||
no link-detect
|
||||
!
|
||||
interface r1-eth4
|
||||
description to ce1
|
||||
ip address 192.168.1.1/24
|
||||
no link-detect
|
||||
!
|
||||
ip route 99.0.0.1/32 192.168.1.2
|
||||
!
|
||||
ip forwarding
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
33
tests/topotests/bgp_direct_to_bgp_vpn/r2/bgpd.conf
Normal file
33
tests/topotests/bgp_direct_to_bgp_vpn/r2/bgpd.conf
Normal file
@ -0,0 +1,33 @@
|
||||
frr defaults traditional
|
||||
!
|
||||
hostname r2
|
||||
password zebra
|
||||
log stdout notifications
|
||||
log monitor notifications
|
||||
log commands
|
||||
router bgp 5226
|
||||
bgp router-id 2.2.2.2
|
||||
bgp cluster-id 2.2.2.2
|
||||
neighbor 1.1.1.1 remote-as 5226
|
||||
neighbor 1.1.1.1 update-source 2.2.2.2
|
||||
neighbor 3.3.3.3 remote-as 5226
|
||||
neighbor 3.3.3.3 update-source 2.2.2.2
|
||||
neighbor 4.4.4.4 remote-as 5226
|
||||
neighbor 4.4.4.4 update-source 2.2.2.2
|
||||
address-family ipv4 unicast
|
||||
no neighbor 1.1.1.1 activate
|
||||
no neighbor 3.3.3.3 activate
|
||||
no neighbor 4.4.4.4 activate
|
||||
exit-address-family
|
||||
address-family ipv4 vpn
|
||||
neighbor 1.1.1.1 activate
|
||||
neighbor 1.1.1.1 route-reflector-client
|
||||
neighbor 3.3.3.3 activate
|
||||
neighbor 3.3.3.3 route-reflector-client
|
||||
neighbor 4.4.4.4 activate
|
||||
neighbor 4.4.4.4 route-reflector-client
|
||||
exit-address-family
|
||||
end
|
||||
|
||||
|
||||
|
||||
25
tests/topotests/bgp_direct_to_bgp_vpn/r2/ldpd.conf
Normal file
25
tests/topotests/bgp_direct_to_bgp_vpn/r2/ldpd.conf
Normal file
@ -0,0 +1,25 @@
|
||||
hostname r2
|
||||
log file /tmp/r2-ldpd.log
|
||||
!
|
||||
debug mpls ldp zebra
|
||||
debug mpls ldp event
|
||||
debug mpls ldp errors
|
||||
debug mpls ldp messages recv
|
||||
debug mpls ldp messages sent
|
||||
debug mpls ldp discovery hello recv
|
||||
debug mpls ldp discovery hello sent
|
||||
!
|
||||
mpls ldp
|
||||
router-id 2.2.2.2
|
||||
!
|
||||
address-family ipv4
|
||||
discovery transport-address 2.2.2.2
|
||||
!
|
||||
interface r2-eth0
|
||||
!
|
||||
interface r2-eth1
|
||||
!
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
7
tests/topotests/bgp_direct_to_bgp_vpn/r2/ospfd.conf
Normal file
7
tests/topotests/bgp_direct_to_bgp_vpn/r2/ospfd.conf
Normal file
@ -0,0 +1,7 @@
|
||||
hostname r2
|
||||
log file /tmp/r2-ospfd.log
|
||||
!
|
||||
router ospf
|
||||
router-id 2.2.2.2
|
||||
network 0.0.0.0/0 area 0
|
||||
!
|
||||
27
tests/topotests/bgp_direct_to_bgp_vpn/r2/zebra.conf
Normal file
27
tests/topotests/bgp_direct_to_bgp_vpn/r2/zebra.conf
Normal file
@ -0,0 +1,27 @@
|
||||
log file /tmp/r2-zebra.log
|
||||
!
|
||||
hostname r2
|
||||
!
|
||||
interface lo
|
||||
ip address 2.2.2.2/32
|
||||
!
|
||||
interface r2-eth0
|
||||
description to sw0
|
||||
ip address 10.0.1.2/24
|
||||
no link-detect
|
||||
!
|
||||
interface r2-eth1
|
||||
description to sw1
|
||||
ip address 10.0.2.2/24
|
||||
no link-detect
|
||||
!
|
||||
interface r2-eth2
|
||||
description to sw2
|
||||
ip address 10.0.3.2/24
|
||||
no link-detect
|
||||
!
|
||||
ip forwarding
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
42
tests/topotests/bgp_direct_to_bgp_vpn/r3/bgpd.conf
Normal file
42
tests/topotests/bgp_direct_to_bgp_vpn/r3/bgpd.conf
Normal file
@ -0,0 +1,42 @@
|
||||
frr defaults traditional
|
||||
!
|
||||
hostname r3
|
||||
password zebra
|
||||
log stdout notifications
|
||||
log monitor notifications
|
||||
log commands
|
||||
router bgp 5226
|
||||
bgp router-id 3.3.3.3
|
||||
bgp cluster-id 3.3.3.3
|
||||
neighbor 192.168.1.2 remote-as 5226
|
||||
neighbor 192.168.1.2 update-source 192.168.1.2
|
||||
neighbor 192.168.1.2 route-reflector-client
|
||||
neighbor 2.2.2.2 remote-as 5226
|
||||
neighbor 2.2.2.2 update-source 3.3.3.3
|
||||
!
|
||||
address-family ipv4 unicast
|
||||
redistribute vnc-direct
|
||||
neighbor 192.168.1.2 activate
|
||||
neighbor 192.168.1.2 next-hop-self
|
||||
no neighbor 2.2.2.2 activate
|
||||
exit-address-family
|
||||
address-family ipv4 vpn
|
||||
neighbor 2.2.2.2 activate
|
||||
exit-address-family
|
||||
!
|
||||
vrf-policy 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 cust1
|
||||
vnc redistribute mode resolve-nve
|
||||
vnc redistribute ipv4 bgp-direct
|
||||
!
|
||||
end
|
||||
|
||||
|
||||
|
||||
23
tests/topotests/bgp_direct_to_bgp_vpn/r3/ldpd.conf
Normal file
23
tests/topotests/bgp_direct_to_bgp_vpn/r3/ldpd.conf
Normal file
@ -0,0 +1,23 @@
|
||||
hostname r3
|
||||
log file /tmp/r3-ldpd.log
|
||||
!
|
||||
debug mpls ldp zebra
|
||||
debug mpls ldp event
|
||||
debug mpls ldp errors
|
||||
debug mpls ldp messages recv
|
||||
debug mpls ldp messages sent
|
||||
debug mpls ldp discovery hello recv
|
||||
debug mpls ldp discovery hello sent
|
||||
!
|
||||
mpls ldp
|
||||
router-id 3.3.3.3
|
||||
!
|
||||
address-family ipv4
|
||||
discovery transport-address 3.3.3.3
|
||||
!
|
||||
interface r3-eth0
|
||||
!
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
9
tests/topotests/bgp_direct_to_bgp_vpn/r3/ospfd.conf
Normal file
9
tests/topotests/bgp_direct_to_bgp_vpn/r3/ospfd.conf
Normal file
@ -0,0 +1,9 @@
|
||||
hostname r3
|
||||
password 1
|
||||
log file /tmp/r3-ospfd.log
|
||||
!
|
||||
router ospf
|
||||
router-id 3.3.3.3
|
||||
network 0.0.0.0/4 area 0
|
||||
redistribute static
|
||||
!
|
||||
29
tests/topotests/bgp_direct_to_bgp_vpn/r3/zebra.conf
Normal file
29
tests/topotests/bgp_direct_to_bgp_vpn/r3/zebra.conf
Normal file
@ -0,0 +1,29 @@
|
||||
log file /tmp/r3-zebra.log
|
||||
!
|
||||
hostname r3
|
||||
!
|
||||
interface lo
|
||||
ip address 3.3.3.3/32
|
||||
!
|
||||
interface r3-eth0
|
||||
description to sw1
|
||||
ip address 10.0.2.3/24
|
||||
no link-detect
|
||||
!
|
||||
interface r3-eth1
|
||||
description to sw2
|
||||
ip address 10.0.3.3/24
|
||||
no link-detect
|
||||
!
|
||||
interface r3-eth4
|
||||
description to ce2
|
||||
ip address 192.168.1.1/24
|
||||
no link-detect
|
||||
!
|
||||
ip route 99.0.0.2/32 192.168.1.2
|
||||
!
|
||||
ip forwarding
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
42
tests/topotests/bgp_direct_to_bgp_vpn/r4/bgpd.conf
Normal file
42
tests/topotests/bgp_direct_to_bgp_vpn/r4/bgpd.conf
Normal file
@ -0,0 +1,42 @@
|
||||
frr defaults traditional
|
||||
!
|
||||
hostname r4
|
||||
password zebra
|
||||
log stdout notifications
|
||||
log monitor notifications
|
||||
log commands
|
||||
router bgp 5226
|
||||
bgp router-id 4.4.4.4
|
||||
bgp cluster-id 4.4.4.4
|
||||
neighbor 192.168.1.2 remote-as 5226
|
||||
neighbor 192.168.1.2 update-source 192.168.1.1
|
||||
neighbor 192.168.1.2 route-reflector-client
|
||||
neighbor 2.2.2.2 remote-as 5226
|
||||
neighbor 2.2.2.2 update-source 4.4.4.4
|
||||
!
|
||||
address-family ipv4 unicast
|
||||
redistribute vnc-direct
|
||||
neighbor 192.168.1.2 activate
|
||||
neighbor 192.168.1.2 next-hop-self
|
||||
no neighbor 2.2.2.2 activate
|
||||
exit-address-family
|
||||
address-family ipv4 vpn
|
||||
neighbor 2.2.2.2 activate
|
||||
exit-address-family
|
||||
!
|
||||
vrf-policy cust1
|
||||
label 104
|
||||
rd 10:4
|
||||
rt both 52:100
|
||||
nexthop 192.168.1.1
|
||||
exit-vrf-policy
|
||||
!
|
||||
vnc export bgp mode group-nve
|
||||
vnc export bgp group-nve group cust1
|
||||
vnc redistribute mode resolve-nve
|
||||
vnc redistribute ipv4 bgp-direct
|
||||
!
|
||||
end
|
||||
|
||||
|
||||
|
||||
23
tests/topotests/bgp_direct_to_bgp_vpn/r4/ldpd.conf
Normal file
23
tests/topotests/bgp_direct_to_bgp_vpn/r4/ldpd.conf
Normal file
@ -0,0 +1,23 @@
|
||||
hostname r4
|
||||
log file /tmp/r4-ldpd.log
|
||||
!
|
||||
debug mpls ldp zebra
|
||||
debug mpls ldp event
|
||||
debug mpls ldp errors
|
||||
debug mpls ldp messages recv
|
||||
debug mpls ldp messages sent
|
||||
debug mpls ldp discovery hello recv
|
||||
debug mpls ldp discovery hello sent
|
||||
!
|
||||
mpls ldp
|
||||
router-id 4.4.4.4
|
||||
!
|
||||
address-family ipv4
|
||||
discovery transport-address 4.4.4.4
|
||||
!
|
||||
interface r4-eth0
|
||||
!
|
||||
!
|
||||
!
|
||||
line vty
|
||||
!
|
||||
8
tests/topotests/bgp_direct_to_bgp_vpn/r4/ospfd.conf
Normal file
8
tests/topotests/bgp_direct_to_bgp_vpn/r4/ospfd.conf
Normal file
@ -0,0 +1,8 @@
|
||||
hostname r4
|
||||
log file /tmp/r4-ospfd.log
|
||||
!
|
||||
router ospf
|
||||
router-id 4.4.4.4
|
||||
network 0.0.0.0/4 area 0
|
||||
redistribute static
|
||||
!
|
||||
23
tests/topotests/bgp_direct_to_bgp_vpn/r4/zebra.conf
Normal file
23
tests/topotests/bgp_direct_to_bgp_vpn/r4/zebra.conf
Normal file
@ -0,0 +1,23 @@
|
||||
log file /tmp/r4-zebra.log
|
||||
!
|
||||
hostname r4
|
||||
!
|
||||
interface lo
|
||||
ip address 4.4.4.4/32
|
||||
!
|
||||
interface r4-eth0
|
||||
description to sw1
|
||||
ip address 10.0.2.4/24
|
||||
no link-detect
|
||||
!
|
||||
interface r4-eth4
|
||||
description to ce3
|
||||
ip address 192.168.1.1/24
|
||||
no link-detect
|
||||
!
|
||||
ip route 99.0.0.3/32 192.168.1.2
|
||||
!
|
||||
ip forwarding
|
||||
!
|
||||
line vty
|
||||
!
|
||||
13
tests/topotests/bgp_direct_to_bgp_vpn/scripts/add_routes.py
Normal file
13
tests/topotests/bgp_direct_to_bgp_vpn/scripts/add_routes.py
Normal file
@ -0,0 +1,13 @@
|
||||
from lutil import luCommand
|
||||
luCommand('r1','vtysh -c "add vrf cust1 prefix 99.0.0.1/32"','.','none','IP Address')
|
||||
luCommand('r3','vtysh -c "add vrf cust1 prefix 99.0.0.2/32"','.','none','IP Address')
|
||||
luCommand('r4','vtysh -c "add vrf cust1 prefix 99.0.0.3/32"','.','none','IP Address')
|
||||
luCommand('r1','vtysh -c "show vnc registrations local"','99.0.0.1','pass','Local Registration')
|
||||
luCommand('r3','vtysh -c "show vnc registrations local"','99.0.0.2','pass','Local Registration')
|
||||
luCommand('r4','vtysh -c "show vnc registrations local"','99.0.0.3','pass','Local Registration')
|
||||
luCommand('r1','vtysh -c "show vnc registrations remote"','4 out of 4','wait','Remote Registration')
|
||||
luCommand('r3','vtysh -c "show vnc registrations remote"','6 out of 6','wait','Remote Registration')
|
||||
luCommand('r4','vtysh -c "show vnc registrations remote"','4 out of 4','wait','Remote Registration')
|
||||
luCommand('r1','vtysh -c "show vnc registrations"','.','none')
|
||||
luCommand('r3','vtysh -c "show vnc registrations"','.','none')
|
||||
luCommand('r4','vtysh -c "show vnc registrations"','.','none')
|
||||
@ -0,0 +1,5 @@
|
||||
from lutil import luCommand
|
||||
luCommand('r1','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up')
|
||||
luCommand('r2','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up')
|
||||
luCommand('r3','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up')
|
||||
luCommand('r4','vtysh -c "show bgp summary"',' 00:0.* 00:0','wait','Adjacencies up')
|
||||
@ -0,0 +1,13 @@
|
||||
from lutil import luCommand
|
||||
luCommand('ce1','vtysh -c "show bgp ipv4 uni"','7 routes and 7','wait','Local and remote routes')
|
||||
luCommand('ce2','vtysh -c "show bgp ipv4 uni"','7 routes and 9','wait','Local and remote routes')
|
||||
luCommand('ce3','vtysh -c "show bgp ipv4 uni"','7 routes and 7','wait','Local and remote routes')
|
||||
luCommand('r1','vtysh -c "show bgp ipv4 uni"','7 routes and 9','pass','Unicast SAFI')
|
||||
luCommand('r2','vtysh -c "show bgp ipv4 uni"','No BGP prefixes displayed','pass','Unicast SAFI')
|
||||
luCommand('r3','vtysh -c "show bgp ipv4 uni"','7 routes and 9','pass','Unicast SAFI')
|
||||
luCommand('r4','vtysh -c "show bgp ipv4 uni"','7 routes and 9','pass','Unicast SAFI')
|
||||
luCommand('r1','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
|
||||
luCommand('r2','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
|
||||
luCommand('r3','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
|
||||
luCommand('r4','vtysh -c "show bgp ipv4 vpn"','7 routes and 7','pass','VPN SAFI')
|
||||
|
||||
17
tests/topotests/bgp_direct_to_bgp_vpn/scripts/cleanup_all.py
Normal file
17
tests/topotests/bgp_direct_to_bgp_vpn/scripts/cleanup_all.py
Normal file
@ -0,0 +1,17 @@
|
||||
from lutil import luCommand
|
||||
luCommand('r1','vtysh -c "clear vrf cust1 prefix 99.0.0.1/32"','.','none','Cleared VRF route')
|
||||
luCommand('r3','vtysh -c "clear vrf cust1 prefix 99.0.0.2/32"','.','none','Cleared VRF route')
|
||||
luCommand('r4','vtysh -c "clear vrf cust1 prefix 99.0.0.3/32"','.','none','Cleared VRF route')
|
||||
luCommand('r1','vtysh -c "show vnc registrations local"','99.0.0.1','fail','Local Registration cleared')
|
||||
luCommand('r3','vtysh -c "show vnc registrations local"','99.0.0.2','fail','Local Registration cleared')
|
||||
luCommand('r4','vtysh -c "show vnc registrations local"','99.0.0.3','fail','Local Registration cleared')
|
||||
luCommand('r1','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Unicast SAFI updated')
|
||||
luCommand('r2','vtysh -c "show bgp ipv4 uni"','No BGP prefixes displayed','pass','Unicast SAFI')
|
||||
luCommand('r3','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Unicast SAFI updated')
|
||||
luCommand('r4','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Unicast SAFI updated')
|
||||
luCommand('ce1','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Local and remote routes')
|
||||
luCommand('ce2','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Local and remote routes')
|
||||
luCommand('ce3','vtysh -c "show bgp ipv4 uni"','2 routes and 2','wait','Local and remote routes')
|
||||
luCommand('r1','vtysh -c "show vnc registrations remote"','Prefix ','fail','Remote Registration cleared')
|
||||
luCommand('r3','vtysh -c "show vnc registrations remote"','Prefix ','fail','Remote Registration cleared')
|
||||
luCommand('r4','vtysh -c "show vnc registrations remote"','Prefix ','fail','Remote Registration cleared')
|
||||
294
tests/topotests/bgp_direct_to_bgp_vpn/test_bgp_direct_to_bgp_vpn.py
Executable file
294
tests/topotests/bgp_direct_to_bgp_vpn/test_bgp_direct_to_bgp_vpn.py
Executable file
@ -0,0 +1,294 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#
|
||||
# test_bgp_multiview_topo1.py
|
||||
# Part of NetDEF Topology Tests
|
||||
#
|
||||
# Copyright (c) 2016 by
|
||||
# Network Device Education Foundation, Inc. ("NetDEF")
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software
|
||||
# for any purpose with or without fee is hereby granted, provided
|
||||
# that the above copyright notice and this permission notice appear
|
||||
# in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
|
||||
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
# OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
"""
|
||||
test_mpls_vpn_topo1.py: Simple FRR/Quagga MPLS VPN Test
|
||||
|
||||
|
|
||||
+----+----+
|
||||
| ce1 |
|
||||
| 99.0.0.1| CE Router
|
||||
+----+----+
|
||||
192.168.1. | .2 ce1-eth0
|
||||
| .1 r1-eth4
|
||||
+---------+
|
||||
| r1 |
|
||||
| 1.1.1.1 | PE Router
|
||||
+----+----+
|
||||
| .1 r1-eth0
|
||||
|
|
||||
~~~~~~~~~~~~~
|
||||
~~ sw0 ~~
|
||||
~~ 10.0.1.0/24 ~~
|
||||
~~~~~~~~~~~~~
|
||||
|10.0.1.0/24
|
||||
|
|
||||
| .2 r2-eth0
|
||||
+----+----+
|
||||
| r2 |
|
||||
| 2.2.2.2 | P router
|
||||
+--+---+--+
|
||||
r2-eth2 .2 | | .2 r2-eth1
|
||||
______/ \______
|
||||
/ \
|
||||
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
|
||||
~~ sw2 ~~ ~~ sw1 ~~
|
||||
~~ 10.0.3.0/24 ~~ ~~ 10.0.2.0/24 ~~
|
||||
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
|
||||
| / |
|
||||
\ _________/ |
|
||||
\ / \
|
||||
r3-eth1 .3 | | .3 r3-eth0 | .4 r4-eth0
|
||||
+----+--+---+ +----+----+
|
||||
| r3 | | r4 |
|
||||
| 3.3.3.3 | | 4.4.4.4 | PE Routers
|
||||
+-----------+ +---------+
|
||||
192.168.1. | .1 192.168.1. | .1 rX-eth4
|
||||
| .2 | .2 ceX-eth0
|
||||
+-----+-----+ +----+-----+
|
||||
| ce2 | | ce3 |
|
||||
| 99.0.0.2 | | 99.0.0.3 | CE Routers
|
||||
+-----+-----+ +----+-----+
|
||||
| |
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import pytest
|
||||
from time import sleep
|
||||
|
||||
from mininet.topo import Topo
|
||||
from mininet.net import Mininet
|
||||
from mininet.node import Node, OVSSwitch, Host
|
||||
from mininet.log import setLogLevel, info
|
||||
from mininet.cli import CLI
|
||||
from mininet.link import Intf
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/utilities')
|
||||
|
||||
from lib import topotest
|
||||
|
||||
from lutil import luStart, luInclude, luFinish, luNumFail
|
||||
|
||||
fatal_error = ""
|
||||
|
||||
# Expected version of CLI Output - Appendix to filename
|
||||
# empty string = current, latest output (default)
|
||||
# "-1" ... "-NNN" previous versions (incrementing with each version)
|
||||
cli_version = ""
|
||||
|
||||
#####################################################
|
||||
##
|
||||
## Network Topology Definition
|
||||
##
|
||||
#####################################################
|
||||
|
||||
class NetworkTopo(Topo):
|
||||
"VPN Test Topology 1"
|
||||
|
||||
def build(self, **_opts):
|
||||
|
||||
# Setup Routers
|
||||
router = {}
|
||||
for i in range(1, 5):
|
||||
router[i] = topotest.addRouter(self, 'r%s' % i)
|
||||
ce = {}
|
||||
for i in range(1, 4):
|
||||
ce[i] = topotest.addRouter(self, 'ce%s' % i)
|
||||
|
||||
self.addLink(ce[1], router[1], intfName1='ce1-eth0', intfName2='r1-eth4', addr1='00:11:01:00:00:00', addr2='00:11:00:01:00:04')
|
||||
self.addLink(ce[2], router[3], intfName1='ce2-eth0', intfName2='r3-eth4', addr1='00:11:02:00:00:00', addr2='00:11:00:03:00:04')
|
||||
self.addLink(ce[3], router[4], intfName1='ce3-eth0', intfName2='r4-eth4', addr1='00:11:03:00:00:00', addr2='00:11:00:04:00:04')
|
||||
# Setup Switches, add Interfaces and Connections
|
||||
switch = {}
|
||||
# First switch
|
||||
switch[0] = self.addSwitch('sw0', cls=topotest.LegacySwitch)
|
||||
self.addLink(switch[0], router[1], intfName2='r1-eth0', addr1='80:AA:00:00:00:00', addr2='00:11:00:01:00:00')
|
||||
self.addLink(switch[0], router[2], intfName2='r2-eth0', addr1='80:AA:00:00:00:01', addr2='00:11:00:02:00:00')
|
||||
# Second switch
|
||||
switch[1] = self.addSwitch('sw1', cls=topotest.LegacySwitch)
|
||||
self.addLink(switch[1], router[2], intfName2='r2-eth1', addr1='80:AA:00:01:00:00', addr2='00:11:00:02:00:01')
|
||||
self.addLink(switch[1], router[3], intfName2='r3-eth0', addr1='80:AA:00:01:00:01', addr2='00:11:00:03:00:00')
|
||||
self.addLink(switch[1], router[4], intfName2='r4-eth0', addr1='80:AA:00:01:00:02', addr2='00:11:00:04:00:00')
|
||||
# Third switch
|
||||
switch[2] = self.addSwitch('sw2', cls=topotest.LegacySwitch)
|
||||
self.addLink(switch[2], router[2], intfName2='r2-eth2', addr1='80:AA:00:02:00:00', addr2='00:11:00:02:00:02')
|
||||
self.addLink(switch[2], router[3], intfName2='r3-eth1', addr1='80:AA:00:02:00:01', addr2='00:11:00:03:00:01')
|
||||
|
||||
#####################################################
|
||||
##
|
||||
## Tests starting
|
||||
##
|
||||
#####################################################
|
||||
|
||||
def setup_module(module):
|
||||
global topo, net
|
||||
global fatal_error
|
||||
global thisDir
|
||||
|
||||
print("\n\n** %s: Setup Topology" % module.__name__)
|
||||
print("******************************************\n")
|
||||
|
||||
print("Cleanup old Mininet runs")
|
||||
os.system('sudo mn -c > /dev/null 2>&1')
|
||||
|
||||
thisDir = os.path.dirname(os.path.realpath(__file__))
|
||||
topo = NetworkTopo()
|
||||
|
||||
net = Mininet(controller=None, topo=topo)
|
||||
net.start()
|
||||
luStart(thisDir, net)
|
||||
|
||||
# Starting Routers
|
||||
for i in range(1, 5):
|
||||
net['r%s' % i].loadConf('zebra', '%s/r%s/zebra.conf' % (thisDir, i))
|
||||
net['r%s' % i].loadConf('ospfd', '%s/r%s/ospfd.conf' % (thisDir, i))
|
||||
net['r%s' % i].loadConf('ldpd', '%s/r%s/ldpd.conf' % (thisDir, i))
|
||||
net['r%s' % i].loadConf('bgpd', '%s/r%s/bgpd.conf' % (thisDir, i))
|
||||
fatal_error = net['r%s' % i].startRouter()
|
||||
|
||||
if fatal_error != "":
|
||||
break
|
||||
|
||||
# Starting CE Routers
|
||||
for i in range(1, 4):
|
||||
net['ce%s' % i].loadConf('zebra', '%s/ce%s/zebra.conf' % (thisDir, i))
|
||||
net['ce%s' % i].loadConf('bgpd', '%s/ce%s/bgpd.conf' % (thisDir, i))
|
||||
fatal_error = net['ce%s' % i].startRouter()
|
||||
|
||||
if fatal_error != "":
|
||||
break
|
||||
|
||||
# For debugging after starting FRR/Quagga daemons, uncomment the next line
|
||||
#CLI(net)
|
||||
|
||||
def teardown_module(module):
|
||||
global net
|
||||
|
||||
print("\n\n** %s: Shutdown Topology" % module.__name__)
|
||||
print("******************************************\n")
|
||||
|
||||
# End - Shutdown network
|
||||
net.stop()
|
||||
|
||||
def test_add_vnc_routes():
|
||||
global fatal_error
|
||||
global net
|
||||
global cli_version
|
||||
|
||||
# Skip if previous fatal error condition is raised
|
||||
if (fatal_error != ""):
|
||||
pytest.skip(fatal_error)
|
||||
|
||||
print("\n\n** Running main test cases")
|
||||
print("******************************\n")
|
||||
luInclude('teststart.py')
|
||||
# For debugging after starting FRR/Quagga daemons, uncomment the next line
|
||||
#CLI(net)
|
||||
|
||||
luInclude('testfinish.py')
|
||||
# For debugging after starting FRR/Quagga daemons, uncomment the next line
|
||||
#CLI(net)
|
||||
|
||||
# Make sure that all daemons are running
|
||||
numFail = luNumFail()
|
||||
if numFail > 0:
|
||||
fatal_error = '%d tests failed' % numFail
|
||||
assert fatal_error == "", fatal_error
|
||||
|
||||
def test_shutdown_check_stderr():
|
||||
global fatal_error
|
||||
global net
|
||||
|
||||
# Skip if previous fatal error condition is raised
|
||||
if (fatal_error != ""):
|
||||
pytest.skip(fatal_error)
|
||||
|
||||
if os.environ.get('TOPOTESTS_CHECK_STDERR') is None:
|
||||
print("SKIPPED final check on StdErr output: Disabled (TOPOTESTS_CHECK_STDERR undefined)\n")
|
||||
pytest.skip('Skipping test for Stderr output')
|
||||
|
||||
thisDir = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
print("\n\n** Verifying unexpected STDERR output from daemons")
|
||||
print("******************************************\n")
|
||||
|
||||
for i in range(1, 5):
|
||||
net['r%s' % i].stopRouter()
|
||||
log = net['r%s' % i].getStdErr('bgpd')
|
||||
if log:
|
||||
print("\nRouter r%s BGPd StdErr Log:\n%s" % (i, log))
|
||||
log = net['r%s' % i].getStdErr('ldpd')
|
||||
if log:
|
||||
print("\nRouter r%s LDPd StdErr Log:\n%s" % (i, log))
|
||||
log = net['r%s' % i].getStdErr('ospfd')
|
||||
if log:
|
||||
print("\nRouter r%s OSPFd StdErr Log:\n%s" % (i, log))
|
||||
log = net['r%s' % i].getStdErr('zebra')
|
||||
if log:
|
||||
print("\nRouter r%s Zebra StdErr Log:\n%s" % (i, log))
|
||||
|
||||
for i in range(1, 4):
|
||||
net['ce%s' % i].stopRouter()
|
||||
log = net['ce%s' % i].getStdErr('bgpd')
|
||||
if log:
|
||||
print("\nRouter r%s BGPd StdErr Log:\n%s" % (i, log))
|
||||
log = net['ce%s' % i].getStdErr('zebra')
|
||||
if log:
|
||||
print("\nRouter r%s Zebra StdErr Log:\n%s" % (i, log))
|
||||
|
||||
|
||||
def test_shutdown_check_memleak():
|
||||
global fatal_error
|
||||
global net
|
||||
|
||||
# Skip if previous fatal error condition is raised
|
||||
if (fatal_error != ""):
|
||||
pytest.skip(fatal_error)
|
||||
|
||||
if os.environ.get('TOPOTESTS_CHECK_MEMLEAK') is None:
|
||||
print("SKIPPED final check on Memory leaks: Disabled (TOPOTESTS_CHECK_MEMLEAK undefined)\n")
|
||||
pytest.skip('Skipping test for memory leaks')
|
||||
|
||||
thisDir = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
for i in range(1, 5):
|
||||
net['r%s' % i].stopRouter()
|
||||
net['r%s' % i].report_memory_leaks(os.environ.get('TOPOTESTS_CHECK_MEMLEAK'), os.path.basename(__file__))
|
||||
|
||||
for i in range(1, 4):
|
||||
net['ce%s' % i].stopRouter()
|
||||
net['ce%s' % i].report_memory_leaks(os.environ.get('TOPOTESTS_CHECK_MEMLEAK'), os.path.basename(__file__))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
setLogLevel('info')
|
||||
# To suppress tracebacks, either use the following pytest call or add "--tb=no" to cli
|
||||
# retval = pytest.main(["-s", "--tb=no"])
|
||||
retval = pytest.main(["-s"])
|
||||
print(luFinish())
|
||||
sys.exit(retval)
|
||||
2
tests/topotests/bgp_direct_to_bgp_vpn/testfinish.py
Normal file
2
tests/topotests/bgp_direct_to_bgp_vpn/testfinish.py
Normal file
@ -0,0 +1,2 @@
|
||||
from lutil import luInclude
|
||||
luInclude('scripts/cleanup_all.py')
|
||||
4
tests/topotests/bgp_direct_to_bgp_vpn/teststart.py
Normal file
4
tests/topotests/bgp_direct_to_bgp_vpn/teststart.py
Normal file
@ -0,0 +1,4 @@
|
||||
from lutil import luInclude
|
||||
luInclude('scripts/adjacencies.py')
|
||||
luInclude('scripts/add_routes.py')
|
||||
luInclude('scripts/check_routes.py')
|
||||
Loading…
Reference in New Issue
Block a user