66from .helper import gnmi_set , dump_gnmi_log
77from tests .common .utilities import wait_until
88from tests .common .plugins .allure_wrapper import allure_step_wrapper as allure
9+ from tests .common .fixtures .duthost_utils import duthost_mgmt_ip # noqa: F401
10+
911
1012logger = logging .getLogger (__name__ )
1113allure .logger = logger
1618]
1719
1820
19- def test_gnmi_capabilities (duthosts , rand_one_dut_hostname , localhost ):
21+ def test_gnmi_capabilities (duthosts , rand_one_dut_hostname , localhost , duthost_mgmt_ip ): # noqa: F811
2022 '''
2123 Verify GNMI capabilities
2224 '''
2325 duthost = duthosts [rand_one_dut_hostname ]
24- ret , msg = gnmi_capabilities (duthost , localhost )
26+ ret , msg = gnmi_capabilities (duthost , localhost , duthost_mgmt_ip )
2527 assert ret == 0 , (
2628 "GNMI capabilities command failed (non-zero return code).\n "
2729 "- Error message: {}"
@@ -38,7 +40,7 @@ def test_gnmi_capabilities(duthosts, rand_one_dut_hostname, localhost):
3840 ).format (msg )
3941
4042
41- def test_gnmi_capabilities_authenticate (duthosts , rand_one_dut_hostname , localhost ):
43+ def test_gnmi_capabilities_authenticate (duthosts , rand_one_dut_hostname , localhost , duthost_mgmt_ip ): # noqa: F811
4244 '''
4345 Verify GNMI capabilities with different roles
4446 '''
@@ -47,7 +49,7 @@ def test_gnmi_capabilities_authenticate(duthosts, rand_one_dut_hostname, localho
4749 with allure .step ("Verify GNMI capabilities with noaccess role" ):
4850 role = "gnmi_noaccess"
4951 add_gnmi_client_common_name (duthost , "test.client.gnmi.sonic" , role )
50- ret , msg = gnmi_capabilities (duthost , localhost )
52+ ret , msg = gnmi_capabilities (duthost , localhost , duthost_mgmt_ip )
5153 assert ret != 0 , (
5254 "GNMI capabilities authenticate with noaccess role command unexpectedly succeeded "
5355 "(zero return code) for a client with noaccess role.\n "
@@ -61,7 +63,7 @@ def test_gnmi_capabilities_authenticate(duthosts, rand_one_dut_hostname, localho
6163 with allure .step ("Verify GNMI capabilities with readonly role" ):
6264 role = "gnmi_readonly"
6365 add_gnmi_client_common_name (duthost , "test.client.gnmi.sonic" , role )
64- ret , msg = gnmi_capabilities (duthost , localhost )
66+ ret , msg = gnmi_capabilities (duthost , localhost , duthost_mgmt_ip )
6567 assert ret == 0 , (
6668 "GNMI capabilities authenticate readonly command failed (non-zero return code).\n "
6769 "- Error message: {}"
@@ -78,7 +80,7 @@ def test_gnmi_capabilities_authenticate(duthosts, rand_one_dut_hostname, localho
7880 with allure .step ("Verify GNMI capabilities with readwrite role" ):
7981 role = "gnmi_readwrite"
8082 add_gnmi_client_common_name (duthost , "test.client.gnmi.sonic" , role )
81- ret , msg = gnmi_capabilities (duthost , localhost )
83+ ret , msg = gnmi_capabilities (duthost , localhost , duthost_mgmt_ip )
8284 assert ret == 0 , (
8385 "GNMI capabilities authenticate readwrite role command failed (non-zero return code).\n "
8486 "- Error message: {}"
@@ -95,7 +97,7 @@ def test_gnmi_capabilities_authenticate(duthosts, rand_one_dut_hostname, localho
9597 with allure .step ("Verify GNMI capabilities with empty role" ):
9698 role = ""
9799 add_gnmi_client_common_name (duthost , "test.client.gnmi.sonic" , role )
98- ret , msg = gnmi_capabilities (duthost , localhost )
100+ ret , msg = gnmi_capabilities (duthost , localhost , duthost_mgmt_ip )
99101 assert ret == 0 , (
100102 "GNMI capabilities authenticate with empty role command failed (non-zero return code).\n "
101103 "- Error message: {}"
0 commit comments