Skip to content

Commit afad32a

Browse files
committed
SONiC Yang model support for Telemetry_client. (#12483)
1 parent a5d7157 commit afad32a

File tree

6 files changed

+303
-2
lines changed

6 files changed

+303
-2
lines changed

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

+28-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ Table of Contents
5353
* [Tacplus Server](#tacplus-server)
5454
* [TC to Priority group map](#tc-to-priority-group-map)
5555
* [TC to Queue map](#tc-to-queue-map)
56-
* [Telemetry](#telemetry)
57-
* [Tunnel](#tunnel)
56+
* [Telemetry](#telemetry)
57+
* [Telemetry_client](#telemetry_client)
58+
* [Tunnel](#tunnel)
5859
* [Versions](#versions)
5960
* [VLAN](#vlan)
6061
* [VLAN_MEMBER](#vlan_member)
@@ -1595,6 +1596,31 @@ Container side configuration:
15951596
}
15961597
```
15971598

1599+
### Telemetry_client
1600+
1601+
```
1602+
{
1603+
"TELEMETRY_CLIENT": {
1604+
"Global": {
1605+
"encoding": "JSON_IETF",
1606+
"retry_interval": "30",
1607+
"src_ip": "30.57.185.38",
1608+
"unidirectional": "true"
1609+
},
1610+
"DestinationGroup_HS": {
1611+
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
1612+
},
1613+
"Subscription_HS_RDMA": {
1614+
"dst_group": "HS",
1615+
"path_target": "COUNTERS_DB",
1616+
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
1617+
"report_interval": "5000",
1618+
"report_type": "periodic"
1619+
}
1620+
}
1621+
}
1622+
```
1623+
15981624
### Tunnel
15991625

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

src/sonic-yang-models/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def run(self):
146146
'./yang-models/sonic-system-aaa.yang',
147147
'./yang-models/sonic-system-tacacs.yang',
148148
'./yang-models/sonic-telemetry.yang',
149+
'./yang-models/sonic-telemetry_client.yang',
149150
'./yang-models/sonic-tunnel.yang',
150151
'./yang-models/sonic-types.yang',
151152
'./yang-models/sonic-versions.yang',

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

+18
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,24 @@
11531153
"port": "50051"
11541154
}
11551155
},
1156+
"TELEMETRY_CLIENT": {
1157+
"Global": {
1158+
"encoding": "JSON_IETF",
1159+
"retry_interval": "30",
1160+
"src_ip": "30.57.185.38",
1161+
"unidirectional": "true"
1162+
},
1163+
"DestinationGroup_HS": {
1164+
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
1165+
},
1166+
"Subscription_HS_RDMA": {
1167+
"dst_group": "HS",
1168+
"path_target": "COUNTERS_DB",
1169+
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
1170+
"report_interval": "5000",
1171+
"report_type": "periodic"
1172+
}
1173+
},
11561174
"TUNNEL": {
11571175
"MuxTunnel0": {
11581176
"dscp_mode": "uniform",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"PASSED": {
3+
"desc": "telemetry_client passed"
4+
},
5+
"INCORRECT_DST_GROUP": {
6+
"desc": "INCORRECT DST_GROUP FIELD IN TELEMETRY_CLIENT TABLE.",
7+
"eStrKey" : "Must"
8+
},
9+
"SRC_IP_INCORRECT_FORMAT": {
10+
"desc": "Add src ip which is not in correct ip-prefix format.",
11+
"eStrKey" : "InvalidValue",
12+
"eStr": ["src_ip"]
13+
},
14+
"ENCODING_WRONG_VALUE": {
15+
"desc": "Configure wrong value for encoding.",
16+
"eStrKey" : "InvalidValue",
17+
"eStr": ["encoding"]
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"PASSED": {
3+
"sonic-telemetry_client:sonic-telemetry_client": {
4+
"sonic-telemetry_client:TELEMETRY_CLIENT": {
5+
"Global": {
6+
"encoding": "JSON_IETF",
7+
"retry_interval": "30",
8+
"src_ip": "30.57.185.38",
9+
"unidirectional": "true"
10+
},
11+
"TELEMETRY_CLIENT_DS_LIST": [
12+
{
13+
"prefix": "DestinationGroup_HS",
14+
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
15+
}
16+
],
17+
"TELEMETRY_CLIENT_SUB_LIST": [
18+
{
19+
"prefix": "Subscription_HS_RDMA",
20+
"dst_group": "HS",
21+
"path_target": "COUNTERS_DB",
22+
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
23+
"report_interval": "5000",
24+
"report_type": "periodic"
25+
}
26+
]
27+
}
28+
}
29+
},
30+
"INCORRECT_DST_GROUP": {
31+
"sonic-telemetry_client:sonic-telemetry_client": {
32+
"sonic-telemetry_client:TELEMETRY_CLIENT": {
33+
"Global": {
34+
"encoding": "JSON_IETF",
35+
"retry_interval": "30",
36+
"src_ip": "30.57.185.38",
37+
"unidirectional": "true"
38+
},
39+
"TELEMETRY_CLIENT_DS_LIST": [
40+
{
41+
"prefix": "DestinationGroup_HS",
42+
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
43+
}
44+
],
45+
"TELEMETRY_CLIENT_SUB_LIST": [
46+
{
47+
"prefix": "Subscription_HS_RDMA",
48+
"dst_group": "FS",
49+
"path_target": "COUNTERS_DB",
50+
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
51+
"report_interval": "5000",
52+
"report_type": "periodic"
53+
}
54+
]
55+
}
56+
}
57+
},
58+
"SRC_IP_INCORRECT_FORMAT": {
59+
"sonic-telemetry_client:sonic-telemetry_client": {
60+
"sonic-telemetry_client:TELEMETRY_CLIENT": {
61+
"Global": {
62+
"encoding": "JSON_IETF",
63+
"retry_interval": "30",
64+
"src_ip": "30.57.185.388",
65+
"unidirectional": "true"
66+
},
67+
"TELEMETRY_CLIENT_DS_LIST": [
68+
{
69+
"prefix": "DestinationGroup_HS",
70+
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
71+
}
72+
],
73+
"TELEMETRY_CLIENT_SUB_LIST": [
74+
{
75+
"prefix": "Subscription_HS_RDMA",
76+
"dst_group": "HS",
77+
"path_target": "COUNTERS_DB",
78+
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
79+
"report_interval": "5000",
80+
"report_type": "periodic"
81+
}
82+
]
83+
}
84+
}
85+
},
86+
"ENCODING_WRONG_VALUE": {
87+
"sonic-telemetry_client:sonic-telemetry_client": {
88+
"sonic-telemetry_client:TELEMETRY_CLIENT": {
89+
"Global": {
90+
"encoding": "Unicode",
91+
"retry_interval": "30",
92+
"src_ip": "30.57.185.38",
93+
"unidirectional": "true"
94+
},
95+
"TELEMETRY_CLIENT_DS_LIST": [
96+
{
97+
"prefix": "DestinationGroup_HS",
98+
"dst_addr": "30.57.186.214:8081,30.57.185.39:8081"
99+
}
100+
],
101+
"TELEMETRY_CLIENT_SUB_LIST": [
102+
{
103+
"prefix": "Subscription_HS_RDMA",
104+
"dst_group": "HS",
105+
"path_target": "COUNTERS_DB",
106+
"paths": "COUNTERS/Ethernet*,COUNTERS_PORT_NAME_MAP",
107+
"report_interval": "5000",
108+
"report_type": "periodic"
109+
}
110+
]
111+
}
112+
}
113+
}
114+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
module sonic-telemetry_client {
2+
3+
yang-version 1.1;
4+
5+
namespace "http://github.com/Azure/sonic-telemetry_client";
6+
prefix telemetry_client;
7+
8+
import ietf-inet-types {
9+
prefix inet;
10+
}
11+
import sonic-types {
12+
prefix stypes;
13+
}
14+
description
15+
"TELEMETRY_CLIENT yang Module for SONiC OS";
16+
17+
revision 2021-11-30 {
18+
description
19+
"First revision";
20+
}
21+
22+
typedef report-type {
23+
type enumeration {
24+
enum periodic;
25+
enum stream;
26+
enum once;
27+
}
28+
}
29+
typedef path_target {
30+
type enumeration {
31+
enum APPL_DB;
32+
enum CONFIG_DB;
33+
enum COUNTERS_DB;
34+
enum STATE_DB;
35+
enum SYSMON_DB;
36+
enum OTHERS;
37+
}
38+
}
39+
40+
typedef encoding {
41+
type enumeration {
42+
enum JSON_IETF;
43+
enum ASCII;
44+
enum BYTES;
45+
enum PROTO;
46+
}
47+
}
48+
49+
50+
container sonic-telemetry_client{
51+
52+
container TELEMETRY_CLIENT {
53+
container Global {
54+
leaf retry_interval {
55+
type int32;
56+
description "retry_interval unit ms";
57+
}
58+
59+
leaf src_ip {
60+
type inet:ip-address;
61+
}
62+
63+
leaf encoding {
64+
type encoding;
65+
}
66+
67+
leaf unidirectional {
68+
type boolean;
69+
default true;
70+
}
71+
}
72+
73+
list TELEMETRY_CLIENT_DS_LIST {
74+
ordered-by user;
75+
key "prefix";
76+
77+
leaf prefix {
78+
type string {
79+
pattern "DestinationGroup_" + ".*";
80+
}
81+
}
82+
83+
leaf dst_addr {
84+
type string;
85+
}
86+
}
87+
88+
list TELEMETRY_CLIENT_SUB_LIST {
89+
ordered-by user;
90+
key "prefix";
91+
92+
leaf prefix {
93+
type string {
94+
pattern "Subscription_" + ".*";
95+
}
96+
}
97+
98+
leaf dst_group {
99+
must "(contains(../../TELEMETRY_CLIENT_DS_LIST/prefix, current())";
100+
type string;
101+
}
102+
103+
leaf path_target {
104+
type path_target;
105+
}
106+
107+
leaf paths {
108+
type string;
109+
}
110+
111+
leaf report_interval {
112+
type int32;
113+
description "report_interval unit ms";
114+
}
115+
116+
leaf report_type {
117+
type report-type;
118+
}
119+
}
120+
}
121+
}
122+
}
123+

0 commit comments

Comments
 (0)