Merge pull request #13258 from donaldsharp/evpn_ping

Evpn ping
This commit is contained in:
Mark Stapp 2023-04-11 16:15:44 -04:00 committed by GitHub
commit f827dc810c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 18 deletions

View File

@ -83,6 +83,7 @@ def build_topo(tgen):
switch.add_link(tgen.gears["PE2"]) switch.add_link(tgen.gears["PE2"])
switch.add_link(tgen.gears["host2"]) switch.add_link(tgen.gears["host2"])
def setup_pe_router(tgen, pe_name, tunnel_local_ip, svi_ip, intf): def setup_pe_router(tgen, pe_name, tunnel_local_ip, svi_ip, intf):
pe = tgen.gears[pe_name] pe = tgen.gears[pe_name]
@ -100,7 +101,9 @@ def setup_pe_router(tgen, pe_name, tunnel_local_ip, svi_ip, intf):
# setup single vxlan device # setup single vxlan device
pe.run( pe.run(
"ip link add dev vxlan0 type vxlan dstport 4789 local {0} nolearning external".format(tunnel_local_ip) "ip link add dev vxlan0 type vxlan dstport 4789 local {0} nolearning external".format(
tunnel_local_ip
)
) )
pe.run("ip link set dev vxlan0 master bridge") pe.run("ip link set dev vxlan0 master bridge")
pe.run("bridge link set dev vxlan0 vlan_tunnel on") pe.run("bridge link set dev vxlan0 vlan_tunnel on")
@ -136,10 +139,12 @@ def setup_pe_router(tgen, pe_name, tunnel_local_ip, svi_ip, intf):
pe.run("bridge vlan add dev vxlan0 vid 300") pe.run("bridge vlan add dev vxlan0 vid 300")
pe.run("bridge vlan add dev vxlan0 vid 300 tunnel_info id 300") pe.run("bridge vlan add dev vxlan0 vid 300 tunnel_info id 300")
def setup_p_router(tgen, p_name): def setup_p_router(tgen, p_name):
p1 = tgen.gears[p_name] p1 = tgen.gears[p_name]
p1.run("sysctl -w net.ipv4.ip_forward=1") p1.run("sysctl -w net.ipv4.ip_forward=1")
def setup_module(mod): def setup_module(mod):
"Sets up the pytest environment" "Sets up the pytest environment"
@ -204,17 +209,21 @@ def check_vni_macs_present(tgen, router, vni, maclist):
) )
return None return None
def check_flood_entry_present(pe, vni, vtep): def check_flood_entry_present(pe, vni, vtep):
if not topotest.iproute2_is_fdb_get_capable(): if not topotest.iproute2_is_fdb_get_capable():
return None return None
output = pe.run("bridge fdb get 00:00:00:00:00:00 dev vxlan0 vni {} self".format(vni)) output = pe.run(
"bridge fdb get 00:00:00:00:00:00 dev vxlan0 vni {} self".format(vni)
)
if str(vtep) not in output: if str(vtep) not in output:
return output return output
return None return None
def test_pe1_converge_evpn(): def test_pe1_converge_evpn():
"Wait for protocol convergence" "Wait for protocol convergence"
@ -231,6 +240,15 @@ def test_pe1_converge_evpn():
_, result = topotest.run_and_expect(test_func, None, count=45, wait=1) _, result = topotest.run_and_expect(test_func, None, count=45, wait=1)
assertmsg = '"{}" JSON output mismatches'.format(pe1.name) assertmsg = '"{}" JSON output mismatches'.format(pe1.name)
# Let's ensure that the hosts have actually tried talking to
# each other. Otherwise under certain startup conditions
# they may not actually do any l2 arp'ing and as such
# the bridges won't know about the hosts on their networks
host1 = tgen.gears["host1"]
host1.run("ping -c 1 10.10.1.56")
host2 = tgen.gears["host2"]
host2.run("ping -c 1 10.10.1.55")
test_func = partial( test_func = partial(
check_vni_macs_present, check_vni_macs_present,
tgen, tgen,
@ -249,6 +267,7 @@ def test_pe1_converge_evpn():
assertmsg = '"{}" Flood FDB Entry for VTEP {} not found'.format(pe1.name, vtep) assertmsg = '"{}" Flood FDB Entry for VTEP {} not found'.format(pe1.name, vtep)
assert result is None, assertmsg assert result is None, assertmsg
def test_pe2_converge_evpn(): def test_pe2_converge_evpn():
"Wait for protocol convergence" "Wait for protocol convergence"
@ -284,6 +303,7 @@ def test_pe2_converge_evpn():
assertmsg = '"{}" Flood FDB Entry for VTEP {} not found'.format(pe2.name, vtep) assertmsg = '"{}" Flood FDB Entry for VTEP {} not found'.format(pe2.name, vtep)
assert result is None, assertmsg assert result is None, assertmsg
def mac_learn_test(host, local): def mac_learn_test(host, local):
"check the host MAC gets learned by the VNI" "check the host MAC gets learned by the VNI"
@ -489,6 +509,7 @@ def test_ip_pe2_learn():
ip_learn_test(tgen, host2, pe2, pe1, "10.10.1.56") ip_learn_test(tgen, host2, pe2, pe1, "10.10.1.56")
# tgen.mininet_cli() # tgen.mininet_cli()
def show_dvni_route(pe, vni, prefix, vrf): def show_dvni_route(pe, vni, prefix, vrf):
output = pe.vtysh_cmd("show ip route vrf {} {}".format(vrf, prefix)) output = pe.vtysh_cmd("show ip route vrf {} {}".format(vrf, prefix))
@ -502,6 +523,7 @@ def show_dvni_route(pe, vni, prefix, vrf):
return None return None
def test_dvni(): def test_dvni():
"test Downstream VNI works as expected importing into PE1" "test Downstream VNI works as expected importing into PE1"

View File

@ -164,6 +164,15 @@ def test_pe1_converge_evpn():
_, result = topotest.run_and_expect(test_func, None, count=45, wait=1) _, result = topotest.run_and_expect(test_func, None, count=45, wait=1)
assertmsg = '"{}" JSON output mismatches'.format(pe1.name) assertmsg = '"{}" JSON output mismatches'.format(pe1.name)
# Let's ensure that the hosts have actually tried talking to
# each other. Otherwise under certain startup conditions
# they may not actually do any l2 arp'ing and as such
# the bridges won't know about the hosts on their networks
host1 = tgen.gears["host1"]
host1.run("ping -c 1 10.10.1.56")
host2 = tgen.gears["host2"]
host2.run("ping -c 1 10.10.1.55")
test_func = partial( test_func = partial(
check_vni_macs_present, check_vni_macs_present,
tgen, tgen,
@ -171,6 +180,7 @@ def test_pe1_converge_evpn():
101, 101,
(("host1", "host1-eth0"), ("host2", "host2-eth0")), (("host1", "host1-eth0"), ("host2", "host2-eth0")),
) )
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
if result: if result:
logger.warning("%s", result) logger.warning("%s", result)