Skip to content

Commit 0940eea

Browse files
i-davydenkoIvan Davydenko
authored andcommitted
[cli-sessions] Update YAML models with new serial-console tree, extended ssh-server tree.
1 parent 2539a1d commit 0940eea

File tree

5 files changed

+92
-3
lines changed

5 files changed

+92
-3
lines changed

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,20 +2618,41 @@ There are 4 classes
26182618
}
26192619
```
26202620

2621+
### SERIAL_CONSOLE
2622+
2623+
In this table collected configuration of the next serial-console attributes:
2624+
- inactivity_timeout - Inactivity timeout for serial-console session, allowed values: 0-35000 (minutes), default value: 15
2625+
- sysrq_capabilities - Enabling or disabling SysRq functionality for serial-console session, allowed values: enabled/disabled, default value disabled
2626+
2627+
```
2628+
{
2629+
SERIAL_CONSOLE:{
2630+
"POLICIES":{
2631+
"inactivity_timeout": 15
2632+
"sysrq_capabilities": "disabled"
2633+
}
2634+
}
2635+
}
2636+
```
2637+
26212638
### SSH_SERVER
26222639

2623-
In this table, we allow configuring ssh server global settings. This will feature includes 3 configurations:
2640+
In this table, we allow configuring ssh server global settings. This will feature includes 5 configurations:
26242641

26252642
- authentication_retries - number of login attepmts 1-100
26262643
- login_timeout - Timeout in seconds for login session for user to connect 1-600
26272644
- ports - Ssh port numbers - string of port numbers seperated by ','
2645+
- inactivity_timeout - Inactivity timeout for SSH session, allowed values: 0-35000 (min), default value: 15 (min)
2646+
- max_sessions - Max number of concurrent logins, allowed values: 0-100 (where 0 means no limit), default value: 0
26282647
```
26292648
{
26302649
"SSH_SERVER": {
26312650
"POLICIES":{
26322651
"authentication_retries": "6",
26332652
"login_timeout": "120",
2634-
"ports": "22"
2653+
"ports": "22",
2654+
"inactivity_timeout": "15",
2655+
"max_sessions": "0"
26352656
}
26362657
}
26372658
}

src/sonic-yang-models/setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def run(self):
201201
'./yang-models/sonic-macsec.yang',
202202
'./yang-models/sonic-bgp-sentinel.yang',
203203
'./yang-models/sonic-bmp.yang',
204+
'./yang-models/sonic-serial-console.yang',
204205
'./yang-models/sonic-smart-switch.yang',]),
205206
('cvlyang-models', ['./cvlyang-models/sonic-acl.yang',
206207
'./cvlyang-models/sonic-banner.yang',
@@ -243,6 +244,7 @@ def run(self):
243244
'./cvlyang-models/sonic-nat.yang',
244245
'./cvlyang-models/sonic-nvgre-tunnel.yang',
245246
'./cvlyang-models/sonic-pbh.yang',
247+
'./cvlyang-models/sonic-ssh-server.yang',
246248
'./cvlyang-models/sonic-policer.yang',
247249
'./cvlyang-models/sonic-port.yang',
248250
'./cvlyang-models/sonic-portchannel.yang',
@@ -278,6 +280,7 @@ def run(self):
278280
'./cvlyang-models/sonic-system-port.yang',
279281
'./cvlyang-models/sonic-macsec.yang',
280282
'./cvlyang-models/sonic-bmp.yang',
283+
'./cvlyang-models/sonic-serial-console.yang',
281284
'./cvlyang-models/sonic-bgp-sentinel.yang']),
282285
],
283286
zip_safe=False,

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2410,7 +2410,16 @@
24102410
"POLICIES":{
24112411
"authentication_retries": "6",
24122412
"login_timeout": "120",
2413-
"ports": "22"
2413+
"ports": "22",
2414+
"inactivity_timeout": "15",
2415+
"max_sessions": "0"
2416+
}
2417+
},
2418+
2419+
"SERIAL_CONSOLE": {
2420+
"POLICIES":{
2421+
"inactivity_timeout": "15",
2422+
"sysrq_capabilities": "disabled"
24142423
}
24152424
},
24162425

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//filename: sonic-serial-console.yang
2+
module sonic-serial-console {
3+
yang-version 1.1;
4+
namespace "http://github.com/Azure/sonic-serial-console";
5+
prefix cli-sessions;
6+
description "SERIAL_CONSOLE YANG Module for SONiC-based OS";
7+
revision 2023-06-07 {
8+
description "First Revision";
9+
}
10+
container sonic-serial-console {
11+
container SERIAL_CONSOLE {
12+
description "SERIAL_CONSOLE part of config_db.json";
13+
container POLICIES {
14+
leaf inactivity_timeout {
15+
description "serial-console inactivity-timeout timer value in minutes";
16+
type int32 {
17+
range "0..35000";
18+
}
19+
default 15;
20+
}
21+
22+
leaf sysrq_capabilities {
23+
description "managing SysRq capabilities";
24+
type enumeration {
25+
enum disabled;
26+
enum enabled;
27+
}
28+
default disabled;
29+
}
30+
}
31+
/* end of container POLICIES */
32+
}
33+
/* end of container SERIAL_CONSOLE */
34+
}
35+
/* end of top level container */
36+
}
37+
/* end of module sonic-serial-console */

src/sonic-yang-models/yang-models/sonic-ssh-server.yang

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ module sonic-ssh-server {
1111
description
1212
"First Revision";
1313
}
14+
15+
revision 2023-06-07 {
16+
description
17+
"Introduce inactivity timeout and max syslogins options";
18+
}
1419

1520
container sonic-ssh-server {
1621
container SSH_SERVER {
@@ -40,6 +45,20 @@ module sonic-ssh-server {
4045
}
4146
}
4247
}
48+
leaf inactivity_timeout {
49+
description "inactivity timeout (in minutes), 0 means no timeout";
50+
default 15;
51+
type uint32 {
52+
range 0..35000;
53+
}
54+
}
55+
leaf max_sessions {
56+
description "limit of concurrent system logins, 0 means no limit";
57+
default 0;
58+
type uint32 {
59+
range 0..100;
60+
}
61+
}
4362
}/*container policies */
4463
} /* container SSH_SERVER */
4564
}/* container sonic-ssh-server */

0 commit comments

Comments
 (0)