Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test_pretest to inject mux_simulator.json for simulated y_cable driver #4106

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions tests/test_pretest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from collections import defaultdict

from jinja2 import Template
from common.helpers.assertions import pytest_require
from tests.common.helpers.assertions import pytest_require
from tests.common.dualtor.constants import UPPER_TOR, LOWER_TOR

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -141,8 +142,8 @@ def collect_dut_lossless_prio(dut):
if 'pfc_enable' not in port_qos_map[intf]:
return []

result = [int(x) for x in port_qos_map[intf]['pfc_enable'].split(',')]
return result
result = [int(x) for x in port_qos_map[intf]['pfc_enable'].split(',')]
return result

def collect_dut_all_prio(dut):
config_facts = dut.config_facts(host=dut.hostname, source="running")['ansible_facts']
Expand Down Expand Up @@ -178,7 +179,7 @@ def test_collect_testbed_prio(duthosts, tbinfo):
lossless_prio[dut.hostname] = collect_dut_lossless_prio(dut)
lossy_prio[dut.hostname] = collect_dut_lossy_prio(dut)

prio_info = [all_prio, lossless_prio, lossy_prio]
prio_info = [all_prio, lossless_prio, lossy_prio]
file_names = [tbname + '-' + x + '.json' for x in ['all', 'lossless', 'lossy']]
folder = 'priority'

Expand Down Expand Up @@ -240,6 +241,22 @@ def test_inject_y_cable_simulator_client(duthosts, enum_dut_hostname, tbinfo):
dut.copy(content=rendered, dest='/tmp/y_cable_simulator_client.py')
dut.shell('cp /tmp/y_cable_simulator_client.py /usr/lib/python3/dist-packages/')
dut.shell('docker cp /tmp/y_cable_simulator_client.py pmon:/usr/lib/python3/dist-packages/')

# Below changes are required after these PRs are merged:
# * https://github.com/Azure/sonic-platform-common/pull/213
# * https://github.com/Azure/sonic-platform-daemons/pull/197
# For the simulated y_cable driver to work, basic configuration information of the mux simulator is required.
# When /etc/sonic/mux_simulator.json file is found on DUT, xcvrd will try to load simulated y_cable driver.
# File /etc/sonic/mux_simulator.json can co-exist with the 'y_cable_simulator_client.py' file injected above.
# Process xcvrd will determine which one to load or use.
mux_simulator_config = {
'server_ip': mux_simulator_server,
'server_port': mux_simulator_port,
'vm_set': tbinfo['group-name'],
'side': UPPER_TOR if tbinfo['duts'].index(enum_dut_hostname) == 0 else LOWER_TOR
}
dut.copy(content=json.dumps(mux_simulator_config, indent=2), dest='/etc/sonic/mux_simulator.json')

dut.shell('systemctl restart pmon')

def test_stop_pfcwd(duthosts, enum_dut_hostname, tbinfo):
Expand Down