topotests: bgp_srv6l3vpn_to_bgp_vrf locator update test case

If the SRv6 locator is deleted in zebra, zclient(bgpd)
which allocates SIDs from the locator will update the
RIBs which use those SIDs and make them invalid.
This will cause the VPNv6 route to be withdrawn and
the VPN to stop.

If the SRv6 locator is added again, zclient(bgpd) will
allocate the SIDs from the locator again, and VPNv6
will be re-established.

This commit add a test case to confirm this.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
This commit is contained in:
Hiroki Shirokura 2021-09-05 09:48:28 +00:00
parent 9529336a22
commit 6d39d7c0dd
7 changed files with 630 additions and 2 deletions

View File

@ -0,0 +1,160 @@
{
"vrfId": 0,
"vrfName": "default",
"routerId": "1.1.1.1",
"defaultLocPrf": 100,
"localAS": 1,
"routes": {
"routeDistinguishers": {
"1:10": {
"2001:1::/64": [
{
"pathFrom": "external",
"prefix": "2001:1::",
"prefixLen": 64,
"network": "2001:1::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:3::/64": [
{
"pathFrom": "external",
"prefix": "2001:3::",
"prefixLen": 64,
"network": "2001:3::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
"2001:5::/64": [
{
"pathFrom": "external",
"prefix": "2001:5::",
"prefixLen": 64,
"network": "2001:5::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf20",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:10": {
"2001:2::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:2::",
"prefixLen": 64,
"network": "2001:2::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:20": {
"2001:4::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:4::",
"prefixLen": 64,
"network": "2001:4::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:6::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:6::",
"prefixLen": 64,
"network": "2001:6::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
}
}

View File

@ -0,0 +1,169 @@
{
"vrfId": 0,
"vrfName": "default",
"routerId": "1.1.1.1",
"defaultLocPrf": 100,
"localAS": 1,
"routes": {
"routeDistinguishers": {
"1:10": {
"2001:1::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:1::",
"prefixLen": 64,
"network": "2001:1::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:3::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:3::",
"prefixLen": 64,
"network": "2001:3::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
"2001:5::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:5::",
"prefixLen": 64,
"network": "2001:5::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf20",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:10": {
"2001:2::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:2::",
"prefixLen": 64,
"network": "2001:2::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:20": {
"2001:4::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:4::",
"prefixLen": 64,
"network": "2001:4::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:6::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:6::",
"prefixLen": 64,
"network": "2001:6::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
}
}

View File

@ -34,7 +34,9 @@ segment-routing
ip forwarding
ipv6 forwarding
!
ipv6 route 2001:db8:2:1::/64 2001::2
ipv6 route 2001:db8:2:2::/64 2001::2
ipv6 route 2001:db8:2:3::/64 2001::2
!
line vty
!

View File

@ -0,0 +1,93 @@
{
"vrfId": 0,
"vrfName": "default",
"routerId": "2.2.2.2",
"defaultLocPrf": 100,
"localAS": 2,
"routes": {
"routeDistinguishers": {
"2:10": {
"2001:2::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:2::",
"prefixLen": 64,
"network": "2001:2::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:20": {
"2001:4::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:4::",
"prefixLen": 64,
"network": "2001:4::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf20",
"nexthops": [
{
"ip": "::",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:6::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:6::",
"prefixLen": 64,
"network": "2001:6::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf20",
"nexthops": [
{
"ip": "::",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
}
}

View File

@ -0,0 +1,169 @@
{
"vrfId": 0,
"vrfName": "default",
"routerId": "2.2.2.2",
"defaultLocPrf": 100,
"localAS": 2,
"routes": {
"routeDistinguishers": {
"1:10": {
"2001:1::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:1::",
"prefixLen": 64,
"network": "2001:1::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:3::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:3::",
"prefixLen": 64,
"network": "2001:3::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
"2001:5::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:5::",
"prefixLen": 64,
"network": "2001:5::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:10": {
"2001:2::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:2::",
"prefixLen": 64,
"network": "2001:2::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:20": {
"2001:4::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:4::",
"prefixLen": 64,
"network": "2001:4::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf20",
"nexthops": [
{
"ip": "::",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:6::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:6::",
"prefixLen": 64,
"network": "2001:6::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf20",
"nexthops": [
{
"ip": "::",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
}
}

View File

@ -35,6 +35,8 @@ ip forwarding
ipv6 forwarding
!
ipv6 route 2001:db8:1:1::/64 2001::1
ipv6 route 2001:db8:1:2::/64 2001::1
ipv6 route 2001:db8:1:3::/64 2001::1
!
line vty
!

View File

@ -159,7 +159,7 @@ def check_ping(name, dest_addr, expect_connected):
tgen = get_topogen()
func = functools.partial(_check, name, dest_addr, match)
success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
assert result is None, 'Failed'
assert result is None, "Failed"
def check_rib(name, cmd, expected_file):
@ -175,7 +175,7 @@ def check_rib(name, cmd, expected_file):
tgen = get_topogen()
func = functools.partial(_check, name, cmd, expected_file)
success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
assert result is None, 'Failed'
assert result is None, "Failed"
def test_rib():
@ -206,6 +206,39 @@ def test_ping():
check_ping("ce4", "2001:6::2", True)
def test_locator_delete():
check_ping("ce1", "2001:2::2", True)
get_topogen().gears["r1"].vtysh_cmd(
"""
configure terminal
segment-routing
srv6
locators
no locator loc1
"""
)
check_rib("r1", "show bgp ipv6 vpn json", "r1/vpnv6_rib_locator_deleted.json")
check_rib("r2", "show bgp ipv6 vpn json", "r2/vpnv6_rib_locator_deleted.json")
check_ping("ce1", "2001:2::2", False)
def test_locator_recreate():
check_ping("ce1", "2001:2::2", False)
get_topogen().gears["r1"].vtysh_cmd(
"""
configure terminal
segment-routing
srv6
locators
locator loc1
prefix 2001:db8:1:1::/64
"""
)
check_rib("r1", "show bgp ipv6 vpn json", "r1/vpnv6_rib_locator_recreated.json")
check_rib("r2", "show bgp ipv6 vpn json", "r2/vpnv6_rib_locator_recreated.json")
check_ping("ce1", "2001:2::2", True)
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))