Skip to content

Added test case to make sure when teamd feature/service is stop kernel device is cleanup and SIGTERM are handled gracefully#2186

Merged
abdosi merged 4 commits intosonic-net:masterfrom
abdosi:portchannel_cleanup
Sep 4, 2020
Merged

Added test case to make sure when teamd feature/service is stop kernel device is cleanup and SIGTERM are handled gracefully#2186
abdosi merged 4 commits intosonic-net:masterfrom
abdosi:portchannel_cleanup

Conversation

@abdosi
Copy link
Copy Markdown
Contributor

@abdosi abdosi commented Sep 3, 2020

Why/What I did:-
Added test case to make sure when teamd feature/service is stop
portchannel are cleanup in kernel and we get syslog
from teammgrd and teamsyncd process of handling
SIGTERM signal

This PR is raise to track the fixes done by PR-

  1. [teamsyncd][teammgrd] Graceful exit after receiving SIGTERM sonic-swss#1407
  2. Teamd :: fix for cleaning up the teamd processes correctly on teamd docker stop sonic-swss#1159

How I verify:

sudo py.test --inventory "../ansible/str" --host-pattern str-s6000-on-2 --module-path "../ansible/library/" --testbed vms13-5-t1-lag --testbed_file "../ansible/testbed.csv" -vvv pc/test_po_cleanup.py

On KVM VS Switch:
sudo py.test --inventory "veos.vtb" --host-pattern vlab-01 --module-path "../ansible/library/" --testbed vms-kvm-t0 --testbed_file "vtestbed.csv" -vvv pc/test_po_cleanup.py --skip_sanity

Currently this test case will fail on master and 201911 as we are waiting for PR#sonic-net/sonic-swss#1407 to be merged.

Update:

With PR#1407 test case is passing:

sudo py.test --inventory "../ansible/str" --host-pattern str-a7050-acs-1 --module-path "../ansible/library/" --testbed vms2-5-t0-7050-1 --testbed_file
"../ansible/testbed.csv" -vvv pc/test_po_cleanup.py --skip_sanity
=============================================================================================== test session starts ===============================================================================================
platform linux2 -- Python 2.7.12, pytest-4.6.5, py-1.8.1, pluggy-0.13.1 -- /usr/bin/python
cachedir: .pytest_cache
ansible: 2.8.7
rootdir: /data/Networking-acs-sonic-mgmt/tests, inifile: pytest.ini
plugins: ansible-2.2.2, xdist-1.28.0, repeat-0.8.0, forked-1.1.3
collected 1 item

pc/test_po_cleanup.py::test_po_cleanup PASSED [100%]

=========================================================================================== 1 passed in 210.76 seconds ============================================================================================

portchannel are cleanup in kernel and we get syslog
from teammmgrd and teamsyncd process of handling
SIGTERM

Signed-off-by: Abhishek Dosi <[email protected]>
]
loganalyzer.expect_regex.extend(expectRegex)

yield
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think you need to add yield if no clean up is required

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.

@yxieca Done



def check_kernel_po_interface_cleaned(duthost):
res = duthost.shell("ip link show | grep -c PortChannel | cat")["stdout_lines"][0].decode("utf-8")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What does this pipe to cat do?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are you trying to mute the return errorcode? you can use command_output = self.shell(cmd, module_ignore_errors=True) to ignore the command error code instead.

Copy link
Copy Markdown
Contributor Author

@abdosi abdosi Sep 3, 2020

Choose a reason for hiding this comment

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

@yxieca yes, that was the reason for using cat. with output as "0" ansible module return error.
I will update to use module_ignore_errors as True

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.

@yxieca Done

@yxieca yxieca requested a review from a team September 4, 2020 03:16
Abhishek Dosi added 2 commits September 4, 2020 19:27
and added some ignore syslog messages.

Signed-off-by: Abhishek Dosi <[email protected]>
Signed-off-by: Abhishek Dosi <[email protected]>
Copy link
Copy Markdown
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

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

LGTM

@abdosi abdosi merged commit 05cada6 into sonic-net:master Sep 4, 2020
@abdosi abdosi deleted the portchannel_cleanup branch September 4, 2020 22:07
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
Update submodule ptr for sonic-utilities to include

[202111] [portchannel] Added ACL/PBH binding checks to the port before getting added to portchannel (sonic-net#2186)

Signed-off-by: Vivek Reddy Karri <[email protected]>
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