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

[generic-config-updater][Add/Remove rack] - Updated test to include add/remove rack via patch-apply #5002

Merged
merged 23 commits into from
Feb 17, 2022

Conversation

renukamanavalan
Copy link
Contributor

@renukamanavalan renukamanavalan commented Jan 22, 2022

Description of PR

Summary:
Updated test to add/remove rack using generic-config-updater.

Type of change

  1. Updated existing test to add rack via "**config apply-patch **"
  2. Added remove rack too via "**config apply-patch **"
  3. Upgraded test code to be able to run directly in switch -- using same test code as ansible, by just mocking duthost and few common ansible provided functions
  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911

Approach

What is the motivation for this PR?

  1. To add test scenario of add/remove rack for generic_config_updater.

How did you do it?

  1. Have two configs with & w/o a T0
  2. Create two config diff patches as one to add T0 and another to remove T0
  3. Get two DB dumps of CONFIG-DB, APP-DB & STATE-DB for both with & w/o T0
  4. Test Add T0:
    4.1) Load minigraph w/o T0
    4.2) Apply patch to add T0
    4.3) Get DB dumps
    4.4) Compare dumps with those obtained upon loading original minigraph that had all T0s
  5. Test remove T0
    5.1) Ensure T0 is currently present (following step 4 ensures that)
    5.2) Apply patch to remove T0
    5.3) Get DB dumps
    5.4) Compare with dumps ta upon loading minigraph w/o T0

How did you verify/test it?

  1. Run ansible test with master, 20201231.49 & 20191130.80

Any platform specific information?

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

Documentation

@renukamanavalan renukamanavalan requested a review from a team as a code owner January 22, 2022 00:29
@renukamanavalan renukamanavalan self-assigned this Jan 22, 2022
@lgtm-com
Copy link

lgtm-com bot commented Jan 22, 2022

This pull request introduces 15 alerts and fixes 3 when merging 7849008 into cd8c365 - view on LGTM.com

new alerts:

  • 9 for Unused import
  • 5 for Unused local variable
  • 1 for Redundant comparison

fixed alerts:

  • 3 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Jan 31, 2022

This pull request introduces 15 alerts and fixes 3 when merging a737faaecf885379ba7ca275bdba9fba8705e3cd into b36f7db - view on LGTM.com

new alerts:

  • 9 for Unused import
  • 5 for Unused local variable
  • 1 for Redundant comparison

fixed alerts:

  • 3 for Unused import

@renukamanavalan
Copy link
Contributor Author

Ansible test run succeeded.

@renukamanavalan
Copy link
Contributor Author

Above failed test runs are unrelated to this PR.
____________________ ERROR at teardown of test_warm_reboot _____________________

ghooo
ghooo previously approved these changes Feb 1, 2022
@qiluo-msft
Copy link
Contributor

qiluo-msft commented Feb 1, 2022

    yield 0

Is 0 needed?


In reply to: 1027217195


In reply to: 1027217195


Refers to: tests/configlet/test_add_rack.py:22 in 45f12f8. [](commit_id = 45f12f8, deletion_comment = False)


init(duthost)

fpath = "/usr/local/lib/python3.9/dist-packages/generic_config_updater/services_validator.py"
Copy link
Contributor

@qiluo-msft qiluo-msft Feb 1, 2022

Choose a reason for hiding this comment

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

/usr/local/lib/python3.9/dist-packages/generic_config_updater/services_validator.py

fpath = "/usr/local/lib/python3.9/dist-packages/generic_config_updater/services_validator.py"


Python version keeps increasing along with Debian version. So it is not future proof in test.

If your purpose is to check feature availability. You may use python3 -c 'import generic_config_updater'. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Resolved.

log_debug("Created data_dir={} version={}".format(data_dir, init_data["version"]))


def backup_minigraph(duthost):
Copy link
Contributor

@qiluo-msft qiluo-msft Feb 1, 2022

Choose a reason for hiding this comment

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

backup_minigraph

Is it better to leverage the checkpoint feature in GCU? It will backup/restore ConfigDB. #WontFix

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 does in special way of creating a copy as /etc/sonic/orig/minigraph.xml.addRack.orig. I prefer it that way.
This feature is exposed to both manual & Ansible.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comments

@renukamanavalan
Copy link
Contributor Author

removed "yield 0"

@lgtm-com
Copy link

lgtm-com bot commented Feb 16, 2022

This pull request introduces 2 alerts and fixes 3 when merging b399799 into 79a8403 - view on LGTM.com

new alerts:

  • 2 for Unused local variable

fixed alerts:

  • 3 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Feb 16, 2022

This pull request introduces 2 alerts and fixes 3 when merging 5bbcc42 into 79a8403 - view on LGTM.com

new alerts:

  • 2 for Unused local variable

fixed alerts:

  • 3 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Feb 16, 2022

This pull request introduces 2 alerts and fixes 3 when merging ee2e72b into 79a8403 - view on LGTM.com

new alerts:

  • 2 for Unused local variable

fixed alerts:

  • 3 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Feb 16, 2022

This pull request fixes 3 alerts when merging 45f12f8 into 79a8403 - view on LGTM.com

fixed alerts:

  • 3 for Unused import

@renukamanavalan
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

3 participants