From 6bf6282da9d6da5d102c5060f1233b2dffe44d7d Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Tue, 16 Feb 2021 11:17:04 -0800 Subject: [PATCH] tests: increase ping attempts in EVPN MH to fix failures on ARM There are two fixes to handle slow convergence on ARM - 1. Ping on every re-try attempt to account for initial packet loss 2. Handle incomplete show outputs gracefully Signed-off-by: Anuradha Karuppiah --- tests/topotests/bgp-evpn-mh/test_evpn_mh.py | 26 ++++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py index aec78179ff..48ad8144a2 100644 --- a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py +++ b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py @@ -482,7 +482,7 @@ def check_es(dut): curr_es_set.append(esi) types = es["type"] vtep_ips = [] - for vtep in es["vteps"]: + for vtep in es.get("vteps", []): vtep_ips.append(vtep["vtep_ip"]) if "local" in types: @@ -513,7 +513,7 @@ def check_one_es(dut, esi, down_vteps): esi = es["esi"] types = es["type"] vtep_ips = [] - for vtep in es["vteps"]: + for vtep in es.get("vteps", []): vtep_ips.append(vtep["vtep_ip"]) if "local" in types: @@ -593,11 +593,24 @@ def test_evpn_ead_update(): # tgen.mininet_cli() -def check_mac(dut, vni, mac, m_type, esi, intf): +def ping_anycast_gw(tgen): + local_host = tgen.gears["hostd11"] + remote_host = tgen.gears["hostd21"] + + # ping the anycast gw from the local and remote hosts to populate + # the mac address on the PEs + cmd_str = "arping -I torbond -c 1 45.0.0.1" + local_host.run(cmd_str) + remote_host.run(cmd_str) + +def check_mac(dut, vni, mac, m_type, esi, intf, ping_gw=False, tgen=None): """ checks if mac is present and if desination matches the one provided """ + if ping_gw: + ping_anycast_gw(tgen) + out = dut.vtysh_cmd("show evpn mac vni %d mac %s json" % (vni, mac)) mac_js = json.loads(out) @@ -627,11 +640,6 @@ def test_evpn_mac(): tors.append(tgen.gears["torm11"]) tors.append(tgen.gears["torm12"]) - # ping the anycast gw from the local and remote hosts to populate - # the mac address on the PEs - local_host.run("arping -I torbond -c 1 45.0.0.1") - remote_host.run("arping -I torbond -c 1 45.0.0.1") - vni = 1000 # check if the rack-1 host MAC is present on all rack-1 PEs @@ -642,7 +650,7 @@ def test_evpn_mac(): intf = "hostbond1" for tor in tors: - test_fn = partial(check_mac, tor, vni, mac, m_type, esi, intf) + test_fn = partial(check_mac, tor, vni, mac, m_type, esi, intf, True, tgen) _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) assertmsg = '"{}" local MAC content incorrect'.format(tor.name) assert result is None, assertmsg -- 2.39.5