From 4b8daf6b819f73f89956931039030363a99dfa92 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Thu, 27 Oct 2022 14:45:53 +0200 Subject: [PATCH] tests: adapt cspf_topo1 to the default link-params bandwidth Adapt cspf_topo1 to the default link-params bandwidth Signed-off-by: Louis Scalbert --- tests/topotests/cspf_topo1/r1/zebra.conf | 1 + tests/topotests/cspf_topo1/r2/zebra.conf | 1 + .../cspf_topo1/reference/sharp-ted.json | 280 +++++++++--------- tests/topotests/cspf_topo1/test_cspf_topo1.py | 102 +++++-- 4 files changed, 225 insertions(+), 159 deletions(-) diff --git a/tests/topotests/cspf_topo1/r1/zebra.conf b/tests/topotests/cspf_topo1/r1/zebra.conf index 3aa0cad439..3b615b0cb4 100644 --- a/tests/topotests/cspf_topo1/r1/zebra.conf +++ b/tests/topotests/cspf_topo1/r1/zebra.conf @@ -10,6 +10,7 @@ interface r1-eth0 link-params metric 20 delay 10000 + max-bw 10e+10 ava-bw 1.25e+08 enable exit-link-params diff --git a/tests/topotests/cspf_topo1/r2/zebra.conf b/tests/topotests/cspf_topo1/r2/zebra.conf index 1cc37ba124..55d9563b61 100644 --- a/tests/topotests/cspf_topo1/r2/zebra.conf +++ b/tests/topotests/cspf_topo1/r2/zebra.conf @@ -37,6 +37,7 @@ interface r2-eth3 link-params metric 25 delay 25000 + max-bw 10e+10 use-bw 1.25e+8 enable exit-link-params diff --git a/tests/topotests/cspf_topo1/reference/sharp-ted.json b/tests/topotests/cspf_topo1/reference/sharp-ted.json index d3d1f9e406..da240e87a3 100644 --- a/tests/topotests/cspf_topo1/reference/sharp-ted.json +++ b/tests/topotests/cspf_topo1/reference/sharp-ted.json @@ -64,32 +64,32 @@ "te-metric":10, "local-address-v6":"2001:db8:1::1:1", "remote-address-v6":"2001:db8:1::1:2", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":20000 @@ -107,32 +107,32 @@ "te-metric":10, "local-address-v6":"2001:db8:1::1:2", "remote-address-v6":"2001:db8:1::1:1", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":20000 @@ -150,32 +150,32 @@ "te-metric":40, "local-address-v6":"2001:db8:3::3:2", "remote-address-v6":"2001:db8:3::3:3", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":40000 @@ -194,32 +194,32 @@ "admin-group":32, "local-address-v6":"2001:db8:3::3:3", "remote-address-v6":"2001:db8:3::3:2", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":25000 @@ -237,32 +237,32 @@ "te-metric":10, "local-address-v6":"2001:db8:5::3:4", "remote-address-v6":"2001:db8:5::4:3", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":10000 @@ -286,32 +286,32 @@ "te-metric":10, "local-address-v6":"2001:db8:5::4:3", "remote-address-v6":"2001:db8:5::3:4", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":10000 @@ -329,32 +329,32 @@ "te-metric":20, "local-address":"10.0.0.1", "remote-address":"10.0.0.2", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":99999997952, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":10000, @@ -373,32 +373,32 @@ "te-metric":20, "local-address":"10.0.0.2", "remote-address":"10.0.0.1", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":10000 @@ -416,32 +416,32 @@ "te-metric":10, "local-address":"10.0.1.1", "remote-address":"10.0.1.2", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":20000 @@ -459,32 +459,32 @@ "te-metric":10, "local-address":"10.0.1.2", "remote-address":"10.0.1.1", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":20000 @@ -502,32 +502,32 @@ "te-metric":40, "local-address":"10.0.3.2", "remote-address":"10.0.3.3", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":40000 @@ -546,32 +546,32 @@ "admin-group":32, "local-address":"10.0.3.3", "remote-address":"10.0.3.2", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":25000 @@ -589,32 +589,32 @@ "te-metric":25, "local-address":"10.0.4.2", "remote-address":"10.0.4.4", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":99999997952, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":25000, @@ -633,32 +633,32 @@ "te-metric":40, "local-address":"10.0.4.4", "remote-address":"10.0.4.2", - "max-link-bandwidth":176258176.0, - "max-resv-link-bandwidth":176258176.0, + "max-link-bandwidth":1250000, + "max-resv-link-bandwidth":1250000, "unreserved-bandwidth":[ { - "class-type-0":176258176.0 + "class-type-0":1250000 }, { - "class-type-1":176258176.0 + "class-type-1":1250000 }, { - "class-type-2":176258176.0 + "class-type-2":1250000 }, { - "class-type-3":176258176.0 + "class-type-3":1250000 }, { - "class-type-4":176258176.0 + "class-type-4":1250000 }, { - "class-type-5":176258176.0 + "class-type-5":1250000 }, { - "class-type-6":176258176.0 + "class-type-6":1250000 }, { - "class-type-7":176258176.0 + "class-type-7":1250000 } ], "delay":40000 diff --git a/tests/topotests/cspf_topo1/test_cspf_topo1.py b/tests/topotests/cspf_topo1/test_cspf_topo1.py index 1b71ac3a17..220ec49768 100644 --- a/tests/topotests/cspf_topo1/test_cspf_topo1.py +++ b/tests/topotests/cspf_topo1/test_cspf_topo1.py @@ -169,13 +169,19 @@ def compare_cspf_output(tgen, rname, fileref, src, dst, cost, bw=""): filename = "{}/reference/{}".format(CWD, fileref) expected = open(filename).read() - command = "show sharp cspf source {} destination {} {} {}".format(src, dst, cost, bw) + command = "show sharp cspf source {} destination {} {} {}".format( + src, dst, cost, bw + ) # Run test function until we get an result. Wait at most 60 seconds. - test_func = partial(topotest.router_output_cmp, tgen.gears[rname], command, expected) + test_func = partial( + topotest.router_output_cmp, tgen.gears[rname], command, expected + ) result, diff = topotest.run_and_expect(test_func, "", count=2, wait=2) - assert result, "CSPF output mismatches the expected result on {}:\n{}".format(rname, diff) - + assert result, "CSPF output mismatches the expected result on {}:\n{}".format( + rname, diff + ) + def setup_testcase(msg): "Setup test case" @@ -207,10 +213,24 @@ def test_step2(): tgen = setup_testcase("Step2: CSPF(r1, r4, IPv4)") - compare_cspf_output(tgen, "r1", "cspf-ipv4-metric.txt", "10.0.0.1", "10.0.255.4", "metric 50") - compare_cspf_output(tgen, "r1", "cspf-ipv4-te-metric.txt", "10.0.255.1", "10.0.4.4", "te-metric 50") - compare_cspf_output(tgen, "r1", "cspf-ipv4-delay.txt", "10.0.255.1", "10.0.255.4", "delay 50000") - compare_cspf_output(tgen, "r1", "cspf-ipv4-delay.txt", "10.0.255.1", "10.0.255.4", "delay 50000", "rsv 7 100000000") + compare_cspf_output( + tgen, "r1", "cspf-ipv4-metric.txt", "10.0.0.1", "10.0.255.4", "metric 50" + ) + compare_cspf_output( + tgen, "r1", "cspf-ipv4-te-metric.txt", "10.0.255.1", "10.0.4.4", "te-metric 50" + ) + compare_cspf_output( + tgen, "r1", "cspf-ipv4-delay.txt", "10.0.255.1", "10.0.255.4", "delay 50000" + ) + compare_cspf_output( + tgen, + "r1", + "cspf-ipv4-delay.txt", + "10.0.255.1", + "10.0.255.4", + "delay 50000", + "rsv 7 1000000", + ) def test_step3(): @@ -218,10 +238,34 @@ def test_step3(): tgen = setup_testcase("Step2: CSPF(r1, r4, IPv6)") - compare_cspf_output(tgen, "r1", "cspf-ipv6-metric.txt", "2001:db8:1::1:1", "2001:db8::4", "metric 50") - compare_cspf_output(tgen, "r1", "cspf-ipv6-te-metric.txt", "2001:db8::1", "2001:db8:5::3:4", "te-metric 80") - compare_cspf_output(tgen, "r1", "cspf-ipv6-delay.txt", "2001:db8::1", "2001:db8::4", "delay 80000") - compare_cspf_output(tgen, "r1", "cspf-ipv6-delay.txt", "2001:db8::1", "2001:db8::4", "delay 80000", "rsv 7 100000000") + compare_cspf_output( + tgen, + "r1", + "cspf-ipv6-metric.txt", + "2001:db8:1::1:1", + "2001:db8::4", + "metric 50", + ) + compare_cspf_output( + tgen, + "r1", + "cspf-ipv6-te-metric.txt", + "2001:db8::1", + "2001:db8:5::3:4", + "te-metric 80", + ) + compare_cspf_output( + tgen, "r1", "cspf-ipv6-delay.txt", "2001:db8::1", "2001:db8::4", "delay 80000" + ) + compare_cspf_output( + tgen, + "r1", + "cspf-ipv6-delay.txt", + "2001:db8::1", + "2001:db8::4", + "delay 80000", + "rsv 7 1000000", + ) def test_step4(): @@ -229,13 +273,33 @@ def test_step4(): tgen = setup_testcase("Step2: CSPF(r1, r4, failure)") - compare_cspf_output(tgen, "r1", "cspf-failed.txt", "10.0.255.1", "10.0.255.4", "metric 10") - compare_cspf_output(tgen, "r1", "cspf-failed.txt", "2001:db8::1", "2001:db8::4", "te-metric 50") - compare_cspf_output(tgen, "r1", "cspf-failed.txt", "10.0.255.1", "10.0.255.4", "delay 5000") - compare_cspf_output(tgen, "r1", "cspf-failed.txt", "2001:db8::1", "2001:db8::4", "delay 80000", "rsv 7 1000000000") - compare_cspf_output(tgen, "r1", "cspf-failed-src.txt", "10.0.0.3", "10.0.255.4", "metric 10") - compare_cspf_output(tgen, "r1", "cspf-failed-dst.txt", "10.0.0.1", "10.0.4.40", "metric 10") - compare_cspf_output(tgen, "r1", "cspf-failed-same.txt", "10.0.0.1", "10.0.0.1", "metric 10") + compare_cspf_output( + tgen, "r1", "cspf-failed.txt", "10.0.255.1", "10.0.255.4", "metric 10" + ) + compare_cspf_output( + tgen, "r1", "cspf-failed.txt", "2001:db8::1", "2001:db8::4", "te-metric 50" + ) + compare_cspf_output( + tgen, "r1", "cspf-failed.txt", "10.0.255.1", "10.0.255.4", "delay 5000" + ) + compare_cspf_output( + tgen, + "r1", + "cspf-failed.txt", + "2001:db8::1", + "2001:db8::4", + "delay 80000", + "rsv 7 10000000", + ) + compare_cspf_output( + tgen, "r1", "cspf-failed-src.txt", "10.0.0.3", "10.0.255.4", "metric 10" + ) + compare_cspf_output( + tgen, "r1", "cspf-failed-dst.txt", "10.0.0.1", "10.0.4.40", "metric 10" + ) + compare_cspf_output( + tgen, "r1", "cspf-failed-same.txt", "10.0.0.1", "10.0.0.1", "metric 10" + ) def test_memory_leak(): -- 2.39.5