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

[Q] Where is the HTTP server implementation for platform API testing? #17244

Open
txj36 opened this issue Feb 28, 2025 · 0 comments
Open

[Q] Where is the HTTP server implementation for platform API testing? #17244

txj36 opened this issue Feb 28, 2025 · 0 comments

Comments

@txj36
Copy link

txj36 commented Feb 28, 2025

Question

I cannot find the HTTP server implementation in sonic-buildimage that is used by the platform API tests. Based on the test fixture code below, it connects to port 8000, but where is the corresponding server implementation?

Test fixture from sonic-mgmt:

@pytest.fixture(scope='function')
def platform_api_conn(duthosts, enum_rand_one_per_hwsku_hostname, start_platform_api_service):
    duthost = duthosts[enum_rand_one_per_hwsku_hostname]
    dut_ip = duthost.mgmt_ip

    conn = http.client.HTTPConnection(dut_ip, 8000)
    try:
        yield conn
    finally:
        conn.close()

def chassis_api(conn, name, args=None):
    if args is None:
        args = []
    conn.request('POST', '/platform/chassis/{}'.format(name), json.dumps({'args': args}))
    resp = conn.getresponse()
    res = json.loads(resp.read())['res']
    logger.info('Executing chassis API: "{}", arguments: "{}", result: "{}"'.format(name, args, res))
    return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant