Skip to content

[Platform API] Test against Python 3 platform API if available on DuT#2821

Merged
jleveque merged 2 commits intosonic-net:masterfrom
jleveque:plat_api_py3
Jan 17, 2021
Merged

[Platform API] Test against Python 3 platform API if available on DuT#2821
jleveque merged 2 commits intosonic-net:masterfrom
jleveque:plat_api_py3

Conversation

@jleveque
Copy link
Contributor

@jleveque jleveque commented Jan 15, 2021

Description of PR

Test against Python 3 platform API if available on DuT. If not available, test against the Python 2 platform API

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

SONiC is migrating from Python 2 to Python 3. As vendors provide Python 3 versions of their sonic-platform package, we should begin testing against the Python 3 version of the package, rather than the Python 2 package.

How did you do it?

  1. Make platform_api_server.py HTTP server compliant with both Python 2 and Python 3
  2. In related conftest.py, run docker exec -i pmon python3 -c "import sonic_platform" on the DuT to determine if a Python 3 sonic-platform package is installed. If it is, we will run platform_api_server.py on the DuT using Python 3, otherwise we will run it using Python 2.
  • Also remove unnecessary BytesIO module, and simply convert response to bytes using str.encode('utf-8'), which works with both Python 2 and 3.

How did you verify/test it?

  1. Run platform API tests on a DuT which has a Python 3 platform API installed, make sure tests succeed.
  2. Run platform API tests on a DuT which only has a Python 2 platform API, make sure tests succeed and no regressions.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@jleveque jleveque merged commit ab3884e into sonic-net:master Jan 17, 2021
@jleveque jleveque deleted the plat_api_py3 branch January 17, 2021 18:50
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…atically (sonic-net#15320)

src/sonic-utilities

* ec472146 - (HEAD -> 202205, origin/202205) fix show interface neighbor expected empty issue (sonic-net#2465) (3 minutes ago) [jcaiMR]
* d1f4413c - [vlan][dhcp_relay] Clear dhcpv6 relay counter while deleting vlan (sonic-net#2852) (6 hours ago) [Yaqiang Zhu]
* 051f28ce - [db-migrator] Fix hwsku match for 6100 and add errors when hwsku is None (sonic-net#2821) (7 hours ago) [Vaibhav Hemant Dixit]
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…lly (sonic-net#15943)

#### Why I did it
src/sonic-swss
```
* 6ec611dc - (HEAD -> 202211, origin/202211) [202211][ppi]: Implement port bulk comparison logic (sonic-net#2564) (sonic-net#2821) (19 hours ago) [Nazarii Hnydyn]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants