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

Fix the issue when persistent DVS is used to run pytest which has number of front-panel ports < 32 #1373

Merged
merged 8 commits into from
Aug 18, 2020

Conversation

abdosi
Copy link
Contributor

@abdosi abdosi commented Jul 31, 2020

Why/What I did
Fix the issue where persistent DVS is used to run pytest
and ports are created dynamically (ref pr#
sonic-net/sonic-buildimage#4499). There were two
issues:

a) since number of dynamic front port can be < 32 test case fails
   as it expect always 32. Make sure to update persistent DVS to always have
   32 ports/server link as part of test run if forcedvs option provided else abort test case 
   and save the current config db

b) after test is done persistent DVS need to be moved to original state.
   Make sure to remove extra port/server link and restore back config db

How I verified it

a) Verified Persistent DVS < 32 ports without forcedvs option then abort else DVS restarted with 32 ports.
b) Manually Verified VS Docker has correct interface config/port.ini/ip link after test is completed and restored original config db
c) Verified on host ip netns list has expected server link only after is completed

and ports are created dynamically (ref pr:
sonic-net/sonic-buildimage#4499). There were two
issues:

a) since number of dynamic front port can be < 32 test case fails
   as it expect always 32. Make sure to udpate persitent DVS to always have
   32 ports/server link as part of test run and save the current config
   db

b) after test is done persistent DVS need to be moved to original state.
   Make dure to remove extra port/server link and restore back config db

Signed-off-by: Abhishek Dosi <[email protected]>
@abdosi abdosi requested review from lguohan and daall July 31, 2020 19:19
@daall
Copy link
Contributor

daall commented Aug 3, 2020

since number of dynamic front port can be < 32 test case fails as it expect always 32

Which tests are always expecting 32 ports? I am OK with this change as a short-term fix, but I think the real issue here is that the tests are hard-coded for 32 ports instead of checking in the Config DB. We should open an issue and track this.

tests/conftest.py Outdated Show resolved Hide resolved
tests/conftest.py Show resolved Hide resolved
Signed-off-by: Abhishek Dosi <[email protected]>
@abdosi
Copy link
Contributor Author

abdosi commented Aug 3, 2020

since number of dynamic front port can be < 32 test case fails as it expect always 32

Which tests are always expecting 32 ports? I am OK with this change as a short-term fix, but I think the real issue here is that the tests are hard-coded for 32 ports instead of checking in the Config DB. We should open an issue and track this.

@daall . Many test case are using hard-coded server indexing

For eg: test_fdb_update.py we use dvs.servers[17].runcmd
test_route.py we use dvs.servers[3].runcmd

@daall
Copy link
Contributor

daall commented Aug 3, 2020

since number of dynamic front port can be < 32 test case fails as it expect always 32

Which tests are always expecting 32 ports? I am OK with this change as a short-term fix, but I think the real issue here is that the tests are hard-coded for 32 ports instead of checking in the Config DB. We should open an issue and track this.

@daall . Many test case are using hard-coded server indexing

For eg: test_fdb_update.py we use dvs.servers[17].runcmd
test_route.py we use dvs.servers[3].runcmd

ack, I will open an issue to track this. Thanks for pointing this out!

daall
daall previously approved these changes Aug 3, 2020
Copy link
Contributor

@daall daall left a comment

Choose a reason for hiding this comment

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

lgtm, please wait for @lguohan's review

@daall daall added the DVS ⭐ label Aug 3, 2020
@abdosi
Copy link
Contributor Author

abdosi commented Aug 3, 2020

retest this please

2 similar comments
@abdosi
Copy link
Contributor Author

abdosi commented Aug 4, 2020

retest this please

@abdosi
Copy link
Contributor Author

abdosi commented Aug 5, 2020

retest this please

@abdosi
Copy link
Contributor Author

abdosi commented Aug 6, 2020

lgtm, please wait for @lguohan's review

@lguohan Can you please review this

@abdosi
Copy link
Contributor Author

abdosi commented Aug 7, 2020

retest this please

1 similar comment
@abdosi
Copy link
Contributor Author

abdosi commented Aug 7, 2020

retest this please

@abdosi
Copy link
Contributor Author

abdosi commented Aug 8, 2020

@lguohan can you review this.

@abdosi
Copy link
Contributor Author

abdosi commented Aug 8, 2020

retest this please

1 similar comment
@abdosi
Copy link
Contributor Author

abdosi commented Aug 9, 2020

retest this please

@abdosi
Copy link
Contributor Author

abdosi commented Aug 11, 2020

lgtm, please wait for @lguohan's review

@lguohan Can you please review this

@lguohan is it ok to merge ?

@lguohan
Copy link
Contributor

lguohan commented Aug 11, 2020

maybe we can just check if persistent dvs has 32 ports, if not, then we just abort and say persistent dvs has to be 32 ports instead of reconfiguration here?

@abdosi
Copy link
Contributor Author

abdosi commented Aug 11, 2020

maybe we can just check if persistent dvs has 32 ports, if not, then we just abort and say persistent dvs has to be 32 ports instead of reconfiguration here?

@lguohan i think it is better to keep using existing persistent dvs and we can run pytest on top of that
instead to abort it especially for local development/debugging which can have local swss debian package.

@lguohan
Copy link
Contributor

lguohan commented Aug 12, 2020

@abdosi , can you provide that as an option?

@lguohan Updated with --forcedvs option . Default being abort if ports < 32
@daall

@lgtm-com
Copy link

lgtm-com bot commented Aug 14, 2020

This pull request introduces 1 alert and fixes 12 when merging d821218 into 879f45b - view on LGTM.com

new alerts:

  • 1 for Syntax error

fixed alerts:

  • 4 for First parameter of a method is not named 'self'
  • 4 for Unused local variable
  • 2 for Variable defined multiple times
  • 1 for Testing equality to None
  • 1 for Unnecessary 'else' clause in loop

Signed-off-by: Abhishek Dosi <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Aug 14, 2020

This pull request introduces 1 alert and fixes 12 when merging 6629b67 into 879f45b - view on LGTM.com

new alerts:

  • 1 for Syntax error

fixed alerts:

  • 4 for First parameter of a method is not named 'self'
  • 4 for Unused local variable
  • 2 for Variable defined multiple times
  • 1 for Testing equality to None
  • 1 for Unnecessary 'else' clause in loop

Signed-off-by: Abhishek Dosi <[email protected]>
tests/conftest.py Outdated Show resolved Hide resolved
Co-authored-by: Danny Allen <[email protected]>
@daall
Copy link
Contributor

daall commented Aug 17, 2020

retest vs please

@abdosi abdosi merged commit 11da264 into sonic-net:master Aug 18, 2020
@abdosi abdosi deleted the dvs_test branch August 18, 2020 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants