forked from sonic-net/sonic-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_xcvr_info_in_db.py
More file actions
38 lines (31 loc) · 1.64 KB
/
Copy pathtest_xcvr_info_in_db.py
File metadata and controls
38 lines (31 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Check xcvrd information in DB
This script is to cover the test case 'Check xcvrd information in DB' in the SONiC platform test plan:
https://github.com/sonic-net/SONiC/blob/master/doc/pmon/sonic_platform_test_plan.md
"""
import logging
import pytest
from tests.common.platform.transceiver_utils import check_transceiver_status
from tests.common.platform.interface_utils import get_port_map
from tests.common.fixtures.conn_graph_facts import conn_graph_facts # noqa F401
pytestmark = [
pytest.mark.topology('any')
]
def test_xcvr_info_in_db(duthosts, enum_rand_one_per_hwsku_frontend_hostname,
enum_frontend_asic_index, conn_graph_facts, xcvr_skip_list): # noqa F811
"""
@summary: This test case is to verify that xcvrd works as expected by checking transceiver information in DB
"""
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
logging.info("Check transceiver status")
all_interfaces = conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})
if enum_frontend_asic_index is not None:
# Get the interface pertaining to that asic
interface_list = get_port_map(duthost, enum_frontend_asic_index)
# Check if the interfaces of this AISC is present in conn_graph_facts
all_interfaces = {k: v for k, v in list(interface_list.items())
if k in conn_graph_facts.get("device_conn", {}).get(duthost.hostname, {})}
logging.info("ASIC {} interface_list {}".format(
enum_frontend_asic_index, all_interfaces))
check_transceiver_status(
duthost, enum_frontend_asic_index, all_interfaces, xcvr_skip_list)