Skip to content

[fib_test] Updated deprecated imports that break in Python 3.10+#18544

Merged
wangxin merged 4 commits intosonic-net:masterfrom
opcoder0:fix/deprecated-import-pfc
May 28, 2025
Merged

[fib_test] Updated deprecated imports that break in Python 3.10+#18544
wangxin merged 4 commits intosonic-net:masterfrom
opcoder0:fix/deprecated-import-pfc

Conversation

@opcoder0
Copy link
Contributor

Description of PR

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

Approach

What is the motivation for this PR?

Preparation to move to Debian Bookworm for docker-ptf

How did you do it?

Modified import

How did you verify/test it?

Locally

Any platform specific information?

NA

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

NA

Documentation

NA

@opcoder0 opcoder0 requested a review from xwjiang-ms May 22, 2025 04:36
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@lerry-lee lerry-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe if we have old python version(python 3.9 and below)?

@opcoder0
Copy link
Contributor Author

Is it safe if we have old python version(python 3.9 and below)?

Hi @lerry-lee yes. Any version after Python 3.3 this works.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wangxin wangxin merged commit b3007c4 into sonic-net:master May 28, 2025
18 checks passed
bachalla pushed a commit to bachalla/sonic-mgmt that referenced this pull request Jun 2, 2025
…ic-net#18544)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jun 17, 2025
…ic-net#18544)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202505: #19046

yejianquan pushed a commit that referenced this pull request Jun 18, 2025
…9049)

Description of PR
Consolidated PR with all changes required for docker-ptf Bookworm based image. Based on these PRs for master -

#18544
#18627
#18584
#18583

Summary:
Fixes # (issue)

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
This change is backward compatible and is required to support running tests in docker-ptf Bookworm image.

How did you do it?
See description

signed-off-by: [email protected]
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-mgmt.msft#421

@vaibhavhd
Copy link
Contributor

This is also needed on 202411 branch. We have upgrade path testcase on 202411 failing now with error:

2025-06-20T16:18:49.5603984Z Using packet manipulation module: ptf.packet_scapystderr =
2025-06-20T16:18:49.5606100Z Traceback (most recent call last):
2025-06-20T16:18:49.5608102Z   File "/root/env-python3/bin/ptf", line 718, in <module>
2025-06-20T16:18:49.5610215Z     test_modules = load_test_modules(config)
2025-06-20T16:18:49.5612012Z                    ^^^^^^^^^^^^^^^^^^^^^^^^^
2025-06-20T16:18:49.5613887Z   File "/root/env-python3/bin/ptf", line 555, in load_test_modules
2025-06-20T16:18:49.5616055Z     mod = import_module(root, modname)
2025-06-20T16:18:49.5617782Z           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-06-20T16:18:49.5619647Z   File "/root/env-python3/bin/ptf", line 112, in import_module
2025-06-20T16:18:49.5621811Z     return module_specs.loader.load_module()
2025-06-20T16:18:49.5623725Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-06-20T16:18:49.5625860Z   File "<frozen importlib._bootstrap_external>", line 605, in _check_name_wrapper
2025-06-20T16:18:49.5626754Z   File "<frozen importlib._bootstrap_external>", line 1120, in load_module
2025-06-20T16:18:49.5627643Z   File "<frozen importlib._bootstrap_external>", line 945, in load_module
2025-06-20T16:18:49.5628550Z   File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
2025-06-20T16:18:49.5629373Z   File "<frozen importlib._bootstrap>", line 721, in _load
2025-06-20T16:18:49.5630198Z   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
2025-06-20T16:18:49.5631058Z   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
2025-06-20T16:18:49.5631922Z   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2025-06-20T16:18:49.5632772Z   File "/root/ptftests/py3/fib_test.py", line 42, in <module>
2025-06-20T16:18:49.5633767Z     from collections import Iterable, defaultdict
2025-06-20T16:18:49.5634663Z ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.11/collections/__init__.py)
2025-06-20T16:18:49.5635099Z 

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jun 22, 2025
…ic-net#18544)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #19127

mssonicbld pushed a commit that referenced this pull request Jun 22, 2025
)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally
sdszhang pushed a commit to sdszhang/sonic-mgmt that referenced this pull request Jun 30, 2025
Code sync sonic-net/sonic-mgmt:202411 => 202412

```
*   760eb7c (HEAD -> code-sync-202412, origin/code-sync-202412) r12f 250624:1905 - Merge remote-tracking branch 'base/202411' into code-sync-202412
|\
| * 2e3c1ba (base/202411) zitingguo-ms 250623:2336 - [test_dynamic_acl] Include all upstream neighbors for t0-d18u8s4 (sonic-net#19052)
| * 0c75f5a zitingguo-ms 250623:2335 - [test_bgp_session] Increase timeout to wait hold-timer (sonic-net#18891)
| * 75d1ac7 Zhaohui Sun 250624:1432 - [202411]Ignore audit rate limit exceeded and avoid false alert for kernel syslog (sonic-net#19134)
| * 88304be Sai Kiran 250528:1155 - [fib_test] Updated deprecated imports that break in Python 3.10+ (sonic-net#18544)
```
opcoder0 added a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
…ic-net#18544)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally

Signed-off-by: opcoder0 <[email protected]>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
…ic-net#18544)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally

Signed-off-by: Aharon Malkin <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
…ic-net#18544)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally

Signed-off-by: Guy Shemesh <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
…ic-net#18544)

Update deprecated (in 3.3) import as it breaks in 3.10. Fix is required as Debian Bookworm PTF runs in 3.11.

What is the motivation for this PR?
Preparation to move to Debian Bookworm for docker-ptf

How did you do it?
Modified import

How did you verify/test it?
Locally

Signed-off-by: Guy Shemesh <[email protected]>
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.

8 participants