-
Notifications
You must be signed in to change notification settings - Fork 732
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gnmi] add test to use gnmi certificate after 2038 year problem
Signed-off-by: AntonHryshchuk <[email protected]>
- Loading branch information
1 parent
1aa4c0e
commit 30888d2
Showing
3 changed files
with
175 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
import logging | ||
|
||
from .helper import gnmi_capabilities, prepare_root_cert, prepare_server_cert, prepare_client_cert, \ | ||
copy_certificate_to_dut, copy_certificate_to_ptf, apply_cert_config, cert_date_on_dut | ||
|
||
logger = logging.getLogger(__name__) | ||
SETUP_ENV_CP = "test_setup_checkpoint" | ||
|
||
pytestmark = [ | ||
pytest.mark.topology('any'), | ||
pytest.mark.disable_loganalyzer | ||
] | ||
|
||
|
||
def test_gnmi_capabilities(duthosts, rand_one_dut_hostname, localhost, ptfhost): | ||
''' | ||
Verify certificate after 2038 year problem | ||
''' | ||
duthost = duthosts[rand_one_dut_hostname] | ||
|
||
prepare_root_cert(localhost, days="4850") | ||
prepare_server_cert(duthost, localhost, days="4810") | ||
prepare_client_cert(localhost, days="4810") | ||
|
||
copy_certificate_to_dut(duthost) | ||
copy_certificate_to_ptf(ptfhost) | ||
|
||
apply_cert_config(duthost) | ||
|
||
# Verify certificate date on DUT | ||
cert_date_on_dut(duthost) | ||
|
||
# Verify GNMI capabilities to validate functionality | ||
ret, msg = gnmi_capabilities(duthost, localhost) | ||
assert ret == 0, msg | ||
assert "sonic-db" in msg, msg | ||
assert "JSON_IETF" in msg, msg |