Skip to content

Commit

Permalink
skip multidut bgp instead of assert if testbed doesn't support. (soni…
Browse files Browse the repository at this point in the history
…c-net#15537)

test case fails if the testbed doesn't support snappi bgp convergence setup.
  • Loading branch information
sdszhang authored and yutongzhang-microsoft committed Nov 21, 2024
1 parent 8371cdc commit be8a4e1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
14 changes: 7 additions & 7 deletions tests/snappi_tests/multidut/bgp/test_bgp_outbound_tsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit be8a4e1

Please sign in to comment.