Skip to content

Commit 20318cf

Browse files
committed
Add test for setting gearbox tx taps by gearbox_config.json
1 parent 4575949 commit 20318cf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_gearbox.py

+21
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def __init__(self, db_id: int, connector: str, gearbox: Gearbox):
7070
DVSDatabase.__init__(self, db_id, connector)
7171
self.gearbox = gearbox
7272
self.ports = {}
73+
self.port_oid_to_intf_idx = {}
7374
self._wait_for_gb_asic_db_to_initialize()
7475

7576
for connector in self.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT_CONNECTOR"):
@@ -88,9 +89,29 @@ def __init__(self, db_id: int, connector: str, gearbox: Gearbox):
8889
if intf["system_lanes"] == system_lanes:
8990
assert intf["line_lanes"] == line_lanes
9091
self.ports[intf["index"]] = (system_port_oid, line_port_oid)
92+
self.port_oid_to_intf_idx[system_port_oid] = (i, True)
93+
self.port_oid_to_intf_idx[line_port_oid] = (i, False)
9194

9295
assert len(self.ports) == len(self.gearbox.interfaces)
9396

97+
for serdes in self.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT_SERDES"):
98+
fvs = self.get_entry("ASIC_STATE:SAI_OBJECT_TYPE_PORT_SERDES", serdes)
99+
port_oid = fvs.get("SAI_PORT_SERDES_ATTR_PORT_ID")
100+
intf_idx, is_system = self.port_oid_to_intf_idx[port_oid]
101+
intf = self.gearbox.interfaces[ intf_idx ]
102+
appl_db_key_prefix = 'system_' if is_system else 'line_'
103+
for asic_db_key, appl_db_key_suffix in [
104+
("SAI_PORT_SERDES_ATTR_TX_FIR_MAIN", "tx_fir_main"),
105+
("SAI_PORT_SERDES_ATTR_TX_FIR_PRE1", "tx_fir_pre1"),
106+
("SAI_PORT_SERDES_ATTR_TX_FIR_PRE2", "tx_fir_pre2"),
107+
("SAI_PORT_SERDES_ATTR_TX_FIR_POST1", "tx_fir_post1"),
108+
("SAI_PORT_SERDES_ATTR_TX_FIR_POST2", "tx_fir_post2"),
109+
]:
110+
if asic_db_key not in fvs:
111+
continue
112+
asic_db_value = fvs.get(asic_db_key).split(":")[-1]
113+
assert intf[appl_db_key_prefix + appl_db_key_suffix] == asic_db_value
114+
94115
def _wait_for_gb_asic_db_to_initialize(self) -> None:
95116
"""Wait up to 30 seconds for the default fields to appear in ASIC DB."""
96117
def _verify_db_contents():

0 commit comments

Comments
 (0)