Skip to content

[dualtor] fixing test_downstream_ecmp_nexthops#8906

Merged
prsunny merged 4 commits intosonic-net:masterfrom
Ndancejic:ecmp
Sep 7, 2023
Merged

[dualtor] fixing test_downstream_ecmp_nexthops#8906
prsunny merged 4 commits intosonic-net:masterfrom
Ndancejic:ecmp

Conversation

@Ndancejic
Copy link
Copy Markdown
Contributor

What I did:
changed test_downstream_ecmp_nexthops to check if packets being sent are funneled towards a single mux neighbor or portchannel

Why I did it:
test_downstream_ecmp_nexthops fails due to swss change which programs a single active mux nexthop or a single tunnel route for a given route

How to test:
run sonic-mgmt dualtor/test_orchagent_active_tor_downstream.py test on t0 topo.

Description of PR

fixes active_tor_downstream test to work with multiple mux routes programmed

Summary:
ADO: 18206088

Type of change

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

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

test_downstream_ecmp_nexthops fails due to swss change which programs a single active mux nexthop or a single tunnel route for a given route

How did you do it?

changed test_downstream_ecmp_nexthops to check if packets being sent are funneled towards a single mux neighbor or portchannel

How did you verify/test it?

run sonic-mgmt dualtor/test_orchagent_active_tor_downstream.py test on t0 topo.

@Ndancejic Ndancejic requested review from lolyu and wsycqyz as code owners July 11, 2023 12:12
@Ndancejic Ndancejic changed the title [202012][dualtor] fixing test_downstream_ecmp_nexthops [dualtor] fixing test_downstream_ecmp_nexthops Jul 11, 2023
What I did:
changed test_downstream_ecmp_nexthops to check if packets being sent are
funneled towards a single mux neighbor or portchannel

Why I did it:
test_downstream_ecmp_nexthops fails due to swss change which programs a
single active mux nexthop or a single tunnel route for a given route

How to test:
run sonic-mgmt dualtor/test_orchagent_active_tor_downstream.py test on t0 topo.

Signed-off-by: Nikola Dancejic <ndancejic@microsoft.com>
@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/common/dualtor/dual_tor_utils.py:1056:5: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1057:5: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1058:5: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1059:5: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1059:5: E125 continuation line with same indent as next logical line
tests/common/dualtor/dual_tor_utils.py:1062:30: E222 multiple spaces after operator
tests/common/dualtor/dual_tor_utils.py:1081:45: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1082:45: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1083:45: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1084:45: E128 continuation line under-indented for visual indent
tests/common/dualtor/dual_tor_utils.py:1085:45: E128 continuation line under-indented for visual indent
...
[truncated extra lines, please run pre-commit locally to view full check results]

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>

@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/dualtor/test_orchagent_active_tor_downstream.py:177:13: F841 local variable 'uplink_ports_active' is assigned to but never used
tests/dualtor/test_orchagent_active_tor_downstream.py:179:13: F405 'set_mux_state' may be undefined, or defined from star imports: tests.common.dualtor.dual_tor_mock
tests/dualtor/test_orchagent_active_tor_downstream.py:182:40: E128 continuation line under-indented for visual indent
tests/dualtor/test_orchagent_active_tor_downstream.py:187:13: F405 'set_mux_state' may be undefined, or defined from star imports: tests.common.dualtor.dual_tor_mock
tests/dualtor/test_orchagent_active_tor_downstream.py:190:40: E128 continuation line under-indented for visual indent

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>

Signed-off-by: Nikola Dancejic <ndancejic@microsoft.com>
@Ndancejic
Copy link
Copy Markdown
Contributor Author

@prsunny for vis/review


if count > 0 and count != expect_packet_num:
all_pkts = False
pt_assert(all_pkts, "Packets not sent up single standby port {}".format(
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.

Are we only counting the packet or validating the IP-IP packet?

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.

currently only counting packets, should I add IP-IP validation?

all_pkts = False
pt_assert(all_pkts, "Packets not sent down single active port {}".format(downlink_int))

if len(downlink_ints) == 0:
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.

Is this condition ever satisfied? In test_downstream_ecmp_nexthops, the list nexthop_interfaces doesn't look like it's ever modified which means this would never get hit.

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.

I think you're right, I'll copy nexthop_interfaces and remove standby interfaces so that downlink_ints only reflects active neighbors

Comment on lines +1060 to +1061
expected_uplink_ports = list()
expected_uplink_portchannels = list()
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.

Looks like these lists never get used

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.

yes I think you're right, I removed that section



# verify nexthops are only sent to single active or standby mux
def check_nexthops_single_downlink(rand_selected_dut, ptfadapter, dst_server_addr,
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.

I think this name is a little misleading since we're also checking the case where we expect all the packets to be sent to a single uplink. On that note, would it make more sense to break that case out into it's own helper function check_nexthops_single_uplink?

Comment on lines +1090 to +1091
all_pkts = False
pt_assert(all_pkts, "Packets not sent down single active port {}".format(downlink_int))
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.

what's the purpose of using all_pkts here? Would be cleaner to call pytest.fail

Comment on lines +1105 to +1106
all_pkts = False
pt_assert(all_pkts, "Packets not sent up single standby port {}".format(
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.

same as above, prefer pytest.fail

for send_packet, exp_pkt, exp_tunnel_pkt in packets_to_send:
testutils.send(ptfadapter, int(ptf_t1_intf.strip("eth")), send_packet, count=1)
# expect multi-mux nexthops to focus packets to one downlink
all_allowed_ports = expected_downlink_ports
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.

Does this mean we never match/count any packets on uplink ports?

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.

we do later, but if we have expected_downlink_ports, then all traffic should be routed towards those. In the case where there aren't any, we then check the uplink portchannels to make sure traffic is going towards a single uplink

Copy link
Copy Markdown
Contributor

@theasianpianist theasianpianist left a comment

Choose a reason for hiding this comment

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

Suggest breaking logic for checking uplinks and downlinks into separate functions to make the test flow a bit clearer.

Signed-off-by: Nikola Dancejic <ndancejic@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

@Ndancejic PR conflicts with 202012 branch

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Sep 15, 2023
* [dualtor] fixing test_downstream_ecmp_nexthops
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202305: #10020

@mssonicbld
Copy link
Copy Markdown
Collaborator

@Ndancejic PR conflicts with 202205 branch

@ayurkiv-nvda
Copy link
Copy Markdown
Contributor

Hello
When cherry-pick conflicts with 202205 are planned to be fixed?

@congh-nvidia
Copy link
Copy Markdown
Contributor

Hi @Ndancejic, we need this fix for 202205, could you please open a new PR to resolve the conflict?

@Ndancejic
Copy link
Copy Markdown
Contributor Author

posted PR for 202205 branch: #11001

AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
* [dualtor] fixing test_downstream_ecmp_nexthops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants