From 538e4c0a97864b9b812c5388fc08fb3c14103ed3 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 27 Oct 2022 14:18:37 -0700 Subject: [PATCH] [Restapi Yang] Fix issue with multiple certs (#12495) *[Restapi Yang] Fix issue with multiple certs (#12495) --- .../tests/yang_model_tests/tests/restapi.json | 3 +++ .../tests/yang_model_tests/tests_config/restapi.json | 12 ++++++++++++ src/sonic-yang-models/yang-models/sonic-restapi.yang | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json b/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json index e18d6e163ce4..42ce64ba330f 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/restapi.json @@ -9,5 +9,8 @@ }, "RESTAPI_TABLE_WITH_VALID_CONFIG": { "desc": "RESTAPI TABLE WITH VALID CONFIG." + }, + "RESTAPI_TABLE_WITH_MULTIPLE_CERTS": { + "desc": "RESTAPI TABLE WITH MULTIPLE CERTS." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json index 8ae212ed7026..f2a3b15643c6 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/restapi.json @@ -34,5 +34,17 @@ } } } + }, + "RESTAPI_TABLE_WITH_MULTIPLE_CERTS": { + "sonic-restapi:sonic-restapi": { + "sonic-restapi:RESTAPI": { + "certs": { + "ca_crt": "/etc/sonic/credentials/ame_root.pem", + "server_crt": "/etc/sonic/credentials/restapiserver.crt", + "server_key": "/etc/sonic/credentials/restapiserver.key", + "client_crt_cname": "client.sonic.net,clientds.prod.net" + } + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-restapi.yang b/src/sonic-yang-models/yang-models/sonic-restapi.yang index e049e2fa5c23..af509f2335d8 100644 --- a/src/sonic-yang-models/yang-models/sonic-restapi.yang +++ b/src/sonic-yang-models/yang-models/sonic-restapi.yang @@ -45,7 +45,7 @@ module sonic-restapi { leaf client_crt_cname { type string { - pattern '([a-zA-Z0-9_\-\.]+)'; + pattern '([a-zA-Z0-9_\-\.]+,)*([a-zA-Z0-9_\-\.]+)'; } description "Client cert name."; }