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

[sanity check]: Add mux simulator sanity check #2862

Merged

Conversation

theasianpianist
Copy link
Contributor

@theasianpianist theasianpianist commented Jan 26, 2021

Signed-off-by: Lawrence Lee [email protected]

Description of PR

Summary:
Closes #2753

Type of change

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

Approach

What is the motivation for this PR?

Ensure that the mux cable simulator is fully functional prior to each test run

How did you do it?

  • Send packets from the ToRs to the PTF, check that the active ToR's packet is received and the standby ToR's is not
    • I leveraged the fact that the ping command automatically sends ARP requests when it cannot find the target address, and check for the receipt of these ARP requests on the PTF. The ping command itself is expected to fail.
  • Send packets from the PTF to the ToRs, check that both ToR's received the packet
    • Since there are no packet testing utils installed on the ToRs, I sent GARP packets to the ToRs and checked their neighbor tables to verify receipt.

Note that due to the new sanity check structure, check_simulator_read_side had to be renamed to get_simulator_read_side to prevent pytest from looking for a non-existent fixture named check_simulator_read_side (this is only necessary because checks.py iemports this method).

How did you verify/test it?

  • Run a sanity check on a dual ToR testbed, ensure that it is able to pass and is also able to detect failures
  • Run a sanity check on a single ToR testbed, ensure the mux simulator check does not run
  • Run a sanity check on a T1 testbed, ensure the mux simulator check does not run

Any platform specific information?

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

Documentation

@lgtm-com
Copy link

lgtm-com bot commented Jan 26, 2021

This pull request introduces 1 alert when merging fca2ac3d0b0a0fc2d63cefff9e7e366cdca61a9c into 2f0b561 - view on LGTM.com

new alerts:

  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Jan 26, 2021

This pull request introduces 1 alert when merging e63cdaf852a5505baa3e3db3d23f7b8832b64c15 into 15793fb - view on LGTM.com

new alerts:

  • 1 for Unused import

@theasianpianist theasianpianist marked this pull request as draft January 26, 2021 22:34
* Make compatible with other topologies

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

lgtm-com bot commented Feb 18, 2021

This pull request introduces 1 alert when merging 5729745 into e893f73 - view on LGTM.com

new alerts:

  • 1 for Module is imported more than once

@theasianpianist theasianpianist marked this pull request as ready for review February 18, 2021 18:39
@theasianpianist theasianpianist requested a review from a team February 18, 2021 18:39
return results

try:
pytest_assert(ptf_arp_tgt_ip in lower_tor_arp_table)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ptf_arp_tgt_ip in lower_tor_arp_table --> ptf_arp_tgt_ip not in lower_tor_arp_table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pytest_assert(ptf_arp_tgt_ip in lower_tor_arp_table)
except AssertionError:
results['failed'] = True
results['failed_reason'] = 'Packet from PTF not received on standby lower ToR'
Copy link
Collaborator

Choose a reason for hiding this comment

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

'Packet from PTF not received on standby lower ToR' --> 'Packet from PTF received on standby lower ToR'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are actually expecting the packet from PTF to reach both ToRs here, since upstream traffic from the server is broadcast to both ToRs. I'll fix my comments to be accurate, sorry for the confusion!

results['failed_reason'] = 'Unable to switch active link to upper ToR'
return results

# Ping from both ToRs, expect both messages to reach PTF
Copy link
Collaborator

Choose a reason for hiding this comment

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

# Ping from both ToRs, expect both messages to reach PTF -> # Ping from both ToRs, expect only message from upper_tor to reach PTF

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, thanks!

upper_tor_arp_table = upper_tor_host.switch_arptable()['ansible_facts']['arptable']['v4']
lower_tor_arp_table = lower_tor_host.switch_arptable()['ansible_facts']['arptable']['v4']
try:
pytest_assert(ptf_arp_tgt_ip in upper_tor_arp_table)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ptf_arp_tgt_ip in upper_tor_arp_table --> ptf_arp_tgt_ip not in upper_tor_arp_table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment #2862 (comment)

pytest_assert(ptf_arp_tgt_ip in upper_tor_arp_table)
except AssertionError:
results['failed'] = True
results['failed_reason'] = 'Packet from PTF not received on standby upper ToR'
Copy link
Collaborator

Choose a reason for hiding this comment

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

'Packet from PTF not received on standby upper ToR' -> 'Packet from PTF received on standby upper ToR'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

results['failed_reason'] = 'Packet from PTF not received on active lower ToR'
return results

logger.info(json.dumps(results, indent=4, sort_keys=True))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest not to dump the check result here. All the check results will be dumped at INFO level after all checks are done. It would be better just to log an INFO message indicating mux simulator sanity check is done.

@lgtm-com
Copy link

lgtm-com bot commented Feb 19, 2021

This pull request introduces 1 alert when merging bea9715 into a1a713e - view on LGTM.com

new alerts:

  • 1 for Module is imported more than once

@lgtm-com
Copy link

lgtm-com bot commented Feb 24, 2021

This pull request introduces 1 alert when merging 0b6d219 into 7e92609 - view on LGTM.com

new alerts:

  • 1 for Explicit export is not defined

Signed-off-by: Lawrence Lee <[email protected]>
results['failed_reason'] = 'Unable to switch active link to upper ToR'
return results

# Ping from both ToRs, expect only message from upper ToR to reach PTF
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to clear ARP on DUT before start ping?

* Avoid errors when using fixtures in other fixtures that are module
scoped (e.g. sanity_check)

Signed-off-by: Lawrence Lee <[email protected]>
* Only run check items that are actually defined in checks.py

Signed-off-by: Lawrence Lee <[email protected]>
@theasianpianist theasianpianist merged commit 7383082 into sonic-net:master Mar 2, 2021
@theasianpianist theasianpianist deleted the mux-sim-sanity-check branch March 2, 2021 18:22
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.

OVS Bridge/Mux Simulator Sanity Check
3 participants