summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn_vty.c20
-rw-r--r--doc/user/zebra.rst65
-rw-r--r--nhrpd/nhrp_nhs.c7
-rw-r--r--nhrpd/nhrp_peer.c2
-rw-r--r--ospfd/ospf_vty.c7
-rw-r--r--tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py12
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py24
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py3
-rw-r--r--tests/topotests/bgp_vrf_lite_ipv6_rtadv/test_bgp_vrf_lite_ipv6_rtadv.py28
-rw-r--r--tests/topotests/isis-topo1-vrf/r1/r1_topology.json82
-rw-r--r--tests/topotests/isis-topo1-vrf/r2/r2_topology.json84
-rw-r--r--tests/topotests/isis-topo1-vrf/r3/r3_topology.json158
-rw-r--r--tests/topotests/isis-topo1-vrf/r4/r4_topology.json158
-rw-r--r--tests/topotests/isis-topo1-vrf/r5/r5_topology.json160
-rw-r--r--tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py85
-rw-r--r--tests/topotests/lib/common_config.py50
-rw-r--r--tests/topotests/lib/topotest.py3
17 files changed, 507 insertions, 441 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 381e6f082b..ed8a6a9506 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -3452,12 +3452,6 @@ DEFUN (no_bgp_evpn_advertise_default_gw,
if (!bgp)
return CMD_WARNING;
- if (!EVPN_ENABLED(bgp)) {
- vty_out(vty,
- "This command is only supported under the EVPN VRF\n");
- return CMD_WARNING;
- }
-
evpn_unset_advertise_default_gw(bgp, NULL);
return CMD_SUCCESS;
@@ -3718,16 +3712,16 @@ DEFPY(bgp_evpn_advertise_svi_ip,
if (!bgp)
return CMD_WARNING;
- if (!EVPN_ENABLED(bgp)) {
- vty_out(vty,
- "This command is only supported under EVPN VRF\n");
- return CMD_WARNING;
- }
-
if (no)
evpn_set_advertise_svi_macip(bgp, NULL, 0);
- else
+ else {
+ if (!EVPN_ENABLED(bgp)) {
+ vty_out(vty,
+ "This command is only supported under EVPN VRF\n");
+ return CMD_WARNING;
+ }
evpn_set_advertise_svi_macip(bgp, NULL, 1);
+ }
return CMD_SUCCESS;
}
diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst
index e5cd1de201..205b25e53e 100644
--- a/doc/user/zebra.rst
+++ b/doc/user/zebra.rst
@@ -1020,3 +1020,68 @@ For protocols requiring an IPv6 router-id, the following commands are available:
.. clicmd:: show ipv6 router-id [vrf NAME]
Display the user configured IPv6 router-id.
+
+
+Debugging
+=========
+
+.. clicmd:: debug zebra mpls [detailed]
+
+ MPLS-related events and information.
+
+.. clicmd:: debug zebra events
+
+ Zebra events
+
+.. clicmd:: debug zebra nht [detailed]
+
+ Nexthop-tracking / reachability information
+
+.. clicmd:: debug zebra vxlan
+
+ VxLAN (EVPN) events
+
+.. clicmd:: debug zebra pseudowires
+
+ Pseudowire events.
+
+.. clicmd:: debug zebra packet [<recv|send>] [detail]
+
+ ZAPI message and packet details
+
+.. clicmd:: debug zebra kernel
+
+ Kernel / OS events.
+
+.. clicmd:: debug zebra kernel msgdump [<recv|send>]
+
+ Raw OS (netlink) message details.
+
+.. clicmd:: debug zebra rib [detailed]
+
+ RIB events.
+
+.. clicmd:: debug zebra fpm
+
+ FPM (forwarding-plane manager) events.
+
+.. clicmd:: debug zebra dplane [detailed]
+
+ Dataplane / FIB events.
+
+.. clicmd:: debug zebra pbr
+
+ PBR (policy-based routing) events.
+
+.. clicmd:: debug zebra mlag
+
+ MLAG events.
+
+.. clicmd:: debug zebra evpn mh <es|mac|neigh|nh>
+
+ EVPN multi-hop events.
+
+.. clicmd:: debug zebra nexthop [detail]
+
+ Nexthop and nexthop-group events.
+
diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c
index b78bf92784..9dfaf073d8 100644
--- a/nhrpd/nhrp_nhs.c
+++ b/nhrpd/nhrp_nhs.c
@@ -34,7 +34,6 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
struct zbuf extpl;
union sockunion cie_nbma, cie_nbma_nhs, cie_proto, cie_proto_nhs,
*proto;
- char buf[64];
int ok = 0, holdtime;
unsigned short mtu = 0;
@@ -78,10 +77,8 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
&cie_proto)) {
nifp->nat_nbma = cie_nbma;
debugf(NHRP_DEBUG_IF,
- "%s: NAT detected, real NBMA address: %s",
- ifp->name,
- sockunion2str(&nifp->nbma, buf,
- sizeof(buf)));
+ "%s: NAT detected, real NBMA address: %pSU",
+ ifp->name, &nifp->nbma);
}
break;
case NHRP_EXTENSION_RESPONDER_ADDRESS:
diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c
index 199f3332d2..c1f615d0a9 100644
--- a/nhrpd/nhrp_peer.c
+++ b/nhrpd/nhrp_peer.c
@@ -422,7 +422,7 @@ static void nhrp_process_nat_extension(struct nhrp_packet_parser *pp,
if (!sockunion_cmp(proto, &cie_proto)) {
debugf(NHRP_DEBUG_COMMON,
- "\tcie_nbma for proto %pSU is %pSU",
+ "cie_nbma for proto %pSU is %pSU",
proto, cie_nbma);
break;
}
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index a1dac641d7..92d13e616c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -7865,10 +7865,9 @@ DEFUN (ip_ospf_message_digest_key,
}
key_id = strtol(keyid, NULL, 10);
- if (ospf_crypt_key_lookup(params->auth_crypt, key_id) != NULL) {
- vty_out(vty, "OSPF: Key %d already exists\n", key_id);
- return CMD_WARNING;
- }
+
+ /* Remove existing key, if any */
+ ospf_crypt_key_delete(params->auth_crypt, key_id);
ck = ospf_crypt_key_new();
ck->key_id = (uint8_t)key_id;
diff --git a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
index 222478f12d..320e6d430c 100644
--- a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
+++ b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
@@ -42,13 +42,11 @@ sys.path.append(os.path.join(CWD, "../"))
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
+from lib.common_config import adjust_router_l3mdev
# Required to instantiate the topology builder class.
from mininet.topo import Topo
-l3mdev_accept = 0
-krel = ""
-
class BGPEVPNTopo(Topo):
"Test topology builder"
@@ -73,8 +71,6 @@ class BGPEVPNTopo(Topo):
def setup_module(mod):
"Sets up the pytest environment"
- global l3mdev_accept
- global krel
tgen = Topogen(BGPEVPNTopo, mod.__name__)
tgen.start_topology()
@@ -90,18 +86,13 @@ def setup_module(mod):
)
return pytest.skip("Skipping BGP EVPN RT5 NETNS Test. Kernel not supported")
- l3mdev_accept = 1
- logger.info("setting net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept))
-
# create VRF vrf-101 on R1 and R2
# create loop101
cmds_vrflite = [
- "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept),
"ip link add {}-vrf-101 type vrf table 101",
"ip ru add oif {}-vrf-101 table 101",
"ip ru add iif {}-vrf-101 table 101",
"ip link set dev {}-vrf-101 up",
- "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept),
"ip link add loop101 type dummy",
"ip link set dev loop101 master {}-vrf-101",
"ip link set dev loop101 up",
@@ -139,6 +130,7 @@ def setup_module(mod):
logger.info("result: " + output)
router = tgen.gears["r2"]
+ adjust_router_l3mdev(tgen, "r2")
for cmd in cmds_vrflite:
logger.info("cmd to r2: " + cmd.format("r2"))
output = router.run(cmd.format("r2"))
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
index 1c3c51f68e..5d97537bd0 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
@@ -84,6 +84,7 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
from lib.ltemplate import ltemplateRtrCmd
+from lib.common_config import adjust_router_l3mdev
# Required to instantiate the topology builder class.
from mininet.topo import Topo
@@ -145,26 +146,12 @@ class ThisTestTopo(Topo):
switch[1].add_link(tgen.gears["r3"], nodeif="r3-eth1")
-l3mdev_accept = 0
-
-
def ltemplatePreRouterStartHook():
- global l3mdev_accept
cc = ltemplateRtrCmd()
krel = platform.release()
tgen = get_topogen()
logger.info("pre router-start hook, kernel=" + krel)
- if (
- topotest.version_cmp(krel, "4.15") >= 0
- and topotest.version_cmp(krel, "4.18") <= 0
- ):
- l3mdev_accept = 1
-
- if topotest.version_cmp(krel, "5.0") >= 0:
- l3mdev_accept = 1
-
- logger.info("setting net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept))
# check for mpls
if tgen.hasmpls != True:
logger.info("MPLS not available, skipping setup")
@@ -187,10 +174,11 @@ def ltemplatePreRouterStartHook():
"ip ru add oif {0}-cust1 table 10",
"ip ru add iif {0}-cust1 table 10",
"ip link set dev {0}-cust1 up",
- "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept),
]
for rtr in rtrs:
- router = tgen.gears[rtr]
+ # adjust handling of VRF traffic
+ adjust_router_l3mdev(tgen, rtr)
+
for cmd in cmds:
cc.doCmd(tgen, rtr, cmd.format(rtr))
cc.doCmd(tgen, rtr, "ip link set dev {0}-eth4 master {0}-cust1".format(rtr))
@@ -229,9 +217,11 @@ def ltemplatePreRouterStartHook():
"ip ru add oif {0}-cust2 table 20",
"ip ru add iif {0}-cust2 table 20",
"ip link set dev {0}-cust2 up",
- "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept),
]
for rtr in rtrs:
+ # adjust handling of VRF traffic
+ adjust_router_l3mdev(tgen, rtr)
+
for cmd in cmds:
cc.doCmd(tgen, rtr, cmd.format(rtr))
cc.doCmd(tgen, rtr, "ip link set dev {0}-eth0 master {0}-cust2".format(rtr))
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
index 7c154ecd15..650ba20b8c 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
@@ -1,6 +1,7 @@
from lib.lutil import luCommand
-from customize import l3mdev_accept
+from lib.common_config import kernel_requires_l3mdev_adjustment
+l3mdev_accept = kernel_requires_l3mdev_adjustment()
l3mdev_rtrs = ["r1", "r3", "r4", "ce4"]
for rtr in l3mdev_rtrs:
luCommand(rtr, "sysctl net.ipv4.tcp_l3mdev_accept", " = \d*", "none", "")
diff --git a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/test_bgp_vrf_lite_ipv6_rtadv.py b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/test_bgp_vrf_lite_ipv6_rtadv.py
index 97d98415db..92ee8513e1 100644
--- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/test_bgp_vrf_lite_ipv6_rtadv.py
+++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/test_bgp_vrf_lite_ipv6_rtadv.py
@@ -42,6 +42,7 @@ sys.path.append(os.path.join(CWD, "../"))
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
+from lib.common_config import adjust_router_l3mdev
# Required to instantiate the topology builder class.
from mininet.topo import Topo
@@ -71,22 +72,6 @@ def setup_module(mod):
router_list = tgen.routers()
logger.info("Testing with VRF Lite support")
- krel = platform.release()
-
- # May need to adjust handling of vrf traffic depending on kernel version
- l3mdev_accept = 0
- if (
- topotest.version_cmp(krel, "4.15") >= 0
- and topotest.version_cmp(krel, "4.18") <= 0
- ):
- l3mdev_accept = 1
-
- if topotest.version_cmp(krel, "5.0") >= 0:
- l3mdev_accept = 1
-
- logger.info(
- "krel '{0}' setting net.ipv4.tcp_l3mdev_accept={1}".format(krel, l3mdev_accept)
- )
cmds = [
"ip link add {0}-cust1 type vrf table 1001",
@@ -99,15 +84,8 @@ def setup_module(mod):
for cmd in cmds:
output = tgen.net[rname].cmd(cmd.format(rname))
- output = tgen.net[rname].cmd("sysctl -n net.ipv4.tcp_l3mdev_accept")
- logger.info(
- "router {0}: existing tcp_l3mdev_accept was {1}".format(rname, output)
- )
-
- if l3mdev_accept:
- output = tgen.net[rname].cmd(
- "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept)
- )
+ # adjust handling of vrf traffic
+ adjust_router_l3mdev(tgen, rname)
for rname, router in router_list.items():
router.load_config(
diff --git a/tests/topotests/isis-topo1-vrf/r1/r1_topology.json b/tests/topotests/isis-topo1-vrf/r1/r1_topology.json
index 8e3cdc7bd6..1a6fe6d5c6 100644
--- a/tests/topotests/isis-topo1-vrf/r1/r1_topology.json
+++ b/tests/topotests/isis-topo1-vrf/r1/r1_topology.json
@@ -5,73 +5,73 @@
{
"vertex": "r1"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r1"
}
]
- },
+ },
"level-2": {
"ipv4": [
{
"vertex": "r1"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r1(4)",
+ "type": "IP internal",
"vertex": "10.0.20.0/24"
- },
+ },
{
- "interface": "r1-eth0",
- "metric": "10",
- "next-hop": "r3",
- "parent": "r1(4)",
- "type": "TE-IS",
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r1(4)",
+ "type": "TE-IS",
"vertex": "r3"
- },
+ },
{
- "interface": "r3",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r1-eth0",
- "type": "IP",
+ "interface": "r1-eth0",
+ "metric": "20",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
"vertex": "10.0.20.0/24"
- },
+ },
{
- "interface": "r3",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r1-eth0",
- "type": "IP",
+ "interface": "r1-eth0",
+ "metric": "20",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
"vertex": "10.0.10.0/24"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r1"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r1(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:1::/64"
- },
+ },
{
- "interface": "r1-eth0",
- "metric": "10",
- "next-hop": "r3",
- "parent": "r1(4)",
- "type": "TE-IS",
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r1(4)",
+ "type": "TE-IS",
"vertex": "r3"
- },
+ },
{
- "interface": "r3",
- "metric": "internal",
- "next-hop": "20",
- "parent": "r1-eth0",
- "type": "IP6",
+ "interface": "r1-eth0",
+ "metric": "20",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:1::/64"
}
]
diff --git a/tests/topotests/isis-topo1-vrf/r2/r2_topology.json b/tests/topotests/isis-topo1-vrf/r2/r2_topology.json
index 72022a8167..a77f7977f9 100644
--- a/tests/topotests/isis-topo1-vrf/r2/r2_topology.json
+++ b/tests/topotests/isis-topo1-vrf/r2/r2_topology.json
@@ -5,76 +5,76 @@
{
"vertex": "r2"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r2"
}
]
- },
+ },
"level-2": {
"ipv4": [
{
"vertex": "r2"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r2(4)",
+ "type": "IP internal",
"vertex": "10.0.21.0/24"
- },
+ },
{
- "interface": "r2-eth0",
- "metric": "10",
- "next-hop": "r4",
- "parent": "r2(4)",
- "type": "TE-IS",
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r2(4)",
+ "type": "TE-IS",
"vertex": "r4"
- },
+ },
{
- "interface": "r4",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r2-eth0",
- "type": "IP",
+ "interface": "r2-eth0",
+ "metric": "20",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
"vertex": "10.0.21.0/24"
- },
+ },
{
- "interface": "r4",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r2-eth0",
- "type": "IP",
+ "interface": "r2-eth0",
+ "metric": "20",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
"vertex": "10.0.11.0/24"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r2"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r2(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:2::/64"
- },
+ },
{
- "interface": "r2-eth0",
- "metric": "10",
- "next-hop": "r4",
- "parent": "r2(4)",
- "type": "TE-IS",
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r2(4)",
+ "type": "TE-IS",
"vertex": "r4"
- },
+ },
{
- "interface": "r4",
- "metric": "internal",
- "next-hop": "20",
- "parent": "r2-eth0",
- "type": "IP6",
+ "interface": "r2-eth0",
+ "metric": "20",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:2::/64"
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/tests/topotests/isis-topo1-vrf/r3/r3_topology.json b/tests/topotests/isis-topo1-vrf/r3/r3_topology.json
index 62b895766e..1e5d331965 100644
--- a/tests/topotests/isis-topo1-vrf/r3/r3_topology.json
+++ b/tests/topotests/isis-topo1-vrf/r3/r3_topology.json
@@ -4,126 +4,126 @@
"ipv4": [
{
"vertex": "r3"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP internal",
"vertex": "10.0.10.0/24"
- },
+ },
{
- "interface": "r3-eth1",
- "metric": "10",
- "next-hop": "r5",
- "parent": "r3(4)",
- "type": "TE-IS",
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "TE-IS",
"vertex": "r5"
- },
+ },
{
- "interface": "r5",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r3-eth1",
- "type": "IP",
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
"vertex": "10.0.10.0/24"
- },
+ },
{
- "interface": "r5",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r3-eth1",
- "type": "IP",
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
"vertex": "10.0.11.0/24"
- },
+ },
{
- "interface": "r5",
- "metric": "TE",
- "next-hop": "30",
- "parent": "r3-eth1",
- "type": "IP",
+ "interface": "r3-eth1",
+ "metric": "30",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP TE",
"vertex": "10.0.21.0/24"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r3"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:1::/64"
- },
+ },
{
- "interface": "r3-eth1",
- "metric": "10",
- "next-hop": "r5",
- "parent": "r3(4)",
- "type": "TE-IS",
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "TE-IS",
"vertex": "r5"
- },
+ },
{
- "interface": "r5",
- "metric": "internal",
- "next-hop": "20",
- "parent": "r3-eth1",
- "type": "IP6",
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:2::/64"
- },
+ },
{
- "interface": "r5",
- "metric": "internal",
- "next-hop": "30",
- "parent": "r3-eth1",
- "type": "IP6",
+ "interface": "r3-eth1",
+ "metric": "30",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:2::/64"
}
]
- },
+ },
"level-2": {
"ipv4": [
{
"vertex": "r3"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP internal",
"vertex": "10.0.20.0/24"
- },
+ },
{
- "interface": "r3-eth0",
- "metric": "10",
- "next-hop": "r3",
- "parent": "r3(4)",
- "type": "TE-IS",
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "TE-IS",
"vertex": "r3"
- },
+ },
{
- "interface": "r3",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r3-eth0",
- "type": "IP",
+ "interface": "r3-eth0",
+ "metric": "20",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
"vertex": "10.0.20.0/24"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r3"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:1::/64"
- },
+ },
{
- "interface": "r3-eth0",
- "metric": "10",
- "next-hop": "r3",
- "parent": "r3(4)",
- "type": "TE-IS",
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "TE-IS",
"vertex": "r3"
}
]
diff --git a/tests/topotests/isis-topo1-vrf/r4/r4_topology.json b/tests/topotests/isis-topo1-vrf/r4/r4_topology.json
index 0d69550cad..34f5ac9ca4 100644
--- a/tests/topotests/isis-topo1-vrf/r4/r4_topology.json
+++ b/tests/topotests/isis-topo1-vrf/r4/r4_topology.json
@@ -4,126 +4,126 @@
"ipv4": [
{
"vertex": "r4"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP internal",
"vertex": "10.0.11.0/24"
- },
+ },
{
- "interface": "r4-eth1",
- "metric": "10",
- "next-hop": "r5",
- "parent": "r4(4)",
- "type": "TE-IS",
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "TE-IS",
"vertex": "r5"
- },
+ },
{
- "interface": "r5",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r4-eth1",
- "type": "IP",
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
"vertex": "10.0.10.0/24"
- },
+ },
{
- "interface": "r5",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r4-eth1",
- "type": "IP",
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
"vertex": "10.0.11.0/24"
- },
+ },
{
- "interface": "r5",
- "metric": "TE",
- "next-hop": "30",
- "parent": "r4-eth1",
- "type": "IP",
+ "interface": "r4-eth1",
+ "metric": "30",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP TE",
"vertex": "10.0.20.0/24"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r4"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:2::/64"
- },
+ },
{
- "interface": "r4-eth1",
- "metric": "10",
- "next-hop": "r5",
- "parent": "r4(4)",
- "type": "TE-IS",
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "TE-IS",
"vertex": "r5"
- },
+ },
{
- "interface": "r5",
- "metric": "internal",
- "next-hop": "20",
- "parent": "r4-eth1",
- "type": "IP6",
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:1::/64"
- },
+ },
{
- "interface": "r5",
- "metric": "internal",
- "next-hop": "30",
- "parent": "r4-eth1",
- "type": "IP6",
+ "interface": "r4-eth1",
+ "metric": "30",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:1::/64"
}
]
- },
+ },
"level-2": {
"ipv4": [
{
"vertex": "r4"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP internal",
"vertex": "10.0.21.0/24"
- },
+ },
{
- "interface": "r4-eth0",
- "metric": "10",
- "next-hop": "r2",
- "parent": "r4(4)",
- "type": "TE-IS",
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r4(4)",
+ "type": "TE-IS",
"vertex": "r2"
- },
+ },
{
- "interface": "r2",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r4-eth0",
- "type": "IP",
+ "interface": "r4-eth0",
+ "metric": "20",
+ "next-hop": "r2",
+ "parent": "r2(4)",
+ "type": "IP TE",
"vertex": "10.0.21.0/24"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r4"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:2::/64"
- },
+ },
{
- "interface": "r4-eth0",
- "metric": "10",
- "next-hop": "r2",
- "parent": "r4(4)",
- "type": "TE-IS",
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r4(4)",
+ "type": "TE-IS",
"vertex": "r2"
}
]
diff --git a/tests/topotests/isis-topo1-vrf/r5/r5_topology.json b/tests/topotests/isis-topo1-vrf/r5/r5_topology.json
index b4ed6a069d..ace56536e9 100644
--- a/tests/topotests/isis-topo1-vrf/r5/r5_topology.json
+++ b/tests/topotests/isis-topo1-vrf/r5/r5_topology.json
@@ -4,121 +4,121 @@
"ipv4": [
{
"vertex": "r5"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP internal",
"vertex": "10.0.10.0/24"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP",
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP internal",
"vertex": "10.0.11.0/24"
- },
+ },
{
- "interface": "r5-eth0",
- "metric": "10",
- "next-hop": "r3",
- "parent": "r5(4)",
- "type": "TE-IS",
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r5(4)",
+ "type": "TE-IS",
"vertex": "r3"
- },
+ },
{
- "interface": "r5-eth1",
- "metric": "10",
- "next-hop": "r4",
- "parent": "r5(4)",
- "type": "TE-IS",
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r5(4)",
+ "type": "TE-IS",
"vertex": "r4"
- },
+ },
{
- "interface": "r3",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r5-eth0",
- "type": "IP",
+ "interface": "r5-eth0",
+ "metric": "20",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
"vertex": "10.0.20.0/24"
- },
+ },
{
- "interface": "r3",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r5-eth0",
- "type": "IP",
+ "interface": "r5-eth0",
+ "metric": "20",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
"vertex": "10.0.10.0/24"
- },
+ },
{
- "interface": "r4",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r5-eth1",
- "type": "IP",
+ "interface": "r5-eth1",
+ "metric": "20",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
"vertex": "10.0.21.0/24"
- },
+ },
{
- "interface": "r4",
- "metric": "TE",
- "next-hop": "20",
- "parent": "r5-eth1",
- "type": "IP",
+ "interface": "r5-eth1",
+ "metric": "20",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
"vertex": "10.0.11.0/24"
}
- ],
+ ],
"ipv6": [
{
"vertex": "r5"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:1::/64"
- },
+ },
{
- "metric": "internal",
- "parent": "0",
- "type": "IP6",
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:2:2::/64"
- },
+ },
{
- "interface": "r5-eth0",
- "metric": "10",
- "next-hop": "r3",
- "parent": "r5(4)",
- "type": "TE-IS",
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r5(4)",
+ "type": "TE-IS",
"vertex": "r3"
- },
+ },
{
- "interface": "r5-eth1",
- "metric": "10",
- "next-hop": "r4",
- "parent": "r5(4)",
- "type": "TE-IS",
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r5(4)",
+ "type": "TE-IS",
"vertex": "r4"
- },
+ },
{
- "interface": "r3",
- "metric": "internal",
- "next-hop": "20",
- "parent": "r5-eth0",
- "type": "IP6",
+ "interface": "r5-eth0",
+ "metric": "20",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:1::/64"
- },
+ },
{
- "interface": "r4",
- "metric": "internal",
- "next-hop": "20",
- "parent": "r5-eth1",
- "type": "IP6",
+ "interface": "r5-eth1",
+ "metric": "20",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
"vertex": "2001:db8:1:2::/64"
}
]
- },
+ },
"level-2": {
- "ipv4": [],
+ "ipv4": [],
"ipv6": []
}
}
-} \ No newline at end of file
+}
diff --git a/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py b/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py
index ae904ba69e..281e1f6a01 100644
--- a/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py
+++ b/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py
@@ -41,12 +41,28 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
from lib.topotest import iproute2_is_vrf_capable
-from lib.common_config import required_linux_kernel_version
+from lib.common_config import (
+ required_linux_kernel_version,
+ adjust_router_l3mdev,
+)
from mininet.topo import Topo
pytestmark = [pytest.mark.isisd]
+VERTEX_TYPE_LIST = [
+ "pseudo_IS",
+ "pseudo_TE-IS",
+ "IS",
+ "TE-IS",
+ "ES",
+ "IP internal",
+ "IP external",
+ "IP TE",
+ "IP6 internal",
+ "IP6 external",
+ "UNKNOWN"
+ ]
class ISISTopo1(Topo):
"Simple two layer ISIS vrf topology"
@@ -93,22 +109,6 @@ def setup_module(mod):
tgen.start_topology()
logger.info("Testing with VRF Lite support")
- krel = platform.release()
-
- # May need to adjust handling of vrf traffic depending on kernel version
- l3mdev_accept = 0
- if (
- topotest.version_cmp(krel, "4.15") >= 0
- and topotest.version_cmp(krel, "4.18") <= 0
- ):
- l3mdev_accept = 1
-
- if topotest.version_cmp(krel, "5.0") >= 0:
- l3mdev_accept = 1
-
- logger.info(
- "krel '{0}' setting net.ipv4.tcp_l3mdev_accept={1}".format(krel, l3mdev_accept)
- )
cmds = [
"ip link add {0}-cust1 type vrf table 1001",
@@ -122,15 +122,9 @@ def setup_module(mod):
# create VRF rx-cust1 and link rx-eth0 to rx-cust1
for cmd in cmds:
output = tgen.net[rname].cmd(cmd.format(rname))
- output = tgen.net[rname].cmd("sysctl -n net.ipv4.tcp_l3mdev_accept")
- logger.info(
- "router {0}: existing tcp_l3mdev_accept was {1}".format(rname, output)
- )
- if l3mdev_accept:
- output = tgen.net[rname].cmd(
- "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept)
- )
+ # adjust handling of vrf traffic
+ adjust_router_l3mdev(tgen, rname)
for rname, router in tgen.routers().items():
router.load_config(
@@ -316,6 +310,7 @@ def parse_topology(lines, level):
areas = {}
area = None
ipv = None
+ vertex_type_regex = "|".join(VERTEX_TYPE_LIST)
for line in lines:
area_match = re.match(r"Area (.+):", line)
@@ -335,44 +330,50 @@ def parse_topology(lines, level):
ipv = "ipv4"
continue
- item_match = re.match(r"([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)", line)
- if item_match is not None:
+ item_match = re.match(r"([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+)"
+ , line)
+ if (
+ item_match is not None
+ and item_match.group(1) == "Vertex"
+ and item_match.group(2) == "Type"
+ and item_match.group(3) == "Metric"
+ and item_match.group(4) == "Next-Hop"
+ and item_match.group(5) == "Interface"
+ and item_match.group(6) == "Parent"
+ ):
# Skip header
- if (
- item_match.group(1) == "Vertex"
- and item_match.group(2) == "Type"
- and item_match.group(3) == "Metric"
- and item_match.group(4) == "Next-Hop"
- and item_match.group(5) == "Interface"
- and item_match.group(6) == "Parent"
- ):
- continue
+ continue
+ item_match = re.match(r"([^\s]+) ({}) ([0]|([1-9][0-9]*)) ([^\s]+) ([^\s]+) ([^\s]+)"
+ .format(vertex_type_regex), line)
+ if item_match is not None:
areas[area][level][ipv].append(
{
"vertex": item_match.group(1),
"type": item_match.group(2),
"metric": item_match.group(3),
- "next-hop": item_match.group(4),
- "interface": item_match.group(5),
- "parent": item_match.group(6),
+ "next-hop": item_match.group(5),
+ "interface": item_match.group(6),
+ "parent": item_match.group(7),
}
)
continue
- item_match = re.match(r"([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)", line)
+ item_match = re.match(r"([^\s]+) ({}) ([0]|([1-9][0-9]*)) ([^\s]+)"
+ .format(vertex_type_regex), line)
+
if item_match is not None:
areas[area][level][ipv].append(
{
"vertex": item_match.group(1),
"type": item_match.group(2),
"metric": item_match.group(3),
- "parent": item_match.group(4),
+ "parent": item_match.group(5),
}
)
continue
- item_match = re.match(r"([^ ]+)", line)
+ item_match = re.match(r"([^\s]+)", line)
if item_match is not None:
areas[area][level][ipv].append({"vertex": item_match.group(1)})
continue
diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py
index 2224b4f3a3..55266594e3 100644
--- a/tests/topotests/lib/common_config.py
+++ b/tests/topotests/lib/common_config.py
@@ -4512,3 +4512,53 @@ def verify_ip_nht(tgen, input_dict):
logger.debug("Exiting lib API: verify_ip_nht()")
return False
+
+
+def kernel_requires_l3mdev_adjustment():
+ """
+ Checks if the L3 master device needs to be adjusted to handle VRF traffic
+ based on kernel version.
+
+ Returns
+ -------
+ 1 or 0
+ """
+
+ if version_cmp(platform.release(), "4.15") >= 0:
+ return 1
+ return 0
+
+
+def adjust_router_l3mdev(tgen, router):
+ """
+ Adjusts a routers L3 master device to handle VRF traffic depending on kernel
+ version.
+
+ Parameters
+ ----------
+ * `tgen` : tgen object
+ * `router` : router id to be configured.
+
+ Returns
+ -------
+ True
+ """
+
+ l3mdev_accept = kernel_requires_l3mdev_adjustment()
+
+ logger.info(
+ "router {0}: setting net.ipv4.tcp_l3mdev_accept={1}".format(
+ router, l3mdev_accept
+ )
+ )
+
+ output = tgen.net[router].cmd("sysctl -n net.ipv4.tcp_l3mdev_accept")
+ logger.info(
+ "router {0}: existing tcp_l3mdev_accept was {1}".format(router, output)
+ )
+
+ tgen.net[router].cmd(
+ "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept)
+ )
+
+ return True
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py
index 104b215078..aaa2c70ad1 100644
--- a/tests/topotests/lib/topotest.py
+++ b/tests/topotests/lib/topotest.py
@@ -544,8 +544,7 @@ def iproute2_is_vrf_capable():
["ip", "route", "show", "vrf"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- stdin=subprocess.PIPE,
- encoding="utf-8"
+ stdin=subprocess.PIPE
)
iproute2_err = subp.communicate()[1].splitlines()[0].split()[0]