]> git.proxmox.com Git - mirror_frr.git/commitdiff
tests: remove ifindex from VNI JSON comparison
authorPat Ruddy <pat@voltanet.io>
Tue, 2 Jun 2020 10:47:24 +0000 (11:47 +0100)
committerPat Ruddy <pat@voltanet.io>
Wed, 12 Aug 2020 11:39:33 +0000 (12:39 +0100)
Since the values of ifindices cannot be relied upon across
distributions, simpy remove them from the VNI JSON being compared.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
tests/topotests/bgp-evpn-vxlan_topo1/PE1/evpn.vni.json
tests/topotests/bgp-evpn-vxlan_topo1/PE2/evpn.vni.json
tests/topotests/bgp-evpn-vxlan_topo1/test_bgp_evpn_vxlan.py

index ce16089b89fde46106c763572456fd3e12f85d8d..293750424463b6a57047229ef663f5297b5fb321 100644 (file)
@@ -3,7 +3,6 @@
   "type":"L2",
   "vrf":"default",
   "vxlanInterface":"vxlan101",
-  "ifindex":5,
   "vtepIp":"10.10.10.10",
   "mcastGroup":"0.0.0.0",
   "advertiseGatewayMacip":"No",
index 1ac83c495e2db9021707683b68201f3ad93284b1..0853147a00c1915856ab9354cadd4642d22eee36 100644 (file)
@@ -3,7 +3,6 @@
   "type":"L2",
   "vrf":"default",
   "vxlanInterface":"vxlan101",
-  "ifindex":5,
   "vtepIp":"10.30.30.30",
   "mcastGroup":"0.0.0.0",
   "advertiseGatewayMacip":"No",
index 7ed4c6e7e22517698384efd44efc67858d012394..90144f5c66f9fa4dd818b5de33c07313760ae1da 100755 (executable)
@@ -145,6 +145,15 @@ def teardown_module(mod):
     tgen.stop_topology()
 
 
+def show_vni_json_elide_ifindex(pe, vni, expected):
+    output_json = pe.vtysh_cmd("show evpn vni {} json".format(vni), isjson=True)
+
+    if "ifindex" in output_json:
+        output_json.pop("ifindex")
+
+    return topotest.json_cmp(output_json, expected)
+
+
 def test_pe1_converge_evpn():
     "Wait for protocol convergence"
 
@@ -157,9 +166,7 @@ def test_pe1_converge_evpn():
     json_file = "{}/{}/evpn.vni.json".format(CWD, pe1.name)
     expected = json.loads(open(json_file).read())
 
-    test_func = partial(
-        topotest.router_json_cmp, pe1, "show evpn vni 101 json", expected
-    )
+    test_func = partial(show_vni_json_elide_ifindex, pe1, 101, expected)
     _, result = topotest.run_and_expect(test_func, None, count=125, wait=1)
     assertmsg = '"{}" JSON output mismatches'.format(pe1.name)
     assert result is None, assertmsg
@@ -178,9 +185,7 @@ def test_pe2_converge_evpn():
     json_file = "{}/{}/evpn.vni.json".format(CWD, pe2.name)
     expected = json.loads(open(json_file).read())
 
-    test_func = partial(
-        topotest.router_json_cmp, pe2, "show evpn vni 101 json", expected
-    )
+    test_func = partial(show_vni_json_elide_ifindex, pe2, 101, expected)
     _, result = topotest.run_and_expect(test_func, None, count=125, wait=1)
     assertmsg = '"{}" JSON output mismatches'.format(pe2.name)
     assert result is None, assertmsg