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

Support 2 vlan config in topology for test_acl #16322

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

ZhaohuiS
Copy link
Contributor

@ZhaohuiS ZhaohuiS commented Jan 3, 2025

Description of PR

Summary:
Fixes # (issue)
test_acl failed due to failed on setup with "KeyError: 'Vlan1000'" after changing to use 2vlan in topo file.

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

If enable 2vlan config in topology file(such as ansible/vars/topo_t0-116.yml):
change from

    vlan_configs:
      default_vlan_config: one_vlan_a

to

    vlan_configs:
      default_vlan_config: two_vlan_a

Then vlan name is not Vlan1000 anymore, it could be Vlan100 or Vlan200.
So, in https://github.com/sonic-net/sonic-mgmt/pull/9334/files, it sets default vlan name to Vlan1000 in pytest_generate_tests for T0 is not very reasonable.

How did you do it?

So, in test_acl, for T0 topology, still get vlan name from config, not from vlan_name parameter, then test_acl can pass.

How did you verify/test it?

Run test_acl on testbed with 2vlan config.

Any platform specific information?

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

Documentation

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ZhaohuiS ZhaohuiS requested review from yaqiangz and Copilot January 3, 2025 02:31

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

tests/acl/test_acl.py:318

  • Reassigning vlan_name without checking if it was already defined or used earlier could lead to unexpected behavior. Consider checking if vlan_name is already defined before reassigning it.
vlan_name = list(vlan_table.keys())[0]
Copy link
Contributor

@yaqiangz yaqiangz left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS StormLiangMS merged commit d4418fc into sonic-net:master Jan 6, 2025
22 checks passed
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.

4 participants