summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiao Liang <shaw.leon@gmail.com>2023-11-17 03:44:10 +0100
committerEugene Crosser <crosser@average.org>2024-07-08 10:32:03 +0200
commit66a84c7c107d7b70befdae77f923b72f3d5956b2 (patch)
tree5e610d7b247642296761386eac50fd7f82dff402
parentMerge pull request #16346 from pguibert6WIND/sharp_zapi_nexthop_only (diff)
downloadfrr-66a84c7c107d7b70befdae77f923b72f3d5956b2.tar.xz
frr-66a84c7c107d7b70befdae77f923b72f3d5956b2.zip
tests: Add IPv6 network adv/withdraw case in bgp_evpn_rt5 topotest
Note that withdrawing IPv6 route should not affect IPv4. Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
-rw-r--r--tests/topotests/bgp_evpn_rt5/r1/bgpd.conf4
-rw-r--r--tests/topotests/bgp_evpn_rt5/r1/zebra.conf1
-rw-r--r--tests/topotests/bgp_evpn_rt5/r2/bgpd.conf4
-rw-r--r--tests/topotests/bgp_evpn_rt5/r2/zebra.conf1
-rw-r--r--tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py125
5 files changed, 134 insertions, 1 deletions
diff --git a/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf b/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf
index ccbeae6ed..c8c4faf22 100644
--- a/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf
+++ b/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf
@@ -20,7 +20,11 @@ router bgp 65000 vrf r1-vrf-101
address-family ipv4 unicast
network 192.168.102.21/32
exit-address-family
+ address-family ipv6 unicast
+ network fd00::1/128
+ exit-address-family
address-family l2vpn evpn
advertise ipv4 unicast
+ advertise ipv6 unicast
exit-address-family
!
diff --git a/tests/topotests/bgp_evpn_rt5/r1/zebra.conf b/tests/topotests/bgp_evpn_rt5/r1/zebra.conf
index 4f1804c67..c3d508c2b 100644
--- a/tests/topotests/bgp_evpn_rt5/r1/zebra.conf
+++ b/tests/topotests/bgp_evpn_rt5/r1/zebra.conf
@@ -17,6 +17,7 @@ interface r1-eth0
!
interface loop101 vrf r1-vrf-101
ip address 192.168.102.21/32
+ ipv6 address fd00::1/128
!
diff --git a/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf b/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf
index 744c259d9..de5a0efc4 100644
--- a/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf
+++ b/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf
@@ -21,7 +21,11 @@ router bgp 65000 vrf r2-vrf-101
address-family ipv4 unicast
network 192.168.101.41/32
exit-address-family
+ address-family ipv6 unicast
+ network fd00::2/128
+ exit-address-family
address-family l2vpn evpn
advertise ipv4 unicast
+ advertise ipv6 unicast
exit-address-family
!
diff --git a/tests/topotests/bgp_evpn_rt5/r2/zebra.conf b/tests/topotests/bgp_evpn_rt5/r2/zebra.conf
index 7d19a5b38..7db40cb59 100644
--- a/tests/topotests/bgp_evpn_rt5/r2/zebra.conf
+++ b/tests/topotests/bgp_evpn_rt5/r2/zebra.conf
@@ -11,6 +11,7 @@ vrf r2-vrf-101
!
interface loop101 vrf r2-vrf-101
ip address 192.168.101.41/32
+ ipv6 address fd00::2/128
!
interface r2-eth0
ip address 192.168.100.41/24
diff --git a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
index d9177b4d2..2d027081c 100644
--- a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
+++ b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
@@ -25,6 +25,8 @@ sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
# Import topogen and topotest helpers
from lib import topotest
+from lib.bgp import verify_bgp_rib
+from lib.common_config import apply_raw_config
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
@@ -179,12 +181,18 @@ def test_protocols_convergence():
output = tgen.gears["r1"].vtysh_cmd("show bgp vrf r1-vrf-101 ipv4", isjson=False)
logger.info("==== result from show bgp vrf r1-vrf-101 ipv4")
logger.info(output)
+ output = tgen.gears["r1"].vtysh_cmd("show bgp vrf r1-vrf-101 ipv6", isjson=False)
+ logger.info("==== result from show bgp vrf r1-vrf-101 ipv6")
+ logger.info(output)
output = tgen.gears["r1"].vtysh_cmd("show bgp vrf r1-vrf-101", isjson=False)
logger.info("==== result from show bgp vrf r1-vrf-101 ")
logger.info(output)
output = tgen.gears["r1"].vtysh_cmd("show ip route vrf r1-vrf-101", isjson=False)
logger.info("==== result from show ip route vrf r1-vrf-101")
logger.info(output)
+ output = tgen.gears["r1"].vtysh_cmd("show ipv6 route vrf r1-vrf-101", isjson=False)
+ logger.info("==== result from show ipv6 route vrf r1-vrf-101")
+ logger.info(output)
output = tgen.gears["r1"].vtysh_cmd("show evpn vni detail", isjson=False)
logger.info("==== result from show evpn vni detail")
logger.info(output)
@@ -192,8 +200,49 @@ def test_protocols_convergence():
logger.info("==== result from show evpn next-hops vni all")
logger.info(output)
output = tgen.gears["r1"].vtysh_cmd("show evpn rmac vni all", isjson=False)
- logger.info("==== result from show evpn next-hops vni all")
+ logger.info("==== result from show evpn rmac vni all")
logger.info(output)
+
+ expected = {
+ "fd00::2/128": [
+ {
+ "prefix": "fd00::2/128",
+ "vrfName": "r1-vrf-101",
+ "nexthops": [
+ {
+ "ip": "::ffff:c0a8:6429",
+ }
+ ],
+ }
+ ]
+ }
+ result = topotest.router_json_cmp(
+ tgen.gears["r1"], "show ipv6 route vrf r1-vrf-101 fd00::2/128 json", expected
+ )
+ assert result is None, "ipv6 route check failed"
+
+ expected = {
+ "101": {
+ "numNextHops": 2,
+ "192.168.100.41": {
+ "nexthopIp": "192.168.100.41",
+ },
+ "::ffff:c0a8:6429": {
+ "nexthopIp": "::ffff:c0a8:6429",
+ },
+ }
+ }
+ result = topotest.router_json_cmp(
+ tgen.gears["r1"], "show evpn next-hops vni all json", expected
+ )
+ assert result is None, "evpn next-hops check failed"
+
+ expected = {"101": {"numRmacs": 1}}
+ result = topotest.router_json_cmp(
+ tgen.gears["r1"], "show evpn rmac vni all json", expected
+ )
+ assert result is None, "evpn rmac number check failed"
+
# Check IPv4 and IPv6 connectivity between r1 and r2 ( routing vxlan evpn)
pingrouter = tgen.gears["r1"]
logger.info(
@@ -209,6 +258,80 @@ def test_protocols_convergence():
else:
logger.info("Check Ping IPv4 from R1(r1-vrf-101) to R2(192.168.101.41) OK")
+ logger.info("Check Ping IPv6 from R1(r1-vrf-101) to R2(r2-vrf-101 = fd00::2)")
+ output = pingrouter.run("ip netns exec r1-vrf-101 ping fd00::2 -f -c 1000")
+ logger.info(output)
+ if "1000 packets transmitted, 1000 received" not in output:
+ assert 0, "expected ping IPv6 from R1(r1-vrf-101) to R2(fd00::2) should be ok"
+ else:
+ logger.info("Check Ping IPv6 from R1(r1-vrf-101) to R2(fd00::2) OK")
+
+ config_no_ipv6 = {
+ "r2": {
+ "raw_config": [
+ "router bgp 65000 vrf r2-vrf-101",
+ "address-family ipv6 unicast",
+ "no network fd00::2/128",
+ ]
+ }
+ }
+
+ logger.info("==== Remove IPv6 network on R2")
+ result = apply_raw_config(tgen, config_no_ipv6)
+ assert result is True, "Failed to remove IPv6 network on R2, Error: {} ".format(
+ result
+ )
+ ipv6_routes = {
+ "r1": {
+ "static_routes": [
+ {
+ "vrf": "r1-vrf-101",
+ "network": ["fd00::2/128"],
+ }
+ ]
+ }
+ }
+ result = verify_bgp_rib(tgen, "ipv6", "r1", ipv6_routes, expected=False)
+ assert result is not True, "expect IPv6 route fd00::2/128 withdrawn"
+ output = tgen.gears["r1"].vtysh_cmd("show evpn next-hops vni all", isjson=False)
+ logger.info("==== result from show evpn next-hops vni all")
+ logger.info(output)
+ output = tgen.gears["r1"].vtysh_cmd("show evpn rmac vni all", isjson=False)
+ logger.info("==== result from show evpn next-hops vni all")
+ logger.info(output)
+
+ expected = {
+ "101": {
+ "numNextHops": 1,
+ "192.168.100.41": {
+ "nexthopIp": "192.168.100.41",
+ },
+ }
+ }
+ result = topotest.router_json_cmp(
+ tgen.gears["r1"], "show evpn next-hops vni all json", expected
+ )
+ assert result is None, "evpn next-hops check failed"
+
+ expected = {"101": {"numRmacs": 1}}
+ result = topotest.router_json_cmp(
+ tgen.gears["r1"], "show evpn rmac vni all json", expected
+ )
+ assert result is None, "evpn rmac number check failed"
+
+ logger.info(
+ "Check Ping IPv4 from R1(r1-vrf-101) to R2(r2-vrf-101 = 192.168.101.41)"
+ )
+ output = pingrouter.run("ip netns exec r1-vrf-101 ping 192.168.101.41 -f -c 1000")
+ logger.info(output)
+ if "1000 packets transmitted, 1000 received" not in output:
+ assertmsg = (
+ "expected ping IPv4 from R1(r1-vrf-101) to R2(192.168.101.41) should be ok"
+ )
+ assert 0, assertmsg
+ else:
+ logger.info("Check Ping IPv4 from R1(r1-vrf-101) to R2(192.168.101.41) OK")
+
def test_memory_leak():
"Run the memory leak test and report results."