Skip to content

Commit ecb1cb9

Browse files
authored
Merge pull request #328 from arlakshm/arlakshm/202205/port_yang
[202205] Port the yang-models for sonic-console.yang and sonic-restapi.yang
2 parents c97be17 + f3fb253 commit ecb1cb9

File tree

9 files changed

+431
-1
lines changed

9 files changed

+431
-1
lines changed

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

+45-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Table of Contents
2020
* [Cable length](#cable-length)
2121
* [Chassis module](#chassis-module)
2222
* [COPP_TABLE](#copp_table)
23+
* [Console](#console)
2324
* [CRM](#crm)
2425
* [Data Plane L3 Interfaces](#data-plane-l3-interfaces)
2526
* [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER)
@@ -51,7 +52,8 @@ Table of Contents
5152
* [Scheduler](#scheduler)
5253
* [Port QoS Map](#port-qos-map)
5354
* [Queue](#queue)
54-
* [Sflow](#sflow)
55+
* [Sflow](#sflow)
56+
* [Restapi](#restapi)
5557
* [Tacplus Server](#tacplus-server)
5658
* [TC to Priority group map](#tc-to-priority-group-map)
5759
* [TC to Queue map](#tc-to-queue-map)
@@ -714,6 +716,29 @@ It currently allows user to administratively bring down a line-card or fabric-ca
714716
}
715717
```
716718

719+
### Console
720+
721+
```
722+
{
723+
"CONSOLE_PORT": {
724+
"1": {
725+
"baud_rate": "115200",
726+
"flow_control": "0",
727+
"remote_device": "host-1"
728+
},
729+
"2": {
730+
"baud_rate": "9600",
731+
"flow_control": "1"
732+
}
733+
},
734+
"CONSOLE_SWITCH": {
735+
"console_mgmt": {
736+
"enabled": "yes"
737+
}
738+
}
739+
}
740+
```
741+
717742
### CRM
718743

719744
```
@@ -1509,6 +1534,25 @@ name as object key and member list as attribute.
15091534
}
15101535
```
15111536

1537+
### Restapi
1538+
```
1539+
{
1540+
"RESTAPI": {
1541+
"certs": {
1542+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
1543+
"server_key": "/etc/sonic/credentials/restapiserver.key",
1544+
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
1545+
"client_crt_cname": "client.sonic.net"
1546+
},
1547+
"config": {
1548+
"client_auth": "true",
1549+
"log_level": "trace",
1550+
"allow_insecure": "false"
1551+
}
1552+
}
1553+
1554+
```
1555+
15121556
### Sflow
15131557

15141558
The below are the tables and their schema for SFLOW feature

src/sonic-yang-models/setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def run(self):
9999
'./yang-models/sonic-cable-length.yang',
100100
'./yang-models/sonic-chassis-module.yang',
101101
'./yang-models/sonic-copp.yang',
102+
'./yang-models/sonic-console.yang',
102103
'./yang-models/sonic-crm.yang',
103104
'./yang-models/sonic-default-lossless-buffer-parameter.yang',
104105
'./yang-models/sonic-device_metadata.yang',
@@ -130,6 +131,7 @@ def run(self):
130131
'./yang-models/sonic-policer.yang',
131132
'./yang-models/sonic-portchannel.yang',
132133
'./yang-models/sonic-pfcwd.yang',
134+
'./yang-models/sonic-restapi.yang',
133135
'./yang-models/sonic-route-common.yang',
134136
'./yang-models/sonic-route-map.yang',
135137
'./yang-models/sonic-routing-policy-sets.yang',

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

+29
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,19 @@
11221122
"lanes": "1"
11231123
}
11241124
},
1125+
"RESTAPI": {
1126+
"certs": {
1127+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
1128+
"server_key": "/etc/sonic/credentials/restapiserver.key",
1129+
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
1130+
"client_crt_cname": "client.sonic.net"
1131+
},
1132+
"config": {
1133+
"client_auth": "true",
1134+
"log_level": "trace",
1135+
"allow_insecure": "false"
1136+
}
1137+
},
11251138
"FLEX_COUNTER_TABLE": {
11261139
"PFCWD": {
11271140
"FLEX_COUNTER_STATUS": "enable"
@@ -2036,6 +2049,22 @@
20362049
"default_dynamic_th": "0",
20372050
"over_subscribe_ratio": "0"
20382051
}
2052+
},
2053+
"CONSOLE_PORT": {
2054+
"1": {
2055+
"baud_rate": "115200",
2056+
"flow_control": "0",
2057+
"remote_device": "host-1"
2058+
},
2059+
"2": {
2060+
"baud_rate": "9600",
2061+
"flow_control": "1"
2062+
}
2063+
},
2064+
"CONSOLE_SWITCH": {
2065+
"console_mgmt": {
2066+
"enabled": "yes"
2067+
}
20392068
}
20402069
},
20412070
"SAMPLE_CONFIG_DB_UNKNOWN": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"CONSOLE_DISABLED": {
3+
"desc": "Verifying CONSOLE_SWITCH configuration."
4+
},
5+
"CONSOLE_DEFAULT_CONSOLE_MGMT": {
6+
"desc": "CONSOLE_SWITCH default value for console_mgmt enabled field.",
7+
"eStrKey": "Verify",
8+
"verify": {
9+
"xpath": "/sonic-console:sonic-console/CONSOLE_SWITCH/console_mgmt/enabled",
10+
"key": "sonic-console:enabled",
11+
"value": "no"
12+
}
13+
},
14+
"CONSOLE_DISABLED_INCORRECT_PATTERN": {
15+
"desc": "CONSOLE_SWITCH configuration pattern failure.",
16+
"eStrKey": "Pattern"
17+
},
18+
"CONSOLE_PORT_DEFAULT_FLOW_CONTROL": {
19+
"desc": "CONSOLE_PORT default value for flow_control field.",
20+
"eStrKey": "Verify",
21+
"verify": {
22+
"xpath": "/sonic-console:sonic-console/CONSOLE_PORT/CONSOLE_PORT_LIST[name='1']/flow_control",
23+
"key": "sonic-console:flow_control",
24+
"value": "0"
25+
}
26+
},
27+
"CONSOLE_PORT_INVALID_NAME": {
28+
"desc": "CONSOLE_PORT invalid name failure.",
29+
"eStrKey": "InvalidValue",
30+
"eStr": ["name"]
31+
},
32+
"CONSOLE_PORT_INVALID_BAUD": {
33+
"desc": "CONSOLE_PORT invalid baud failure.",
34+
"eStrKey": "InvalidValue",
35+
"eStr": ["baud"]
36+
},
37+
"CONSOLE_PORT_VALID": {
38+
"desc": "Verifying CONSOLE_PORT configuration no failure."
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"RESTAPI_TABLE_WITH_INCORRECT_CERT": {
3+
"desc": "RESTAPI TABLE_WITH_INCORRECT_CERT failure.",
4+
"eStr": ["Value", "does not satisfy the constraint"]
5+
},
6+
"RESTAPI_TABLE_WITH_INCORRECT_CLIENT": {
7+
"desc": "RESTAPI TABLE_WITH_INCORRECT_CLIENT failure.",
8+
"eStr": ["Value", "does not satisfy the constraint"]
9+
},
10+
"RESTAPI_TABLE_WITH_VALID_CONFIG": {
11+
"desc": "RESTAPI TABLE WITH VALID CONFIG."
12+
},
13+
"RESTAPI_TABLE_WITH_MULTIPLE_CERTS": {
14+
"desc": "RESTAPI TABLE WITH MULTIPLE CERTS."
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"CONSOLE_DISABLED": {
3+
"sonic-console:sonic-console": {
4+
"sonic-console:CONSOLE_SWITCH": {
5+
"sonic-console:console_mgmt": {
6+
"enabled": "no"
7+
}
8+
}
9+
}
10+
},
11+
"CONSOLE_DEFAULT_CONSOLE_MGMT": {
12+
"sonic-console:sonic-console": {
13+
"sonic-console:CONSOLE_SWITCH": {
14+
"sonic-console:console_mgmt": {
15+
}
16+
}
17+
}
18+
},
19+
"CONSOLE_DISABLED_INCORRECT_PATTERN": {
20+
"sonic-console:sonic-console": {
21+
"sonic-console:CONSOLE_SWITCH": {
22+
"sonic-console:console_mgmt": {
23+
"enabled": "false"
24+
}
25+
}
26+
}
27+
},
28+
"CONSOLE_PORT_DEFAULT_FLOW_CONTROL": {
29+
"sonic-console:sonic-console": {
30+
"sonic-console:CONSOLE_PORT": {
31+
"CONSOLE_PORT_LIST": [
32+
{
33+
"name": "1",
34+
"baud_rate": "9600"
35+
}
36+
]
37+
}
38+
}
39+
},
40+
"CONSOLE_PORT_INVALID_NAME": {
41+
"sonic-console:sonic-console": {
42+
"sonic-console:CONSOLE_PORT": {
43+
"CONSOLE_PORT_LIST": [
44+
{
45+
"name": "invalid",
46+
"baud_rate": "9600"
47+
}
48+
]
49+
}
50+
}
51+
},
52+
"CONSOLE_PORT_INVALID_BAUD": {
53+
"sonic-console:sonic-console": {
54+
"sonic-console:CONSOLE_PORT": {
55+
"CONSOLE_PORT_LIST": [
56+
{
57+
"name": "1",
58+
"baud_rate": "invalid"
59+
}
60+
]
61+
}
62+
}
63+
},
64+
"CONSOLE_PORT_VALID": {
65+
"sonic-console:sonic-console": {
66+
"sonic-console:CONSOLE_PORT": {
67+
"CONSOLE_PORT_LIST": [
68+
{
69+
"name": "1",
70+
"baud_rate": "9600",
71+
"flow_control": "1",
72+
"remote_device": "remote_host_1"
73+
},
74+
{
75+
"name": "2",
76+
"baud_rate": "9600",
77+
"flow_control": "0",
78+
"remote_device": "remote_host_2"
79+
},
80+
{
81+
"name": "3",
82+
"baud_rate": "9600"
83+
}
84+
]
85+
}
86+
}
87+
}
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"RESTAPI_TABLE_WITH_INCORRECT_CERT": {
3+
"sonic-restapi:sonic-restapi": {
4+
"sonic-restapi:RESTAPI": {
5+
"certs": {
6+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
7+
"server_crt": "a/b/c",
8+
"server_key": "/etc/sonic/credentials/restapiserver.key",
9+
"client_crt_cname": "client"
10+
}
11+
}
12+
}
13+
},
14+
"RESTAPI_TABLE_WITH_INCORRECT_CLIENT": {
15+
"sonic-restapi:sonic-restapi": {
16+
"sonic-restapi:RESTAPI": {
17+
"certs": {
18+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
19+
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
20+
"server_key": "/etc/sonic/credentials/restapiserver.key",
21+
"client_crt_cname": "/client"
22+
}
23+
}
24+
}
25+
},
26+
"RESTAPI_TABLE_WITH_VALID_CONFIG": {
27+
"sonic-restapi:sonic-restapi": {
28+
"sonic-restapi:RESTAPI": {
29+
"certs": {
30+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
31+
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
32+
"server_key": "/etc/sonic/credentials/restapiserver.key",
33+
"client_crt_cname": "client.sonic.net"
34+
}
35+
}
36+
}
37+
},
38+
"RESTAPI_TABLE_WITH_MULTIPLE_CERTS": {
39+
"sonic-restapi:sonic-restapi": {
40+
"sonic-restapi:RESTAPI": {
41+
"certs": {
42+
"ca_crt": "/etc/sonic/credentials/ame_root.pem",
43+
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
44+
"server_key": "/etc/sonic/credentials/restapiserver.key",
45+
"client_crt_cname": "client.sonic.net,clientds.prod.net"
46+
}
47+
}
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)