|
76 | 76 | DUTHOSTS_FIXTURE_FAILED_RC = 15
|
77 | 77 | CUSTOM_MSG_PREFIX = "sonic_custom_msg"
|
78 | 78 |
|
79 |
| -SERVER_FILE = 'platform_api_server.py' |
80 |
| -SERVER_PORT = 8000 |
81 |
| -IPTABLES_PREPEND_RULE_CMD = 'iptables -I INPUT 1 -p tcp -m tcp --dport {} -j ACCEPT'.format(SERVER_PORT) |
82 |
| - |
83 | 79 | pytest_plugins = ('tests.common.plugins.ptfadapter',
|
84 | 80 | 'tests.common.plugins.ansible_fixtures',
|
85 | 81 | 'tests.common.plugins.dut_monitor',
|
@@ -2865,53 +2861,6 @@ def gnxi_path(ptfhost):
|
2865 | 2861 | return gnxipath
|
2866 | 2862 |
|
2867 | 2863 |
|
2868 |
| -@pytest.fixture(scope='function') |
2869 |
| -def start_platform_api_service(duthosts, enum_rand_one_per_hwsku_hostname, localhost, request): |
2870 |
| - duthost = duthosts[enum_rand_one_per_hwsku_hostname] |
2871 |
| - dut_ip = duthost.mgmt_ip |
2872 |
| - |
2873 |
| - res = localhost.wait_for(host=dut_ip, |
2874 |
| - port=SERVER_PORT, |
2875 |
| - state='started', |
2876 |
| - delay=1, |
2877 |
| - timeout=10, |
2878 |
| - module_ignore_errors=True) |
2879 |
| - if res['failed'] is True: |
2880 |
| - |
2881 |
| - res = duthost.command('docker exec -i pmon python3 -c "import sonic_platform"', module_ignore_errors=True) |
2882 |
| - py3_platform_api_available = not res['failed'] |
2883 |
| - |
2884 |
| - supervisor_conf = [ |
2885 |
| - '[program:platform_api_server]', |
2886 |
| - 'command=/usr/bin/python{} /opt/platform_api_server.py --port {}'.format('3' if py3_platform_api_available |
2887 |
| - else '2', SERVER_PORT), |
2888 |
| - 'autostart=True', |
2889 |
| - 'autorestart=True', |
2890 |
| - 'stdout_logfile=syslog', |
2891 |
| - 'stderr_logfile=syslog', |
2892 |
| - ] |
2893 |
| - dest_path = os.path.join(os.sep, 'tmp', 'platform_api_server.conf') |
2894 |
| - pmon_path = os.path.join(os.sep, 'etc', 'supervisor', 'conf.d', 'platform_api_server.conf') |
2895 |
| - duthost.copy(content='\n'.join(supervisor_conf), dest=dest_path) |
2896 |
| - duthost.command('docker cp {} pmon:{}'.format(dest_path, pmon_path)) |
2897 |
| - |
2898 |
| - src_path = os.path.join('common', 'helpers', 'platform_api', 'scripts', SERVER_FILE) |
2899 |
| - dest_path = os.path.join(os.sep, 'tmp', SERVER_FILE) |
2900 |
| - pmon_path = os.path.join(os.sep, 'opt', SERVER_FILE) |
2901 |
| - duthost.copy(src=src_path, dest=dest_path) |
2902 |
| - duthost.command('docker cp {} pmon:{}'.format(dest_path, pmon_path)) |
2903 |
| - |
2904 |
| - # Prepend an iptables rule to allow incoming traffic to the HTTP server |
2905 |
| - duthost.command(IPTABLES_PREPEND_RULE_CMD) |
2906 |
| - |
2907 |
| - # Reload the supervisor config and Start the HTTP server |
2908 |
| - duthost.command('docker exec -i pmon supervisorctl reread') |
2909 |
| - duthost.command('docker exec -i pmon supervisorctl update') |
2910 |
| - |
2911 |
| - res = localhost.wait_for(host=dut_ip, port=SERVER_PORT, state='started', delay=1, timeout=10) |
2912 |
| - assert res['failed'] is False |
2913 |
| - |
2914 |
| - |
2915 | 2864 | def pytest_collection_modifyitems(config, items):
|
2916 | 2865 | # Skip all stress_tests if --run-stress-test is not set
|
2917 | 2866 | if not config.getoption("--run-stress-tests"):
|
|
0 commit comments