Skip to content

[test_route_flap] Route flap multi-dut fix if the selected duthost has downstream neighbors#11677

Merged
rlhui merged 4 commits intosonic-net:masterfrom
sanjair-git:route-flap-fix
Feb 23, 2024
Merged

[test_route_flap] Route flap multi-dut fix if the selected duthost has downstream neighbors#11677
rlhui merged 4 commits intosonic-net:masterfrom
sanjair-git:route-flap-fix

Conversation

@sanjair-git
Copy link
Copy Markdown
Contributor

Description of PR

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 201911
  • 202012
  • 202205
  • 202305
  • 202311

Approach

What is the motivation for this PR?

  • For T2 Chassis(topo-t2), route/test_route_flap works fine, if the selected duthost has upstream T3 neighbors.
  • Similarly, if the selected duthost has downstream T1 neighbors and if there is only one dut with T1 neighbors, test works fine too.
  • But if the selected duthost has downstream T1 neighbors and if there are more than one dut with downstream neighbors, route/test_route_flap fails.

How did you do it?

  • Fetch the 'neighbor type' (LeafRouter/SpineRouter/AZNGhub) based on the chosen dev_port from get_dev_port_and_route
  • Get all the neighbors of same neighbor type and fetch the ptf receiving ports list based on the retrieved neighbors list.
  • Pass the received ptf ports list to send_recv_ping_packet method for further testing.

How did you verify/test it?

  • Ran route/test_route_flap test case on T2 Chassis with 'topo-t2' topology having 3-line cards with at least 2 cards having downstream T1 neighbors.
  • Test passes.

Any platform specific information?

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

Documentation

image

@mssonicbld
Copy link
Copy Markdown
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/route/test_route_flap.py:238:53: E231 missing whitespace after ','

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

if 'minigraph_port_name_to_alias_map' in mg_facts else {}
for neighbor in neighs:
local_ip = neighs[neighbor]['local_addr']
nbr_port = get_port_by_ip(config_facts, local_ip)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nbr_port could be Ethernet<> or PortChannel<>.. right?
how are you handling portchannel case here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

'dev_port' which is passed to this method 'get_neighbor_info' either can be Portchannel<> or Ethernet<>.

And get_port_by_ip method above returns the nbr_port based on the dut config_facts of 'PORTCHANNEL_INTERFACE' and 'INTERFACE'. So, if the nbr_port returned by get_port_by_ip method is a Portchannel<> which can be directly same as 'dev_port' passed through 'get_neighbor_info'. Using that, we are fetching the neighbor's name and its type.

But if the nbr_port returned by 'get_port_by_ip' is Ethernet<>, it is actually alias interface name, not the actual interface name. So, we get the actual interface name using the port_name_to_alias_map from minigraph facts for fetching the neighbor's name and its type.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

got it. thanks for the explanation..

@sanjair-git
Copy link
Copy Markdown
Contributor Author

Before the PR change:

Test fetches only the ptf receiving ports of the DUT under test. T1 neighbor routes are same in all downstream DUTs. ping packet gets forwarded to other T1 neighbor DUT's ports instead of the DUT ports under test.

After the PR change:

Test fetches all the ptf receiving ports of all of the DUTs which has same type of neighbors similar to dut under test. Due to this change, we are making sure ping packet is received on any of the DUTs' ptf ports having similar neighbors (T1/T3).

@deepak-singhal0408
Copy link
Copy Markdown
Contributor

LGTM

@deepak-singhal0408
Copy link
Copy Markdown
Contributor

@judyjoseph the changes look good to me.. Please help with the merge.

@rajendrat
Copy link
Copy Markdown
Contributor

viz @abdosi : Please help merge this to 202305 branch.
@vperumal

@mssonicbld
Copy link
Copy Markdown
Collaborator

@sanjair-git PR conflicts with 202205 branch

@mssonicbld
Copy link
Copy Markdown
Collaborator

@sanjair-git PR conflicts with 202305 branch

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Mar 22, 2024
…s downstream neighbors (sonic-net#11677)

* route-flap: Generic fix for issue-11460

* flake8 fix
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202311: #12101

sanjair-git added a commit to sanjair-git/sonic-mgmt that referenced this pull request Mar 22, 2024
…s downstream neighbors (sonic-net#11677)

* route-flap: Generic fix for issue-11460

* flake8 fix
sanjair-git added a commit to sanjair-git/sonic-mgmt that referenced this pull request Mar 22, 2024
…s downstream neighbors (sonic-net#11677)

* route-flap: Generic fix for issue-11460

* flake8 fix
@abdosi
Copy link
Copy Markdown
Contributor

abdosi commented Apr 22, 2024

@sanjair-git please create PR for 202205/202305 as their is conflict in cherry-pick.

@sanjair-git
Copy link
Copy Markdown
Contributor Author

@sanjair-git please create PR for 202205/202305 as their is conflict in cherry-pick.

@abdosi , For both 202205/202305, cherry-pick PRs have been created already. Please see below,
202205: #12137
202305: #12138

wangxin pushed a commit that referenced this pull request Apr 26, 2024
…uthost has downstream neighbors (#11677) (#12137)

This is cherry-pick PR for 202205 branch. Original PR #11677

This PR fixes issue #11460

What is the motivation for this PR?
* For T2 Chassis(topo-t2), route/test_route_flap works fine, if the selected duthost has upstream T3 neighbors.
* Similarly, if the selected duthost has downstream T1 neighbors and if there is only one dut with T1 neighbors, test works fine too.
* But if the selected duthost has downstream T1 neighbors and if there are more than one dut with downstream neighbors, route/test_route_flap fails.

How did you do it?
* Fetch the 'neighbor type' (LeafRouter/SpineRouter/AZNGhub) based on the chosen dev_port from get_dev_port_and_route
* Get all the neighbors of same neighbor type and fetch the ptf receiving ports list based on the retrieved neighbors list.
Pass the received ptf ports list to send_recv_ping_packet method for further testing.

How did you verify/test it?
Ran route/test_route_flap test case on T2 Chassis with 'topo-t2' topology having 3-line cards with at least 2 cards having downstream T1 neighbors.
Test passes.

Before the PR change:
Test fetches only the ptf receiving ports of the DUT under test. T1 neighbor routes are same in all downstream DUTs. ping packet gets forwarded to other T1 neighbor DUT's ports instead of the DUT ports under test.

After the PR change:
Test fetches all the ptf receiving ports of all of the DUTs which has same type of neighbors similar to dut under test. Due to this change, we are making sure ping packet is received on any of the DUTs' ptf ports having similar neighbors (T1/T3).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants