diff options
Diffstat (limited to 'tests/topotests/multicast_features/test_multicast_features.py')
| -rw-r--r-- | tests/topotests/multicast_features/test_multicast_features.py | 126 |
1 files changed, 78 insertions, 48 deletions
diff --git a/tests/topotests/multicast_features/test_multicast_features.py b/tests/topotests/multicast_features/test_multicast_features.py index d901eddaa1..bce1c91e31 100644 --- a/tests/topotests/multicast_features/test_multicast_features.py +++ b/tests/topotests/multicast_features/test_multicast_features.py @@ -172,13 +172,13 @@ def test_pim_convergence(): # IPv6 part # out = tgen.gears["r1"].vtysh_cmd("show interface r1-eth0 json", True) - r1_r2_link_address = out["r1-eth0"]["ipAddresses"][1]["address"].split('/')[0] + r1_r2_link_address = out["r1-eth0"]["ipAddresses"][1]["address"].split("/")[0] out = tgen.gears["r1"].vtysh_cmd("show interface r1-eth1 json", True) - r1_r3_link_address = out["r1-eth1"]["ipAddresses"][1]["address"].split('/')[0] + r1_r3_link_address = out["r1-eth1"]["ipAddresses"][1]["address"].split("/")[0] out = tgen.gears["r2"].vtysh_cmd("show interface r2-eth0 json", True) - r2_link_address = out["r2-eth0"]["ipAddresses"][1]["address"].split('/')[0] + r2_link_address = out["r2-eth0"]["ipAddresses"][1]["address"].split("/")[0] out = tgen.gears["r3"].vtysh_cmd("show interface r3-eth0 json", True) - r3_link_address = out["r3-eth0"]["ipAddresses"][1]["address"].split('/')[0] + r3_link_address = out["r3-eth0"]["ipAddresses"][1]["address"].split("/")[0] expect_pim_peer("r1", "ipv6", "r1-eth0", r2_link_address) expect_pim_peer("r2", "ipv6", "r2-eth0", r1_r2_link_address) @@ -191,11 +191,13 @@ def test_igmp_group_limit(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 ip igmp max-groups 4 - """) + """ + ) app_helper.run("h1", ["224.0.100.1", "h1-eth0"]) app_helper.run("h1", ["224.0.100.2", "h1-eth0"]) app_helper.run("h1", ["224.0.100.3", "h1-eth0"]) @@ -204,7 +206,9 @@ def test_igmp_group_limit(): app_helper.run("h1", ["224.0.100.6", "h1-eth0"]) def expect_igmp_group_count(): - igmp_groups = tgen.gears["r1"].vtysh_cmd("show ip igmp groups json", isjson=True) + igmp_groups = tgen.gears["r1"].vtysh_cmd( + "show ip igmp groups json", isjson=True + ) try: return len(igmp_groups["r1-eth2"]["groups"]) except KeyError: @@ -214,13 +218,15 @@ def test_igmp_group_limit(): # Cleanup app_helper.stop_host("h1") - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 no ip igmp max-groups 4 exit clear ip igmp interfaces - """) + """ + ) def test_igmp_group_source_limit(): @@ -229,12 +235,14 @@ def test_igmp_group_source_limit(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 ip igmp max-sources 4 exit - """) + """ + ) app_helper.run("h1", ["--source=192.168.100.10", "232.0.101.10", "h1-eth0"]) app_helper.run("h1", ["--source=192.168.100.11", "232.0.101.10", "h1-eth0"]) @@ -245,7 +253,9 @@ def test_igmp_group_source_limit(): app_helper.run("h1", ["--source=192.168.100.16", "232.0.101.10", "h1-eth0"]) def expect_igmp_group_source_count(): - igmp_sources = tgen.gears["r1"].vtysh_cmd("show ip igmp sources json", isjson=True) + igmp_sources = tgen.gears["r1"].vtysh_cmd( + "show ip igmp sources json", isjson=True + ) try: return len(igmp_sources["r1-eth2"]["232.0.101.10"]["sources"]) except KeyError: @@ -254,13 +264,15 @@ def test_igmp_group_source_limit(): topotest.run_and_expect(expect_igmp_group_source_count, 4, count=10, wait=2) # Cleanup - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 no ip igmp max-sources 4 exit clear ip igmp interfaces - """) + """ + ) app_helper.stop_host("h1") @@ -270,11 +282,13 @@ def test_mld_group_limit(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 ipv6 mld max-groups 14 - """) + """ + ) app_helper.run("h1", ["FF05::100", "h1-eth0"]) app_helper.run("h1", ["FF05::101", "h1-eth0"]) app_helper.run("h1", ["FF05::102", "h1-eth0"]) @@ -293,25 +307,27 @@ def test_mld_group_limit(): app_helper.run("h1", ["FF05::115", "h1-eth0"]) def expect_mld_group_count(): - mld_groups = tgen.gears["r1"].vtysh_cmd("show ipv6 mld groups json", isjson=True) + mld_groups = tgen.gears["r1"].vtysh_cmd( + "show ipv6 mld groups json", isjson=True + ) try: return len(mld_groups["r1-eth2"]["groups"]) except KeyError: return 0 - topotest.run_and_expect(expect_mld_group_count, 14, count=10, wait=2) - # Cleanup app_helper.stop_host("h1") - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 no ipv6 mld max-groups 4 exit clear ipv6 mld interfaces - """) + """ + ) def test_mld_group_source_limit(): @@ -320,12 +336,14 @@ def test_mld_group_source_limit(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 ipv6 mld max-sources 4 exit - """) + """ + ) app_helper.run("h1", ["--source=2001:db8:1::100", "FF35::100", "h1-eth0"]) app_helper.run("h1", ["--source=2001:db8:1::101", "FF35::100", "h1-eth0"]) @@ -336,7 +354,9 @@ def test_mld_group_source_limit(): app_helper.run("h1", ["--source=2001:db8:1::106", "FF35::100", "h1-eth0"]) def expect_mld_source_group_count(): - mld_sources = tgen.gears["r1"].vtysh_cmd("show ipv6 mld joins json", isjson=True) + mld_sources = tgen.gears["r1"].vtysh_cmd( + "show ipv6 mld joins json", isjson=True + ) try: return len(mld_sources["default"]["r1-eth2"]["ff35::100"].keys()) except KeyError: @@ -345,13 +365,15 @@ def test_mld_group_source_limit(): topotest.run_and_expect(expect_mld_source_group_count, 4, count=10, wait=2) # Cleanup - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 no ipv6 mld max-sources 4 exit clear ipv6 mld interfaces - """) + """ + ) app_helper.stop_host("h1") @@ -362,20 +384,23 @@ def test_igmp_immediate_leave(): pytest.skip(tgen.errors) topotest.sysctl_assure( - tgen.gears["h1"], - "net.ipv4.conf.h1-eth0.force_igmp_version", - "2") - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["h1"], "net.ipv4.conf.h1-eth0.force_igmp_version", "2" + ) + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 ip igmp immediate-leave - """) + """ + ) app_helper.run("h1", ["224.0.110.1", "h1-eth0"]) app_helper.run("h3", ["224.0.110.1", "h3-eth0"]) def expect_igmp_group(): - igmp_groups = tgen.gears["r1"].vtysh_cmd("show ip igmp groups json", isjson=True) + igmp_groups = tgen.gears["r1"].vtysh_cmd( + "show ip igmp groups json", isjson=True + ) try: for group in igmp_groups["r1-eth2"]["groups"]: if group["group"] == "224.0.110.1": @@ -392,15 +417,16 @@ def test_igmp_immediate_leave(): topotest.run_and_expect(expect_igmp_group, False, count=10, wait=2) # Clean up - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 no ip igmp immediate-leave - """) + """ + ) topotest.sysctl_assure( - tgen.gears["h1"], - "net.ipv4.conf.h1-eth0.force_igmp_version", - "0") + tgen.gears["h1"], "net.ipv4.conf.h1-eth0.force_igmp_version", "0" + ) app_helper.stop_host("h3") @@ -411,20 +437,23 @@ def test_mldv1_immediate_leave(): pytest.skip(tgen.errors) topotest.sysctl_assure( - tgen.gears["h1"], - "net.ipv6.conf.h1-eth0.force_mld_version", - "1") - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["h1"], "net.ipv6.conf.h1-eth0.force_mld_version", "1" + ) + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 ipv6 mld immediate-leave - """) + """ + ) app_helper.run("h1", ["ff05::2000", "h1-eth0"]) app_helper.run("h3", ["ff05::2000", "h3-eth0"]) def expect_mld_group(): - igmp_groups = tgen.gears["r1"].vtysh_cmd("show ipv6 mld groups json", isjson=True) + igmp_groups = tgen.gears["r1"].vtysh_cmd( + "show ipv6 mld groups json", isjson=True + ) try: for group in igmp_groups["r1-eth2"]["groups"]: if group["group"] == "ff05::2000": @@ -441,15 +470,16 @@ def test_mldv1_immediate_leave(): topotest.run_and_expect(expect_mld_group, False, count=10, wait=2) # Clean up - tgen.gears["r1"].vtysh_cmd(""" + tgen.gears["r1"].vtysh_cmd( + """ configure terminal interface r1-eth2 no ipv6 mld immediate-leave - """) + """ + ) topotest.sysctl_assure( - tgen.gears["h1"], - "net.ipv6.conf.h1-eth0.force_mld_version", - "0") + tgen.gears["h1"], "net.ipv6.conf.h1-eth0.force_mld_version", "0" + ) app_helper.stop_host("h3") |
