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

[GCU] [MA] Adding support in existing tests - Common changes #15182

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

okaravasi
Copy link
Contributor

Description of PR

This PR adds the common changes for adding Multi-ASIC support for generic config updater (GCU) in existing suites.
Original ticket #14070

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • [ x] 202405

Approach

What is the motivation for this PR?

To add common test code so as to support Multi-ASIC testing in existing GCU suites.

How did you do it?

Two new fixtures where introduced that return random tuple of asic namespace, asic index.

How did you verify/test it?

Ran in vs-kvm-t0 testbed. Ran in t2 MA platform.

Any platform specific information?

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

Documentation

@okaravasi okaravasi changed the title Master gcu t2 support common [GCU] [MA] Adding support in existing tests: Common changes Oct 25, 2024
@okaravasi okaravasi changed the title [GCU] [MA] Adding support in existing tests: Common changes [GCU] [MA] Adding support in existing tests - Common changes Oct 25, 2024
@okaravasi okaravasi marked this pull request as ready for review October 25, 2024 14:08
…le setup, compatible with both frontend and any type of DUT host test suites.
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Oct 31, 2024
asic_namespace = random.choice(namespace_list)
asic_index = duthost.get_asic_id_from_namespace(asic_namespace)

return asic_namespace, asic_index
Copy link
Contributor

Choose a reason for hiding this comment

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

These two functions are identical.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, they could potentially use different duthost types. rand_asic_namespace can use any type of duthost, while rand_front_end_asic_namespace requires only front-end duthosts. This separation was necessary because some features run only on front-end duthosts in a multi-ASIC T2 platform and are not applicable to supervisor cards. Test suites are adapted accordingly based on their requirements to select the appropriate fixture, depending on when the feature is valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, although these two functions execute differently, the code is indeed duplicated. I will work on a solution to keep a single common function that adapts based on the availability of the two duthost fixtures.

@@ -477,3 +480,53 @@ def expect_acl_rule_removed(duthost, rulename, setup):
removed = len(output) == 0

pytest_assert(removed, "'{}' showed a rule, this following rule should have been removed".format(cmds))


def save_backup_test_config(duthost, file_postfix="bkp"):
Copy link
Contributor

Choose a reason for hiding this comment

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

save_backup_test_config

We do have checkpoint and rollback cli.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code was already available as part of setup fixtures in the GCU test suites.
The main change introduced by this PR is moving the code into a separate function to avoid code duplication, as it is used by multiple setup module fixtures. Additionally, support has been added to save backup files for different namespaces on multi-ASIC platforms.
Most GCU setup module fixtures create a checkpoint and save backup configuration JSON files before the test (this block of code), then roll back to the checkpoint afterward. If the rollback fails, these backup files are used to reload the configdb.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand the code could be existing in old implementation, but my point is that we should leverage the checkpoint and rollback feature.

@okaravasi
Copy link
Contributor Author

@xincunli-sonic Could you please review?

okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
okaravasi added a commit to okaravasi/sonic-mgmt that referenced this pull request Nov 29, 2024
conditions:
- "'t2' in topo_name"
- "('t2' in topo_name) and (release in ['201811', '201911', '202012', '202106', '202111'])"
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no 202211, 202305, 202311. We will start support from 202405.

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

Successfully merging this pull request may close these issues.

2 participants