+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
# SPDX-License-Identifier: ISC
# Copyright (c) 2019 by VMware, Inc. ("VMware")
# Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
# ("NetDEF") in this file.
import datetime
+import functools
import os
import re
import sys
import traceback
-import functools
from copy import deepcopy
from time import sleep
-from lib import topotest
-
# Import common_config to use commomnly used APIs
from lib.common_config import (
- create_common_configurations,
HostApplicationHelper,
InvalidCLIError,
create_common_configuration,
- InvalidCLIError,
+ create_common_configurations,
+ get_frr_ipv6_linklocal,
retry,
run_frr_cmd,
validate_ip_address,
- get_frr_ipv6_linklocal,
)
from lib.micronet import get_exec_path
from lib.topolog import logger
from lib.topotest import frr_unicode
+from lib import topotest
+
####
CWD = os.path.dirname(os.path.realpath(__file__))
-#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
# SPDX-License-Identifier: ISC
#
# Copyright (c) 2023 by VMware, Inc. ("VMware")
5. Verify static MLD groups after removing and adding MLD config
"""
-import os
import sys
import time
-import pytest
-
-# Save the Current Working Directory to find configuration files.
-CWD = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(CWD, "../"))
-sys.path.append(os.path.join(CWD, "../lib/"))
-
-# Required to instantiate the topology builder class.
-
-# pylint: disable=C0413
-# Import topogen and topotest helpers
-from lib.topogen import Topogen, get_topogen
-from re import search as re_search
-from re import findall as findall
+import pytest
from lib.common_config import (
+ reset_config_on_routers,
start_topology,
- write_test_header,
- write_test_footer,
step,
- kill_router_daemons,
- start_router_daemons,
- reset_config_on_routers,
- do_countdown,
- apply_raw_config,
- socat_send_pim6_traffic,
+ write_test_footer,
+ write_test_header,
)
-
from lib.pim import (
- create_pim_config,
- verify_mroutes,
- verify_upstream_iif,
- verify_mld_groups,
- clear_pim6_mroute,
McastTesterHelper,
- verify_pim_neighbors,
create_mld_config,
- verify_mld_groups,
+ create_pim_config,
verify_local_mld_groups,
+ verify_mld_groups,
+ verify_mroutes,
+ verify_pim_neighbors,
verify_pim_rp_info,
+ verify_upstream_iif,
)
-from lib.topolog import logger
+from lib.topogen import Topogen, get_topogen
from lib.topojson import build_config_from_json
+from lib.topolog import logger
r1_r2_links = []
r1_r3_links = []
logger.info("Running setup_module to create topology")
# This function initiates the topology build with Topogen...
- json_file = "{}/multicast_mld_local_join.json".format(CWD)
+ json_file = "multicast_mld_local_join.json"
tgen = Topogen(json_file, mod.__name__)
global topo
topo = tgen.json_topo
result = verify_pim_neighbors(tgen, topo)
assert result is True, " Verify PIM neighbor: Failed Error: {}".format(result)
+ global app_helper
+ app_helper = McastTesterHelper(tgen)
+
logger.info("Running setup_module() done")
tgen = get_topogen()
+ app_helper.cleanup()
+
# Stop toplogy and Remove tmp files
tgen.stop_topology()
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable the PIM on all the interfaces of R1, R2, R3, R4")
step("configure BGP on R1, R2, R3, R4 and enable redistribute static/connected")
step("Enable the MLD on R11 interfac of R1 and configure local mld groups")
assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
step("Send traffic from R4 to all the groups ( ffaa::1 to ffaa::5)")
- intf_ip = topo["routers"]["i4"]["links"]["r4"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i4"]["links"]["r4"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i4", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i4", MLD_JOIN_RANGE_1, "r4")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable the PIM on all the interfaces of R1, R2, R3, R4")
step("configure BGP on R1, R2, R3, R4 and enable redistribute static/connected")
step("Enable the MLD on R11 interfac of R1 and configure local mld groups")
assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
step("Send traffic from R4 to all the groups ( ffaa::1 to ffaa::5)")
- intf_ip = topo["routers"]["i4"]["links"]["r4"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i4"]["links"]["r4"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i4", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i4", MLD_JOIN_RANGE_1, "r4")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable the PIM on all the interfaces of R1, R2, R3, R4")
step("configure BGP on R1, R2, R3, R4 and enable redistribute static/connected")
step("Enable the MLD on R11 interfac of R1 and configure local mld groups")
assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
step("Send traffic from R4 to all the groups ( ffaa::1 to ffaa::5)")
- intf_ip = topo["routers"]["i4"]["links"]["r4"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i4"]["links"]["r4"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i4", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i4", MLD_JOIN_RANGE_1, "r4")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
-#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
# SPDX-License-Identifier: ISC
#
data traffic
"""
-import os
+import datetime
import sys
-import json
import time
-import datetime
-import pytest
-
-# Save the Current Working Directory to find configuration files.
-CWD = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(CWD, "../"))
-sys.path.append(os.path.join(CWD, "../lib/"))
-
-# Required to instantiate the topology builder class.
-
-# pylint: disable=C0413
-# Import topogen and topotest helpers
-from lib.topogen import Topogen, get_topogen
+import pytest
from lib.common_config import (
- start_topology,
- write_test_header,
- write_test_footer,
- step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
reset_config_on_routers,
shutdown_bringup_interface,
- start_router,
- stop_router,
- create_static_routes,
- required_linux_kernel_version,
- socat_send_mld_join,
- socat_send_pim6_traffic,
- get_frr_ipv6_linklocal,
- kill_socat,
+ start_topology,
+ step,
+ write_test_footer,
+ write_test_header,
)
-from lib.bgp import create_router_bgp
from lib.pim import (
- create_pim_config,
+ McastTesterHelper,
+ clear_pim6_mroute,
create_mld_config,
+ create_pim_config,
+ verify_mld_config,
verify_mld_groups,
+ verify_mroute_summary,
verify_mroutes,
- clear_pim6_interface_traffic,
- verify_upstream_iif,
- clear_pim6_mroute,
verify_pim_interface_traffic,
- verify_pim_state,
- McastTesterHelper,
verify_pim_join,
- verify_mroute_summary,
verify_pim_nexthop,
+ verify_pim_state,
verify_sg_traffic,
- verify_mld_config,
+ verify_upstream_iif,
)
-
-from lib.topolog import logger
+from lib.topogen import Topogen, get_topogen
from lib.topojson import build_config_from_json
+from lib.topolog import logger
# Global variables
GROUP_RANGE = "ff00::/8"
logger.info("Running setup_module to create topology")
- testdir = os.path.dirname(os.path.realpath(__file__))
- json_file = "{}/multicast_pim6_sm_topo1.json".format(testdir)
+ json_file = "multicast_pim6_sm_topo1.json"
tgen = Topogen(json_file, mod.__name__)
global topo
topo = tgen.json_topo
# Creating configuration from JSON
build_config_from_json(tgen, tgen.json_topo)
+ global app_helper
+ app_helper = McastTesterHelper(tgen)
+
logger.info("Running setup_module() done")
tgen = get_topogen()
- # Clean up socat
- kill_socat(tgen)
+ app_helper.cleanup()
# Stop toplogy and Remove tmp files
tgen.stop_topology()
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
step("Send multicast traffic from FRR3 to all the receivers" "ffaa::1-5")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i2", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
source = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
)
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i1", MLD_JOIN_RANGE_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", _MLD_JOIN_RANGE, intf, intf_ip
- )
+ result = app_helper.run_join("i1", _MLD_JOIN_RANGE, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("verify MLD joins received on r1")
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("Send multicast traffic from FRR3 to all the receivers" "ffaa::1-5")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", _MLD_JOIN_RANGE, intf)
+ result = app_helper.run_traffic("i2", _MLD_JOIN_RANGE, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
result = create_mld_config(tgen, topo, input_dict)
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
- i5_r5 = topo["routers"]["i5"]["links"]["r5"]["interface"]
- intf_ip = topo["routers"]["i5"]["links"]["r5"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i5", "UDP6-RECV", _MLD_JOIN_RANGE, i5_r5, intf_ip
- )
+ result = app_helper.run_join("i5", _MLD_JOIN_RANGE, "r5")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("FRR1 has 10 (*.G) and 10 (S,G) verify using 'show ipv6 mroute'")
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
step("Enable mld on FRR1 interface and send mld join ")
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i1", MLD_JOIN_RANGE_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("verify mld groups received on R1")
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("Send multicast traffic from FRR3 to ffaa::1-5 receivers")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i2", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("shut the direct link to R1 ")
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
step("Enable mld on FRR1 interface and send mld join ffaa::1-5")
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i1", MLD_JOIN_RANGE_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("Send multicast traffic from FRR3 to ffaa::1-5 receivers")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i2", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("Configure one MLD interface on FRR3 node and send MLD" " join (ffcc::1)")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i8"]["links"]["r3"]["interface"]
- intf_ip = topo["routers"]["i8"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i8", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i8", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("verify MLD groups received ")
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i8"]["links"]["r3"]["interface"]
- intf_ip = topo["routers"]["i8"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i8", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i8", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("Enable MLD on receiver interface")
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("Send multicast traffic from FRR3 to ffaa::1-5 receivers")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i2", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
step("Enable mld on FRR1 interface and send MLD join")
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i1", MLD_JOIN_RANGE_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
r1_i1 = topo["routers"]["r1"]["links"]["i1"]["interface"]
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("Send multicast traffic from FRR3 to ffaa::1-5 receivers")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i2", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
step("send multicast traffic for group range ffaa::1-5")
step("Send multicast traffic from FRR3 to ffaa::1-5 receivers")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i2", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("Configure static RP for group (ffaa::1) on r5")
step("Enable mld on FRR1 interface and send MLD join")
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i1", MLD_JOIN_RANGE_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
-#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
# SPDX-License-Identifier: ISC
#
different
"""
-import os
import sys
-import json
import time
-import datetime
-import pytest
-
-# Save the Current Working Directory to find configuration files.
-CWD = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(CWD, "../"))
-sys.path.append(os.path.join(CWD, "../lib/"))
-
-# Required to instantiate the topology builder class.
-
-# pylint: disable=C0413
-# Import topogen and topotest helpers
-from lib.topogen import Topogen, get_topogen
+import pytest
from lib.common_config import (
- start_topology,
- write_test_header,
- write_test_footer,
- step,
+ required_linux_kernel_version,
reset_config_on_routers,
shutdown_bringup_interface,
- start_router,
- stop_router,
- create_static_routes,
- required_linux_kernel_version,
- socat_send_mld_join,
- socat_send_pim6_traffic,
- get_frr_ipv6_linklocal,
- kill_socat,
+ start_topology,
+ step,
+ write_test_footer,
+ write_test_header,
)
-from lib.bgp import create_router_bgp
from lib.pim import (
+ McastTesterHelper,
+ clear_pim6_mroute,
create_pim_config,
- create_mld_config,
- verify_mld_groups,
verify_mroutes,
- clear_pim6_interface_traffic,
- verify_upstream_iif,
- clear_pim6_mroute,
verify_pim_interface_traffic,
- verify_pim_state,
- McastTesterHelper,
- verify_pim_join,
- verify_mroute_summary,
- verify_pim_nexthop,
verify_sg_traffic,
- verify_mld_config,
+ verify_upstream_iif,
)
-
-from lib.topolog import logger
+from lib.topogen import Topogen, get_topogen
from lib.topojson import build_config_from_json
+from lib.topolog import logger
# Global variables
GROUP_RANGE = "ff00::/8"
logger.info("Running setup_module to create topology")
- testdir = os.path.dirname(os.path.realpath(__file__))
- json_file = "{}/multicast_pim6_sm_topo1.json".format(testdir)
+ json_file = "multicast_pim6_sm_topo1.json"
tgen = Topogen(json_file, mod.__name__)
global topo
topo = tgen.json_topo
# Creating configuration from JSON
build_config_from_json(tgen, tgen.json_topo)
+ global app_helper
+ app_helper = McastTesterHelper(tgen)
+
logger.info("Running setup_module() done")
tgen = get_topogen()
- # Clean up socat
- kill_socat(tgen)
+ app_helper.cleanup()
# Stop toplogy and Remove tmp files
tgen.stop_topology()
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
)
step("send mld join (ffaa::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", MLD_JOIN_RANGE_1, intf, intf_ip
- )
+ result = app_helper.run_join("i1", MLD_JOIN_RANGE_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("Send multicast traffic from FRR3 to all the receivers" "ffaa::1-5")
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", MLD_JOIN_RANGE_1, intf)
+ result = app_helper.run_traffic("i2", MLD_JOIN_RANGE_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("Clear the mroute on r1, wait for 5 sec")
# Creating configuration from JSON
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("send mld join (ffbb::1-5, ffcc::1-5) to R1")
- intf = topo["routers"]["i1"]["links"]["r1"]["interface"]
- intf_ip = topo["routers"]["i1"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "i1", "UDP6-RECV", _MLD_JOIN_RANGE, intf, intf_ip
- )
+ result = app_helper.run_join("i1", _MLD_JOIN_RANGE, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("registerRx and registerStopTx value before traffic sent")
step(
"Send multicast traffic from FRR3 to all the receivers" "ffbb::1-5 , ffcc::1-5"
)
- intf_ip = topo["routers"]["i2"]["links"]["r3"]["ipv6"].split("/")[0]
- intf = topo["routers"]["i2"]["links"]["r3"]["interface"]
- result = socat_send_pim6_traffic(tgen, "i2", "UDP6-SEND", _MLD_JOIN_RANGE, intf)
+ result = app_helper.run_traffic("i2", _MLD_JOIN_RANGE, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step(
-#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
# SPDX-License-Identifier: ISC
#
8. Verify PIM6 join send towards the higher preferred RP
9. Verify PIM6 prune send towards the lower preferred RP
"""
-
-import os
import sys
-import json
import time
-import pytest
-
-# Save the Current Working Directory to find configuration files.
-CWD = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(CWD, "../"))
-sys.path.append(os.path.join(CWD, "../lib/"))
-
-# Required to instantiate the topology builder class.
-
-# pylint: disable=C0413
-# Import topogen and topotest helpers
-from lib.topogen import Topogen, get_topogen
+import pytest
from lib.common_config import (
- start_topology,
- write_test_header,
- write_test_footer,
+ check_router_status,
reset_config_on_routers,
- step,
shutdown_bringup_interface,
- kill_router_daemons,
- start_router_daemons,
- create_static_routes,
- check_router_status,
- socat_send_mld_join,
- socat_send_pim6_traffic,
- kill_socat,
+ start_topology,
+ step,
+ write_test_footer,
+ write_test_header,
)
from lib.pim import (
+ McastTesterHelper,
+ clear_pim6_interface_traffic,
create_pim_config,
- verify_upstream_iif,
+ get_pim6_interface_traffic,
verify_join_state_and_timer,
+ verify_mld_groups,
verify_mroutes,
- verify_pim_neighbors,
+ verify_pim6_neighbors,
verify_pim_interface_traffic,
verify_pim_rp_info,
verify_pim_state,
- clear_pim6_interface_traffic,
- clear_pim6_mroute,
- verify_pim6_neighbors,
- get_pim6_interface_traffic,
- clear_pim6_interfaces,
- verify_mld_groups,
+ verify_upstream_iif,
)
+from lib.topogen import Topogen, get_topogen
+from lib.topojson import build_config_from_json, build_topo_from_json
from lib.topolog import logger
-from lib.topojson import build_topo_from_json, build_config_from_json
# Global variables
GROUP_RANGE_1 = "ff08::/64"
logger.info("Running setup_module to create topology")
# This function initiates the topology build with Topogen...
- json_file = "{}/multicast_pim6_static_rp.json".format(CWD)
+ json_file = "multicast_pim6_static_rp.json"
tgen = Topogen(json_file, mod.__name__)
global TOPO
TOPO = tgen.json_topo
result = verify_pim6_neighbors(tgen, TOPO)
assert result is True, "setup_module :Failed \n Error:" " {}".format(result)
+ global app_helper
+ app_helper = McastTesterHelper(tgen)
+
logger.info("Running setup_module() done")
logger.info("Running teardown_module to delete topology")
tgen = get_topogen()
- # Clean up socat
- kill_socat(tgen)
+ app_helper.cleanup()
# Stop toplogy and Remove tmp files
tgen.stop_topology()
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Shut link b/w R1 and R3 and R1 and R4 as per testcase topology")
intf_r1_r3 = TOPO["routers"]["r1"]["links"]["r3"]["interface"]
intf_r1_r4 = TOPO["routers"]["r1"]["links"]["r4"]["interface"]
)
step("send mld join {} to R1".format(GROUP_ADDRESS_1))
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", GROUP_ADDRESS_1, intf, intf_ip
- )
+ result = app_helper.run_join("r0", GROUP_ADDRESS_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Shut link b/w R1->R3, R1->R4 and R3->R1, R3->R4 as per " "testcase topology")
intf_r1_r3 = TOPO["routers"]["r1"]["links"]["r3"]["interface"]
intf_r1_r4 = TOPO["routers"]["r1"]["links"]["r4"]["interface"]
step(
"Enable MLD on r1 interface and send MLD join {} to R1".format(GROUP_ADDRESS_1)
)
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", GROUP_ADDRESS_1, intf, intf_ip
- )
+ result = app_helper.run_join("r0", GROUP_ADDRESS_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("Send multicast traffic from R5")
- intf = TOPO["routers"]["r5"]["links"]["r3"]["interface"]
SOURCE_ADDRESS = TOPO["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_pim6_traffic(tgen, "r5", "UDP6-SEND", GROUP_ADDRESS_1, intf)
+ result = app_helper.run_traffic("r5", GROUP_ADDRESS_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r2: Verify RP info")
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable MLD on r1 interface")
step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("send mld join {} to R1".format(GROUP_ADDRESS_1))
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", GROUP_ADDRESS_1, intf, intf_ip
- )
+ result = app_helper.run_join("r0", GROUP_ADDRESS_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("r5: Send multicast traffic for group {}".format(GROUP_ADDRESS_1))
- intf = TOPO["routers"]["r5"]["links"]["r3"]["interface"]
SOURCE_ADDRESS = TOPO["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_pim6_traffic(tgen, "r5", "UDP6-SEND", GROUP_ADDRESS_1, intf)
+ result = app_helper.run_traffic("r5", GROUP_ADDRESS_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify (*, G) upstream IIF interface")
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable MLD on r1 interface")
step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
step("r3: Configure r3(FHR) as RP")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("send mld join {} to R1".format(GROUP_ADDRESS_1))
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", GROUP_ADDRESS_1, intf, intf_ip
- )
+ result = app_helper.run_join("r0", GROUP_ADDRESS_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("r5: Send multicast traffic for group {}".format(GROUP_ADDRESS_1))
- intf = TOPO["routers"]["r5"]["links"]["r3"]["interface"]
SOURCE_ADDRESS = TOPO["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_pim6_traffic(tgen, "r5", "UDP6-SEND", GROUP_ADDRESS_1, intf)
+ result = app_helper.run_traffic("r5", GROUP_ADDRESS_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify (*, G) upstream IIF interface")
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable MLD on r1 interface")
step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
step("r2: Configure r2 as RP")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("send mld join {} to R1".format(GROUP_ADDRESS_1))
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", GROUP_ADDRESS_1, intf, intf_ip
- )
+ result = app_helper.run_join("r0", GROUP_ADDRESS_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("r5: Send multicast traffic for group {}".format(GROUP_ADDRESS_1))
- intf = TOPO["routers"]["r5"]["links"]["r3"]["interface"]
SOURCE_ADDRESS = TOPO["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_pim6_traffic(tgen, "r5", "UDP6-SEND", GROUP_ADDRESS_1, intf)
+ result = app_helper.run_traffic("r5", GROUP_ADDRESS_1, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify (*, G) upstream IIF interface")
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable MLD on r1 interface")
step("Enable the PIM66 on all the interfaces of r1, r2, r3 and r4 routers")
step(
)
step("r0: send mld join {} to R1".format(GROUP_ADDRESS_3))
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", GROUP_ADDRESS_3, intf, intf_ip
- )
+ result = app_helper.run_join("r0", GROUP_ADDRESS_3, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
-#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
# SPDX-License-Identifier: ISC
#
import os
import sys
-import json
import time
-import pytest
-
-# Save the Current Working Directory to find configuration files.
-CWD = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(CWD, "../"))
-sys.path.append(os.path.join(CWD, "../lib/"))
-
-# Required to instantiate the topology builder class.
-
-# pylint: disable=C0413
-# Import topogen and topotest helpers
-from lib.topogen import Topogen, get_topogen
+import pytest
from lib.common_config import (
- start_topology,
- write_test_header,
- write_test_footer,
+ create_debug_log_config,
reset_config_on_routers,
- step,
shutdown_bringup_interface,
- kill_router_daemons,
- start_router_daemons,
- create_static_routes,
- check_router_status,
- socat_send_mld_join,
- socat_send_pim6_traffic,
- kill_socat,
- create_debug_log_config,
+ start_topology,
+ step,
+ write_test_footer,
+ write_test_header,
)
from lib.pim import (
+ McastTesterHelper,
create_pim_config,
- verify_upstream_iif,
verify_join_state_and_timer,
+ verify_mld_groups,
verify_mroutes,
- verify_pim_neighbors,
- verify_pim_interface_traffic,
- verify_pim_rp_info,
- verify_pim_state,
- clear_pim6_interface_traffic,
- clear_pim6_mroute,
verify_pim6_neighbors,
- get_pim6_interface_traffic,
- clear_pim6_interfaces,
- verify_mld_groups,
+ verify_pim_rp_info,
+ verify_upstream_iif,
)
+from lib.topogen import Topogen, get_topogen
+from lib.topojson import build_config_from_json, build_topo_from_json
from lib.topolog import logger
-from lib.topojson import build_topo_from_json, build_config_from_json
# Global variables
GROUP_RANGE_1 = "ff08::/64"
logger.info("Running setup_module to create topology")
# This function initiates the topology build with Topogen...
- json_file = "{}/multicast_pim6_static_rp.json".format(CWD)
+ json_file = "multicast_pim6_static_rp.json"
tgen = Topogen(json_file, mod.__name__)
global TOPO
TOPO = tgen.json_topo
result = verify_pim6_neighbors(tgen, TOPO)
assert result is True, "setup_module :Failed \n Error:" " {}".format(result)
+ global app_helper
+ app_helper = McastTesterHelper(tgen)
+
logger.info("Running setup_module() done")
logger.info("Running teardown_module to delete topology")
tgen = get_topogen()
- # Clean up socat
- kill_socat(tgen)
+ app_helper.cleanup()
# Stop toplogy and Remove tmp files
tgen.stop_topology()
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
input_dict = {
"r1": {"debug": {"log_file": "r1_debug.log", "enable": ["pim6d"]}},
"r2": {"debug": {"log_file": "r2_debug.log", "enable": ["pim6d"]}},
group_address_list = GROUP_ADDRESS_LIST_1 + GROUP_ADDRESS_LIST_2
step("r0: Send MLD join for 10 groups")
intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", group_address_list, intf, intf_ip
- )
+ result = app_helper.run_join("r0", group_address_list, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("r5: Send multicast traffic for group {}".format(group_address_list))
- intf = TOPO["routers"]["r5"]["links"]["r3"]["interface"]
SOURCE_ADDRESS = TOPO["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_pim6_traffic(tgen, "r5", "UDP6-SEND", group_address_list, intf)
+ result = app_helper.run_traffic("r5", group_address_list, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify (*, G) upstream IIF interface")
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable MLD on r1 interface")
step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
step("r2: Configure r2 as RP")
group_address_list = GROUP_ADDRESS_LIST_1 + GROUP_ADDRESS_LIST_2
step("r0: Send MLD join for 10 groups")
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", group_address_list, intf, intf_ip
- )
+ result = app_helper.run_join("r0", group_address_list, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("r5: Send multicast traffic for group {}".format(group_address_list))
- intf = TOPO["routers"]["r5"]["links"]["r3"]["interface"]
SOURCE_ADDRESS = TOPO["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
- result = socat_send_pim6_traffic(tgen, "r5", "UDP6-SEND", group_address_list, intf)
+ result = app_helper.run_traffic("r5", group_address_list, "r3")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify (*, G) upstream IIF interface")
step("Creating configuration from JSON")
reset_config_on_routers(tgen)
+ app_helper.stop_all_hosts()
+
step("Enable MLD on r1 interface")
step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
step("r2: Configure r2 as RP")
assert result is True, ASSERT_MSG.format(tc_name, result)
step("r0: Send MLD join")
- intf = TOPO["routers"]["r0"]["links"]["r1"]["interface"]
- intf_ip = TOPO["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
- result = socat_send_mld_join(
- tgen, "r0", "UDP6-RECV", GROUP_ADDRESS_1, intf, intf_ip
- )
+ result = app_helper.run_join("r0", GROUP_ADDRESS_1, "r1")
assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result)
step("r1: Verify MLD groups")