Skip to content

Commit be7321d

Browse files
wen587mssonicbld
authored andcommitted
Update TELEMETRY_CLIENT YANG model (sonic-net#16861)
### Why I did it Github issue: sonic-net#16356. The YANG definition breaks GCU feature. We can either update sonic_yang and GCU's search algorithm to enable the same key count case or simply update YANG model to solve the issue. The pros for update YANG model are it could solve the issue directly and we don't need to handle the complicate search algorithm in sonic_yang and GCU. This is the only YANG model that has this issue. ### How I did it Combine two list into one. The previous YANG validation unit tests are still applicable. #### How to verify it Unit test and E2E test
1 parent b72a740 commit be7321d

File tree

4 files changed

+67
-48
lines changed

4 files changed

+67
-48
lines changed

src/sonic-yang-models/doc/Configuration.md

+26
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Table of Contents
6969
* [TC to Priority group map](#tc-to-priority-group-map)
7070
* [TC to Queue map](#tc-to-queue-map)
7171
* [Telemetry](#telemetry)
72+
* [Telemetry client](#telemetry-client)
7273
* [Tunnel](#tunnel)
7374
* [Versions](#versions)
7475
* [VLAN](#vlan)
@@ -2048,6 +2049,31 @@ and is listed in this table.
20482049
}
20492050
```
20502051

2052+
### Telemetry client
2053+
2054+
```
2055+
{
2056+
"TELEMETRY_CLIENT": {
2057+
"Global": {
2058+
"encoding": "JSON_IETF",
2059+
"retry_interval": "30",
2060+
"src_ip": "30.57.185.38",
2061+
"unidirectional": "true"
2062+
},
2063+
"DestinationGroup|HS": {
2064+
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
2065+
},
2066+
"Subscription|HS_RDMA": {
2067+
"dst_group": "HS",
2068+
"path_target": "COUNTERS_DB",
2069+
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
2070+
"report_interval": "5000",
2071+
"report_type": "periodic"
2072+
}
2073+
}
2074+
}
2075+
```
2076+
20512077
### Tunnel
20522078

20532079
This table configures the MUX tunnel for Dual-ToR setup

src/sonic-yang-models/tests/files/sample_config_db.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1211,10 +1211,10 @@
12111211
"src_ip": "30.57.185.38",
12121212
"unidirectional": "true"
12131213
},
1214-
"DestinationGroup_HS": {
1214+
"DestinationGroup|HS": {
12151215
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
12161216
},
1217-
"Subscription_HS_RDMA": {
1217+
"Subscription|HS_RDMA": {
12181218
"dst_group": "HS",
12191219
"path_target": "COUNTERS_DB",
12201220
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",

src/sonic-yang-models/tests/yang_model_tests/tests_config/telemetry_client.json

+31-31
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"src_ip": "30.57.185.38",
99
"unidirectional": "true"
1010
},
11-
"TELEMETRY_CLIENT_DS_LIST": [
11+
"TELEMETRY_CLIENT_LIST": [
1212
{
13-
"prefix": "DestinationGroup_HS",
13+
"prefix": "DestinationGroup",
14+
"name": "HS",
1415
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
15-
}
16-
],
17-
"TELEMETRY_CLIENT_SUB_LIST": [
16+
},
1817
{
19-
"prefix": "Subscription_HS_RDMA",
18+
"prefix": "Subscription",
19+
"name": "HS_RDMA",
2020
"dst_group": "HS",
2121
"path_target": "COUNTERS_DB",
2222
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
@@ -36,15 +36,15 @@
3636
"src_ip": "30.57.185.38",
3737
"unidirectional": "true"
3838
},
39-
"TELEMETRY_CLIENT_DS_LIST": [
39+
"TELEMETRY_CLIENT_LIST": [
4040
{
41-
"prefix": "DestinationGroup_HS",
41+
"prefix": "DestinationGroup",
42+
"name": "HS",
4243
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
43-
}
44-
],
45-
"TELEMETRY_CLIENT_SUB_LIST": [
44+
},
4645
{
47-
"prefix": "Subscription_HS_RDMA",
46+
"prefix": "Subscription",
47+
"name": "HS_RDMA",
4848
"dst_group": "FS",
4949
"path_target": "COUNTERS_DB",
5050
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
@@ -64,15 +64,15 @@
6464
"src_ip": "30.57.185.388",
6565
"unidirectional": "true"
6666
},
67-
"TELEMETRY_CLIENT_DS_LIST": [
67+
"TELEMETRY_CLIENT_LIST": [
6868
{
69-
"prefix": "DestinationGroup_HS",
69+
"prefix": "DestinationGroup",
70+
"name": "HS",
7071
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
71-
}
72-
],
73-
"TELEMETRY_CLIENT_SUB_LIST": [
72+
},
7473
{
75-
"prefix": "Subscription_HS_RDMA",
74+
"prefix": "Subscription",
75+
"name": "HS_RDMA",
7676
"dst_group": "HS",
7777
"path_target": "COUNTERS_DB",
7878
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
@@ -92,15 +92,15 @@
9292
"src_ip": "30.57.185.38",
9393
"unidirectional": "true"
9494
},
95-
"TELEMETRY_CLIENT_DS_LIST": [
95+
"TELEMETRY_CLIENT_LIST": [
9696
{
97-
"prefix": "DestinationGroup_HS",
97+
"prefix": "DestinationGroup",
98+
"name": "HS",
9899
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
99-
}
100-
],
101-
"TELEMETRY_CLIENT_SUB_LIST": [
100+
},
102101
{
103-
"prefix": "Subscription_HS_RDMA",
102+
"prefix": "Subscription",
103+
"name": "HS_RDMA",
104104
"dst_group": "HS",
105105
"path_target": "COUNTERS_DB",
106106
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
@@ -120,15 +120,15 @@
120120
"src_ip": "30.57.185.38",
121121
"unidirectional": "true"
122122
},
123-
"TELEMETRY_CLIENT_DS_LIST": [
123+
"TELEMETRY_CLIENT_LIST": [
124124
{
125-
"prefix": "DestinationGroup_HS",
125+
"prefix": "DestinationGroup",
126+
"name": "HS",
126127
"dst_addr": "30.57.186.214:80819,30.57.185.39:8081"
127-
}
128-
],
129-
"TELEMETRY_CLIENT_SUB_LIST": [
128+
},
130129
{
131-
"prefix": "Subscription_HS_RDMA",
130+
"prefix": "Subscription",
131+
"name": "HS_RDMA",
132132
"dst_group": "HS",
133133
"path_target": "COUNTERS_DB",
134134
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
@@ -139,4 +139,4 @@
139139
}
140140
}
141141
}
142-
}
142+
}

src/sonic-yang-models/yang-models/sonic-telemetry_client.yang

+8-15
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,26 @@ module sonic-telemetry_client {
8686
}
8787
}
8888

89-
list TELEMETRY_CLIENT_DS_LIST {
89+
list TELEMETRY_CLIENT_LIST {
9090
ordered-by user;
91-
key "prefix";
91+
key "prefix name";
9292

9393
leaf prefix {
9494
type string {
95-
pattern "DestinationGroup_" + ".*";
95+
pattern 'Subscription|DestinationGroup';
9696
}
9797
}
9898

99-
leaf dst_addr {
100-
type ipv4-port;
99+
leaf name {
100+
type string;
101101
}
102-
}
103-
104-
list TELEMETRY_CLIENT_SUB_LIST {
105-
ordered-by user;
106-
key "prefix";
107102

108-
leaf prefix {
109-
type string {
110-
pattern "Subscription_" + ".*";
111-
}
103+
leaf dst_addr {
104+
type ipv4-port;
112105
}
113106

114107
leaf dst_group {
115-
must "(contains(../../TELEMETRY_CLIENT_DS_LIST/prefix, current()))";
108+
must "(contains(../../TELEMETRY_CLIENT_LIST/name, current()))";
116109
type string;
117110
}
118111

0 commit comments

Comments
 (0)