|
8 | 8 | from collections import defaultdict |
9 | 9 |
|
10 | 10 | from jinja2 import Template |
11 | | -from common.helpers.assertions import pytest_require |
| 11 | +from tests.common.helpers.assertions import pytest_require |
| 12 | +from tests.common.dualtor.constants import UPPER_TOR, LOWER_TOR |
12 | 13 |
|
13 | 14 | logger = logging.getLogger(__name__) |
14 | 15 |
|
@@ -141,8 +142,8 @@ def collect_dut_lossless_prio(dut): |
141 | 142 | if 'pfc_enable' not in port_qos_map[intf]: |
142 | 143 | return [] |
143 | 144 |
|
144 | | - result = [int(x) for x in port_qos_map[intf]['pfc_enable'].split(',')] |
145 | | - return result |
| 145 | + result = [int(x) for x in port_qos_map[intf]['pfc_enable'].split(',')] |
| 146 | + return result |
146 | 147 |
|
147 | 148 | def collect_dut_all_prio(dut): |
148 | 149 | config_facts = dut.config_facts(host=dut.hostname, source="running")['ansible_facts'] |
@@ -178,7 +179,7 @@ def test_collect_testbed_prio(duthosts, tbinfo): |
178 | 179 | lossless_prio[dut.hostname] = collect_dut_lossless_prio(dut) |
179 | 180 | lossy_prio[dut.hostname] = collect_dut_lossy_prio(dut) |
180 | 181 |
|
181 | | - prio_info = [all_prio, lossless_prio, lossy_prio] |
| 182 | + prio_info = [all_prio, lossless_prio, lossy_prio] |
182 | 183 | file_names = [tbname + '-' + x + '.json' for x in ['all', 'lossless', 'lossy']] |
183 | 184 | folder = 'priority' |
184 | 185 |
|
@@ -240,6 +241,22 @@ def test_inject_y_cable_simulator_client(duthosts, enum_dut_hostname, tbinfo): |
240 | 241 | dut.copy(content=rendered, dest='/tmp/y_cable_simulator_client.py') |
241 | 242 | dut.shell('cp /tmp/y_cable_simulator_client.py /usr/lib/python3/dist-packages/') |
242 | 243 | dut.shell('docker cp /tmp/y_cable_simulator_client.py pmon:/usr/lib/python3/dist-packages/') |
| 244 | + |
| 245 | + # Below changes are required after these PRs are merged: |
| 246 | + # * https://github.com/Azure/sonic-platform-common/pull/213 |
| 247 | + # * https://github.com/Azure/sonic-platform-daemons/pull/197 |
| 248 | + # For the simulated y_cable driver to work, basic configuration information of the mux simulator is required. |
| 249 | + # When /etc/sonic/mux_simulator.json file is found on DUT, xcvrd will try to load simulated y_cable driver. |
| 250 | + # File /etc/sonic/mux_simulator.json can co-exist with the 'y_cable_simulator_client.py' file injected above. |
| 251 | + # Process xcvrd will determine which one to load or use. |
| 252 | + mux_simulator_config = { |
| 253 | + 'server_ip': mux_simulator_server, |
| 254 | + 'server_port': mux_simulator_port, |
| 255 | + 'vm_set': tbinfo['group-name'], |
| 256 | + 'side': UPPER_TOR if tbinfo['duts'].index(enum_dut_hostname) == 0 else LOWER_TOR |
| 257 | + } |
| 258 | + dut.copy(content=json.dumps(mux_simulator_config, indent=2), dest='/etc/sonic/mux_simulator.json') |
| 259 | + |
243 | 260 | dut.shell('systemctl restart pmon') |
244 | 261 |
|
245 | 262 | def test_stop_pfcwd(duthosts, enum_dut_hostname, tbinfo): |
|
0 commit comments