Skip to content

Commit

Permalink
Add the show ip/ipv6 bgp test ro user commands (#4949)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
xumia authored and wangxin committed Mar 16, 2022
1 parent bdb27e7 commit f5127ef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/tacacs/test_ro_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def ssh_remote_allow_run(localhost, remote_ip, username, password, cmd):
res = ssh_remote_run(localhost, remote_ip, username, password, cmd)
# Verify that the command is allowed
logger.info("check command \"{}\" rc={}".format(cmd, res['rc']))
expected = res['rc'] == 0 or (res['rc'] != 0 and "Make sure your account has RW permission to current device" not in res['stderr'])
expected = "Make sure your account has RW permission to current device" not in res['stderr']
if not expected:
logger.error("error output=\"{}\"".format(res["stderr"]))
return expected
Expand Down Expand Up @@ -104,8 +104,12 @@ def test_ro_user_allowed_command(localhost, duthosts, enum_rand_one_per_hwsku_ho
"show interface status",
"show interface portchannel",
"show ip bgp summary",
"show ip bgp neighbors",
"show ip bgp network",
"show ip interface",
"show ipv6 interface",
"show ipv6 bgp neighbors",
"show ipv6 bgp network",
"show lldp table",
],
}
Expand Down

0 comments on commit f5127ef

Please sign in to comment.