From 8d016e755972ea16d400163ee56b8ab17abb776c Mon Sep 17 00:00:00 2001 From: vdahiya12 <67608553+vdahiya12@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:39:23 -0800 Subject: [PATCH] [yang] add Yang model for GRPCCLIENT (#20902) Why I did it Adding yang model for CONFIG_DB table GRPCCLIENT Introduced by https://github.com/sonic-net/sonic-platform-daemons/blob/b276e415d85f3e8a7c64532d95821c9000c9418d/sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py#L407 --- src/sonic-yang-models/doc/Configuration.md | 1 + src/sonic-yang-models/setup.py | 1 + .../tests/files/sample_config_db.json | 13 +++ .../yang_model_tests/tests/grpcclient.json | 5 ++ .../tests_config/grpcclient.json | 12 +++ .../yang-models/sonic-grpcclient.yang | 79 +++++++++++++++++++ 6 files changed, 111 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/grpcclient.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/grpcclient.json create mode 100644 src/sonic-yang-models/yang-models/sonic-grpcclient.yang diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 02108310f4f0..1f45b32a3e83 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -42,6 +42,7 @@ Table of Contents * [FABRIC_MONITOR](#fabric-monitor) * [FABRIC_PORT](#fabric-port) * [FLEX_COUNTER_TABLE](#flex_counter_table) + * [GRPCCLIENT](#grpcclient) * [Hash](#hash) * [IPv6 Link-local] (#ipv6-link-local) * [KDUMP](#kdump) diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 5e130854eeba..04b652208ec7 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -204,6 +204,7 @@ def run(self): './yang-models/sonic-bgp-sentinel.yang', './yang-models/sonic-bmp.yang', './yang-models/sonic-xcvrd-log.yang', + './yang-models/sonic-grpcclient.yang', './yang-models/sonic-serial-console.yang', './yang-models/sonic-smart-switch.yang',]), ('cvlyang-models', ['./cvlyang-models/sonic-acl.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 7298cdec9c22..5d22bc3f81cc 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -2762,6 +2762,19 @@ "log_verbosity": "notice" } }, + "GRPCCLIENT": { + "config": { + "type": "secure", + "auth_level": "server", + "log_level": "info" + }, + "certs": { + "client_crt": "grpcclient.crt", + "client_key": "grpcclient.key", + "ca_crt": "root.pem", + "grpc_ssl_credential": "azureclient.ms" + } + }, "BANNER_MESSAGE": { "global": { "state": "enabled", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/grpcclient.json b/src/sonic-yang-models/tests/yang_model_tests/tests/grpcclient.json new file mode 100644 index 000000000000..fd1a3a2ccd3a --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/grpcclient.json @@ -0,0 +1,5 @@ +{ + "GRPCCLIENT_CONFIG_CHANGE_VERBOSITY_LEVEL": { + "desc": "Consume verbosity level config changes. " + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/grpcclient.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/grpcclient.json new file mode 100644 index 000000000000..79d92d1212aa --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/grpcclient.json @@ -0,0 +1,12 @@ +{ + "GRPCCLIENT_CONFIG_CHANGE_VERBOSITY_LEVEL": { + "sonic-grpcclient:sonic-grpcclient": { + "sonic-grpcclient:GRPCCLIENT": { + "sonic-grpcclient:config": + { + "log_level": "info" + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-grpcclient.yang b/src/sonic-yang-models/yang-models/sonic-grpcclient.yang new file mode 100644 index 000000000000..69d7b83d2672 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-grpcclient.yang @@ -0,0 +1,79 @@ +module sonic-grpcclient { + namespace "http://github.com/sonic-net/sonic-grpcclient"; + prefix grpcclient; + yang-version 1.1; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONiC DualToR grpc client configuration data"; + + revision 2024-10-14 { + description + "Initial revision"; + } + + container sonic-grpcclient { + + container GRPCCLIENT { + + container config { + + leaf type { + type enumeration { + enum secure; + enum insecure; + } + description "grpc client security level. "; + } + + leaf auth_level { + type enumeration { + enum server; + enum client; + } + description "grpc client auth level. "; + } + + leaf log_level { + type enumeration { + enum info; + enum notice; + enum debug; + enum warning; + enum critical; + } + description "grpc client log level. "; + } + } + + container certs { + + leaf client_crt { + type string; + description "grpc client certificate file name "; + + } + + leaf client_key { + type string; + description "grpc client key file name "; + } + + leaf ca_crt { + type string; + description "grpc client root cert"; + } + + leaf grpc_ssl_credential { + type string; + description "grpc client ssl credential"; + } + } + } + } +}