From be8a4e1c3662833f480058c76a7dd1677844002f Mon Sep 17 00:00:00 2001 From: Dashuai Zhang <164845223+sdszhang@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:30:51 +1100 Subject: [PATCH] skip multidut bgp instead of assert if testbed doesn't support. (#15537) test case fails if the testbed doesn't support snappi bgp convergence setup. --- .../bgp/test_bgp_outbound_downlink_port_flap.py | 4 ++-- .../test_bgp_outbound_downlink_process_crash.py | 4 ++-- .../multidut/bgp/test_bgp_outbound_tsa.py | 14 +++++++------- .../bgp/test_bgp_outbound_uplink_multi_po_flap.py | 10 +++++----- .../bgp/test_bgp_outbound_uplink_po_flap.py | 4 ++-- .../bgp/test_bgp_outbound_uplink_po_member_flap.py | 4 ++-- .../bgp/test_bgp_outbound_uplink_process_crash.py | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_port_flap.py b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_port_flap.py index 2c5b48533c1..5ff65ea6daa 100755 --- a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_port_flap.py +++ b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_port_flap.py @@ -68,7 +68,7 @@ def test_bgp_outbound_downlink_port_flap(snappi_api, snappi_extra_params.multi_dut_params.flap_details = FLAP_DETAILS snappi_extra_params.test_name = "T1 Interconnectivity flap" if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -78,7 +78,7 @@ def test_bgp_outbound_downlink_port_flap(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: diff --git a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_process_crash.py b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_process_crash.py index a0ac0f9f15e..15e727a186d 100755 --- a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_process_crash.py +++ b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_downlink_process_crash.py @@ -66,7 +66,7 @@ def test_bgp_outbound_downlink_process_crash(snappi_api, } snappi_extra_params.multi_dut_params.host_name = t1_t2_device_hostnames[2] if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -76,7 +76,7 @@ def test_bgp_outbound_downlink_process_crash(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: diff --git a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_tsa.py b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_tsa.py index 2db762e9dc3..567a9804741 100644 --- a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_tsa.py +++ b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_tsa.py @@ -62,7 +62,7 @@ def test_dut_configuration(multidut_snappi_ports_for_bgp, # noq if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: @@ -103,7 +103,7 @@ def test_bgp_outbound_uplink_tsa(snappi_api, snappi_extra_params.device_name = t1_t2_device_hostnames[1] if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -113,7 +113,7 @@ def test_bgp_outbound_uplink_tsa(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: @@ -161,7 +161,7 @@ def test_bgp_outbound_downlink_tsa(snappi_api, snappi_extra_params.device_name = t1_t2_device_hostnames[2] if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -171,7 +171,7 @@ def test_bgp_outbound_downlink_tsa(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: @@ -217,7 +217,7 @@ def test_bgp_outbound_supervisor_tsa(snappi_api, snappi_extra_params.device_name = t1_t2_device_hostnames[3] if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -227,7 +227,7 @@ def test_bgp_outbound_supervisor_tsa(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: diff --git a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_multi_po_flap.py b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_multi_po_flap.py index a983e3642d1..414e7790ccf 100644 --- a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_multi_po_flap.py +++ b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_multi_po_flap.py @@ -62,7 +62,7 @@ def test_dut_configuration(multidut_snappi_ports_for_bgp, # noq if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: @@ -103,7 +103,7 @@ def test_bgp_outbound_uplink_complete_blackout(snappi_api, snappi_extra_params.multi_dut_params.BLACKOUT_PERCENTAGE = 100 if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -112,7 +112,7 @@ def test_bgp_outbound_uplink_complete_blackout(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: @@ -156,7 +156,7 @@ def test_bgp_outbound_uplink_partial_blackout(snappi_api, snappi_extra_params.multi_dut_params.BLACKOUT_PERCENTAGE = 50 if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -165,7 +165,7 @@ def test_bgp_outbound_uplink_partial_blackout(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: diff --git a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_flap.py b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_flap.py index 59fa935e80d..1e9c2715a86 100755 --- a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_flap.py +++ b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_flap.py @@ -68,7 +68,7 @@ def test_bgp_outbound_uplink_po_flap(snappi_api, snappi_extra_params.multi_dut_params.flap_details = FLAP_DETAILS if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -77,7 +77,7 @@ def test_bgp_outbound_uplink_po_flap(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: diff --git a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_member_flap.py b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_member_flap.py index 3c273641a7a..04135c39d10 100755 --- a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_member_flap.py +++ b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_po_member_flap.py @@ -68,7 +68,7 @@ def test_bgp_outbound_uplink_po_member_flap(snappi_api, snappi_extra_params.multi_dut_params.flap_details = FLAP_DETAILS if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -77,7 +77,7 @@ def test_bgp_outbound_uplink_po_member_flap(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: diff --git a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_process_crash.py b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_process_crash.py index d27cde536b7..ef9b209cedb 100755 --- a/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_process_crash.py +++ b/tests/snappi_tests/multidut/bgp/test_bgp_outbound_uplink_process_crash.py @@ -66,7 +66,7 @@ def test_bgp_outbound_uplink_process_crash(snappi_api, } snappi_extra_params.multi_dut_params.host_name = t1_t2_device_hostnames[1] if (len(t1_t2_device_hostnames) < 3) or (len(duthosts) < 3): - pytest_assert(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") + pytest_require(False, "Need minimum of 3 devices : One T1 and Two T2 line cards") ansible_dut_hostnames = [] for duthost in duthosts: @@ -76,7 +76,7 @@ def test_bgp_outbound_uplink_process_crash(snappi_api, if device_hostname not in ansible_dut_hostnames: logger.info('!!!!! Attention: {} not in : {} derived from ansible dut hostnames'. format(device_hostname, ansible_dut_hostnames)) - pytest_assert(False, "Mismatch between the dut hostnames in ansible and in variables.py files") + pytest_require(False, "Mismatch between the dut hostnames in ansible and in variables.py files") for duthost in duthosts: if t1_t2_device_hostnames[0] in duthost.hostname: