From c498f7df5ede6d5d252980320477176972f373b1 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Thu, 12 Oct 2023 05:38:04 +0000 Subject: [PATCH 1/4] Update TELEMETRY_CLIENT YANG model --- .../yang-models/sonic-telemetry_client.yang | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang b/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang index 7b6b231031c5..a743b7a60a61 100644 --- a/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang +++ b/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang @@ -86,33 +86,22 @@ module sonic-telemetry_client { } } - list TELEMETRY_CLIENT_DS_LIST { + list TELEMETRY_CLIENT_LIST { ordered-by user; key "prefix"; leaf prefix { type string { - pattern "DestinationGroup_" + ".*"; + pattern 'Subscription_|DestinationGroup_' + '.*'; } } leaf dst_addr { type ipv4-port; } - } - - list TELEMETRY_CLIENT_SUB_LIST { - ordered-by user; - key "prefix"; - - leaf prefix { - type string { - pattern "Subscription_" + ".*"; - } - } leaf dst_group { - must "(contains(../../TELEMETRY_CLIENT_DS_LIST/prefix, current()))"; + must "(contains(../../TELEMETRY_CLIENT_LIST/prefix, current()))"; type string; } From f170874a11bfc18dd3e50c4240714a873d5310cf Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Thu, 12 Oct 2023 07:10:35 +0000 Subject: [PATCH 2/4] update test --- .../tests_config/telemetry_client.json | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json index 5286bcba8b93..1619179802fa 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json @@ -8,13 +8,13 @@ "src_ip": "30.57.185.38", "unidirectional": "true" }, - "TELEMETRY_CLIENT_DS_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" } ], - "TELEMETRY_CLIENT_SUB_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", @@ -36,13 +36,13 @@ "src_ip": "30.57.185.38", "unidirectional": "true" }, - "TELEMETRY_CLIENT_DS_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" } ], - "TELEMETRY_CLIENT_SUB_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "Subscription_HS_RDMA", "dst_group": "FS", @@ -64,13 +64,13 @@ "src_ip": "30.57.185.388", "unidirectional": "true" }, - "TELEMETRY_CLIENT_DS_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" } ], - "TELEMETRY_CLIENT_SUB_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", @@ -92,13 +92,13 @@ "src_ip": "30.57.185.38", "unidirectional": "true" }, - "TELEMETRY_CLIENT_DS_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" } ], - "TELEMETRY_CLIENT_SUB_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", @@ -120,13 +120,13 @@ "src_ip": "30.57.185.38", "unidirectional": "true" }, - "TELEMETRY_CLIENT_DS_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:80819,30.57.185.39:8081" } ], - "TELEMETRY_CLIENT_SUB_LIST": [ + "TELEMETRY_CLIENT_LIST": [ { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", From b873d4e47a2f6e784773b72a0e4181a91cf9f54d Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Thu, 12 Oct 2023 12:07:53 +0000 Subject: [PATCH 3/4] unit test --- .../tests_config/telemetry_client.json | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json index 1619179802fa..61b0185b1607 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json @@ -12,9 +12,7 @@ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" - } - ], - "TELEMETRY_CLIENT_LIST": [ + }, { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", @@ -40,9 +38,7 @@ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" - } - ], - "TELEMETRY_CLIENT_LIST": [ + }, { "prefix": "Subscription_HS_RDMA", "dst_group": "FS", @@ -68,9 +64,7 @@ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" - } - ], - "TELEMETRY_CLIENT_LIST": [ + }, { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", @@ -96,9 +90,7 @@ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" - } - ], - "TELEMETRY_CLIENT_LIST": [ + }, { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", @@ -124,9 +116,7 @@ { "prefix": "DestinationGroup_HS", "dst_addr": "30.57.186.214:80819,30.57.185.39:8081" - } - ], - "TELEMETRY_CLIENT_LIST": [ + }, { "prefix": "Subscription_HS_RDMA", "dst_group": "HS", @@ -139,4 +129,4 @@ } } } -} \ No newline at end of file +} From ba349326cb6da4d2679fc5e8ebfc847a2719f341 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Mon, 23 Oct 2023 09:59:34 +0000 Subject: [PATCH 4/4] modify config sample as comment --- src/sonic-yang-models/doc/Configuration.md | 26 ++++++++++++++++ .../tests/files/sample_config_db.json | 4 +-- .../tests_config/telemetry_client.json | 30 ++++++++++++------- .../yang-models/sonic-telemetry_client.yang | 10 +++++-- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index b42b3672c7b7..80c00e8142d3 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -70,6 +70,7 @@ Table of Contents * [TC to Priority group map](#tc-to-priority-group-map) * [TC to Queue map](#tc-to-queue-map) * [Telemetry](#telemetry) + * [Telemetry client](#telemetry-client) * [Tunnel](#tunnel) * [Versions](#versions) * [VLAN](#vlan) @@ -2099,6 +2100,31 @@ and is listed in this table. } ``` +### Telemetry client + +``` +{ + "TELEMETRY_CLIENT": { + "Global": { + "encoding": "JSON_IETF", + "retry_interval": "30", + "src_ip": "30.57.185.38", + "unidirectional": "true" + }, + "DestinationGroup|HS": { + "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" + }, + "Subscription|HS_RDMA": { + "dst_group": "HS", + "path_target": "COUNTERS_DB", + "paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP", + "report_interval": "5000", + "report_type": "periodic" + } + } +} +``` + ### Tunnel This table configures the MUX tunnel for Dual-ToR setup 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 0d2827ae48ae..ecb8ff253b43 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1211,10 +1211,10 @@ "src_ip": "30.57.185.38", "unidirectional": "true" }, - "DestinationGroup_HS": { + "DestinationGroup|HS": { "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" }, - "Subscription_HS_RDMA": { + "Subscription|HS_RDMA": { "dst_group": "HS", "path_target": "COUNTERS_DB", "paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json index 61b0185b1607..91de532c8c95 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json @@ -10,11 +10,13 @@ }, "TELEMETRY_CLIENT_LIST": [ { - "prefix": "DestinationGroup_HS", + "prefix": "DestinationGroup", + "name": "HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" }, { - "prefix": "Subscription_HS_RDMA", + "prefix": "Subscription", + "name": "HS_RDMA", "dst_group": "HS", "path_target": "COUNTERS_DB", "paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP", @@ -36,11 +38,13 @@ }, "TELEMETRY_CLIENT_LIST": [ { - "prefix": "DestinationGroup_HS", + "prefix": "DestinationGroup", + "name": "HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" }, { - "prefix": "Subscription_HS_RDMA", + "prefix": "Subscription", + "name": "HS_RDMA", "dst_group": "FS", "path_target": "COUNTERS_DB", "paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP", @@ -62,11 +66,13 @@ }, "TELEMETRY_CLIENT_LIST": [ { - "prefix": "DestinationGroup_HS", + "prefix": "DestinationGroup", + "name": "HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" }, { - "prefix": "Subscription_HS_RDMA", + "prefix": "Subscription", + "name": "HS_RDMA", "dst_group": "HS", "path_target": "COUNTERS_DB", "paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP", @@ -88,11 +94,13 @@ }, "TELEMETRY_CLIENT_LIST": [ { - "prefix": "DestinationGroup_HS", + "prefix": "DestinationGroup", + "name": "HS", "dst_addr": "30.57.186.214:8081,30.57.185.39:8081" }, { - "prefix": "Subscription_HS_RDMA", + "prefix": "Subscription", + "name": "HS_RDMA", "dst_group": "HS", "path_target": "COUNTERS_DB", "paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP", @@ -114,11 +122,13 @@ }, "TELEMETRY_CLIENT_LIST": [ { - "prefix": "DestinationGroup_HS", + "prefix": "DestinationGroup", + "name": "HS", "dst_addr": "30.57.186.214:80819,30.57.185.39:8081" }, { - "prefix": "Subscription_HS_RDMA", + "prefix": "Subscription", + "name": "HS_RDMA", "dst_group": "HS", "path_target": "COUNTERS_DB", "paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP", diff --git a/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang b/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang index a743b7a60a61..7c4b7b37b8e6 100644 --- a/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang +++ b/src/sonic-yang-models/yang-models/sonic-telemetry_client.yang @@ -88,20 +88,24 @@ module sonic-telemetry_client { list TELEMETRY_CLIENT_LIST { ordered-by user; - key "prefix"; + key "prefix name"; leaf prefix { type string { - pattern 'Subscription_|DestinationGroup_' + '.*'; + pattern 'Subscription|DestinationGroup'; } } + leaf name { + type string; + } + leaf dst_addr { type ipv4-port; } leaf dst_group { - must "(contains(../../TELEMETRY_CLIENT_LIST/prefix, current()))"; + must "(contains(../../TELEMETRY_CLIENT_LIST/name, current()))"; type string; }