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

Add the show ip/ipv6 bgp test ro user commands #4949

Merged
merged 2 commits into from
Jan 19, 2022

Conversation

xumia
Copy link
Collaborator

@xumia xumia commented Jan 14, 2022

Description of PR

Summary:
Add UTs to cover the 'show ip bgp' ro commands.
Fix some of the commands that prompt rw required message, but not detected issue.
Add stricter testing checks, for any ro/rw commands, if any error log which contains the "RW permission" required message, the UT will be failed.
The checks will be succeeded after the PR sonic-net/sonic-utilities#2011 merged.

show ip bgp neighbors 

Make sure your account has RW permission to current device.
Otherwise sudo requests will be rejected.

Type of change

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

Back port request

  • 201911

Approach

What is the motivation for this PR?

Add test cases for PR sonic-net/sonic-utilities#2011

How did you do it?

How did you verify/test it?

Any platform specific information?

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

Documentation

@xumia xumia requested a review from a team as a code owner January 14, 2022 12:42
@xumia xumia requested a review from qiluo-msft January 14, 2022 12:43
qiluo-msft
qiluo-msft previously approved these changes Jan 14, 2022
@xumia
Copy link
Collaborator Author

xumia commented Jan 15, 2022

The test_ro_user does not work as expected, the test should be failed.

AzDevOps@vmss-soni000002:~$ sshpass -p *** ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null test_rouser@10.250.0.101 show ip bgp neighbors
Warning: Permanently added '10.250.0.101' (ECDSA) to the list of known hosts.

Make sure your account has RW permission to current device.
Otherwise sudo requests will be rejected.

sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required

AzDevOps@vmss-soni000002:~$ echo $?
0
AzDevOps@vmss-soni000002

We cannot use the return value to check whether ro permission is correct or not.

@qiluo-msft
Copy link
Contributor

return res['rc'] != 0 and "Make sure your account has RW permission to current device" in res['stderr']

I am wondering in ssh_remote_ban_run, we did check rc != 0. Why it is working?


Refers to: tests/tacacs/test_ro_user.py:54 in eeb6671. [](commit_id = eeb6671, deletion_comment = False)

@xumia xumia requested a review from wangxin January 17, 2022 00:29
@xumia
Copy link
Collaborator Author

xumia commented Jan 17, 2022

Waiting for all the following PRs complete.
sonic-net/sonic-buildimage#9773
sonic-net/sonic-buildimage#9774
sonic-net/sonic-buildimage#9775

@wangxin
Copy link
Collaborator

wangxin commented Mar 16, 2022

This is an old PR which has already been included in 202012 when it was branched off.

wangxin pushed a commit that referenced this pull request Mar 16, 2022
Add UTs to cover the 'show ip bgp' ro commands.
Fix some of the commands that prompt rw required message, but not detected issue.
Add stricter testing checks, for any ro/rw commands, if any error log which contains the "RW permission" required message, the UT will be failed.
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.

3 participants