Skip to content

Commit

Permalink
[Snappi] Adding BGP Outbound Traffic Testcases for T2 (#13638)
Browse files Browse the repository at this point in the history
  • Loading branch information
selldinesh authored and mssonicbld committed Aug 28, 2024
1 parent dcc3565 commit 11304b4
Show file tree
Hide file tree
Showing 13 changed files with 2,912 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/common/fixtures/conn_graph_facts.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ def fanout_graph_facts(localhost, duthosts, rand_one_tgen_dut_hostname, conn_gra
return facts


@pytest.fixture(scope="module")
def fanout_graph_facts_multidut(localhost, duthosts, conn_graph_facts):
facts = dict()
dev_conn = conn_graph_facts.get('device_conn', {})
if not dev_conn:
return facts

for duthost in duthosts:
for _, val in list(dev_conn[duthost.hostname].items()):
fanout = val["peerdevice"]
if fanout not in facts:
facts[fanout] = {k: v[fanout] for k, v in list(get_graph_facts(duthost, localhost, fanout).items())}
return facts


@pytest.fixture(scope="module")
def enum_fanout_graph_facts(localhost, duthosts, enum_rand_one_per_hwsku_frontend_hostname, conn_graph_facts):
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
Expand Down
47 changes: 47 additions & 0 deletions tests/common/snappi_tests/snappi_fixtures.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -980,3 +980,50 @@ def pre_configure_dut_interface(duthost, snappi_ports):
except Exception:
pytest_assert(False, "Unable to configure ip on the interface {}".format(port['peer_port']))
return snappi_ports_dut


@pytest.fixture(scope="module")
def multidut_snappi_ports_for_bgp(duthosts, # noqa: F811
tbinfo, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut): # noqa: F811
"""
Populate snappi ports and connected DUT ports info of T1 and T2 testbed and returns as a list
Args:
duthost (pytest fixture): duthost fixture
tbinfo (pytest fixture): fixture provides information about testbed
conn_graph_facts (pytest fixture): connection graph
fanout_graph_facts_multidut (pytest fixture): fanout graph
Return:
return tuple of duts and snappi ports
"""
speed_type = {'50000': 'speed_50_gbps',
'100000': 'speed_100_gbps',
'200000': 'speed_200_gbps',
'400000': 'speed_400_gbps'}
multidut_snappi_ports = []

for duthost in duthosts:
snappi_fanout = get_peer_snappi_chassis(conn_data=conn_graph_facts,
dut_hostname=duthost.hostname)
if snappi_fanout is None:
continue
snappi_fanout_id = list(fanout_graph_facts_multidut.keys()).index(snappi_fanout)
snappi_fanout_list = SnappiFanoutManager(fanout_graph_facts_multidut)
snappi_fanout_list.get_fanout_device_details(device_number=snappi_fanout_id)
snappi_ports = snappi_fanout_list.get_ports(peer_device=duthost.hostname)
port_speed = None
for i in range(len(snappi_ports)):
if port_speed is None:
port_speed = int(snappi_ports[i]['speed'])

elif port_speed != int(snappi_ports[i]['speed']):
""" All the ports should have the same bandwidth """
return None

for port in snappi_ports:
port['location'] = get_snappi_port_location(port)
port['speed'] = speed_type[port['speed']]
port['api_server_ip'] = tbinfo['ptf_ip']
multidut_snappi_ports = multidut_snappi_ports + snappi_ports
return multidut_snappi_ports
Empty file.
Empty file.
Loading

0 comments on commit 11304b4

Please sign in to comment.