Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YANG] Create YANG Model for Console #11806

Merged
merged 9 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 89 additions & 64 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Table of Contents
* [Buffer port egress profile list](#buffer-port-egress-profile-list)
* [Cable length](#cable-length)
* [COPP_TABLE](#copp_table)
* [Console](#console)
* [CRM](#crm)
* [Data Plane L3 Interfaces](#data-plane-l3-interfaces)
* [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER)
Expand Down Expand Up @@ -686,6 +687,30 @@ This kind of profiles will be handled by buffer manager and won't be applied to
}
```

### Console

```
{
"CONSOLE_PORT": {
"1": {
"baud_rate": "115200",
"flow_control": "0",
"remote_device": "host-1"
},
"2": {
"baud_rate": "9600",
"flow_control": "1"
}
},

"CONSOLE_SWITCH": {
"console_mgmt": {
"enabled": "yes"
}
}
}
```

### CRM

```
Expand Down Expand Up @@ -724,41 +749,41 @@ This kind of profiles will be handled by buffer manager and won't be applied to

### Data Plane L3 Interfaces

IP configuration for data plane are defined in **INTERFACE**, **VLAN_SUB_INTERFACE**,
Blueve marked this conversation as resolved.
Show resolved Hide resolved
**PORTCHANNEL_INTERFACE** and **VLAN_INTERFACE** table. The objects
in all four tables have the interface (could be physical port, port
channel, vlan or vlan sub interface) that IP address is attached to as first-level key, and
IP prefix as second-level key. IP interface address objects don't have any attributes.
IP interface attributes, resides in those tables as well, key is the interface name
and value is a list of field-values representing the interface attributes, e.g. loopback action.
IP configuration for data plane are defined in **INTERFACE**, **VLAN_SUB_INTERFACE**,
**PORTCHANNEL_INTERFACE** and **VLAN_INTERFACE** table. The objects
in all four tables have the interface (could be physical port, port
channel, vlan or vlan sub interface) that IP address is attached to as first-level key, and
IP prefix as second-level key. IP interface address objects don't have any attributes.
IP interface attributes, resides in those tables as well, key is the interface name
and value is a list of field-values representing the interface attributes, e.g. loopback action.

```
{
"INTERFACE": {
"Ethernet0|10.0.0.0/31": {},
"Ethernet4|10.0.0.2/31": {},
"Ethernet8|10.0.0.4/31": {}
"Ethernet8": {
"loopback_action": "drop"
}
"Ethernet8": {
"loopback_action": "drop"
}
},

"PORTCHANNEL_INTERFACE": {
"PortChannel01|10.0.0.56/31": {},
"PortChannel01|FC00::71/126": {},
"PortChannel02|10.0.0.58/31": {},
"PortChannel02|FC00::75/126": {}
},

"VLAN_INTERFACE": {
"Vlan1000|192.168.0.1/27": {}
},

"VLAN_SUB_INTERFACE": {
"Ethernet4.1|10.0.0.2/31": {},
"Ethernet4.1": {
"loopback_action": "drop"
}
},
"VLAN_SUB_INTERFACE": {
"Ethernet4.1|10.0.0.2/31": {},
"Ethernet4.1": {
"loopback_action": "drop"
}
}
}
```
Expand Down Expand Up @@ -1114,51 +1139,51 @@ These information are configured in individual tables. Domain name or IP
address of the server is used as object key. Currently there are no
attributes in those objects.

***NTP server***
```
{
"NTP_SERVER": {
"2.debian.pool.ntp.org": {},
"1.debian.pool.ntp.org": {},
"3.debian.pool.ntp.org": {},
"0.debian.pool.ntp.org": {}
},

"NTP_SERVER": {
"23.92.29.245": {},
"204.2.134.164": {}
}
}
```

***Syslog server***
```
{
"SYSLOG_SERVER": {
"10.0.0.5": {},
"10.0.0.6": {},
"10.11.150.5": {}
},

"SYSLOG_SERVER" : {
"2.2.2.2": {
"source": "1.1.1.1",
"port": "514",
"vrf": "default"
},
"4.4.4.4": {
"source": "3.3.3.3",
"port": "514",
"vrf": "mgmt"
},
"2222::2222": {
"source": "1111::1111",
"port": "514",
"vrf": "Vrf-Data"
}
}
}
```
***NTP server***
```
{
"NTP_SERVER": {
"2.debian.pool.ntp.org": {},
"1.debian.pool.ntp.org": {},
"3.debian.pool.ntp.org": {},
"0.debian.pool.ntp.org": {}
},
"NTP_SERVER": {
"23.92.29.245": {},
"204.2.134.164": {}
}
}
```
***Syslog server***
```
{
"SYSLOG_SERVER": {
"10.0.0.5": {},
"10.0.0.6": {},
"10.11.150.5": {}
},
"SYSLOG_SERVER" : {
"2.2.2.2": {
"source": "1.1.1.1",
"port": "514",
"vrf": "default"
},
"4.4.4.4": {
"source": "3.3.3.3",
"port": "514",
"vrf": "mgmt"
},
"2222::2222": {
"source": "1111::1111",
"port": "514",
"vrf": "Vrf-Data"
}
}
}
```

### Policer

Expand Down
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def run(self):
'./yang-models/sonic-buffer-queue.yang',
'./yang-models/sonic-cable-length.yang',
'./yang-models/sonic-copp.yang',
'./yang-models/sonic-console.yang',
'./yang-models/sonic-crm.yang',
'./yang-models/sonic-default-lossless-buffer-parameter.yang',
'./yang-models/sonic-device_metadata.yang',
Expand Down
17 changes: 17 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,23 @@
"default_dynamic_th": "0",
"over_subscribe_ratio": "0"
}
},

"CONSOLE_PORT": {
"1": {
"baud_rate": "115200",
"flow_control": "0",
"remote_device": "host-1"
},
"2": {
"baud_rate": "9600",
"flow_control": "1"
}
},
"CONSOLE_SWITCH": {
"console_mgmt": {
"enabled": "yes"
}
}
},
"SAMPLE_CONFIG_DB_UNKNOWN": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"CONSOLE_DISABLED": {
"desc": "Verifying CONSOLE_SWITCH configuration."
},
"CONSOLE_DISABLED_INCORRECT_PATTERN": {
"desc": "CONSOLE_SWITCH configuration pattern failure.",
"eStrKey": "Pattern"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"CONSOLE_DISABLED": {
"sonic-console:sonic-console": {
"sonic-console:CONSOLE_SWITCH": {
"sonic-console:console-mgmt": {
"enabled": "no"
}
}
}
},
"CONSOLE_DISABLED_INCORRECT_PATTERN": {
"sonic-console:sonic-console": {
"sonic-console:CONSOLE_SWITCH": {
"sonic-console:console-mgmt": {
"enabled": "false"
}
}
}
}
}
76 changes: 76 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-console.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module sonic-console {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-console";
prefix console;

description "SONiC CONSOLE";

revision 2022-08-22 {
description "First Revision";
}

import sonic-types {
prefix stypes;
}

typedef console-mgmt-enabled {
description "configuration to set if console switch is enabled or not";
type string {
pattern "yes|no";
}
}

typedef console-flow-control {
description "configuration to set if enable flow control on a console port";
type string {
pattern "0|1";
}
}

container sonic-console {
container CONSOLE_PORT {
description "CONSOLE_PORT part of config_db.json";

list CONSOLE_PORT_LIST {
key "name";

leaf name {
description "Configure console port name";
type uint16;
}

leaf baud_rate {
description "Configure baud rate";
type uint32;
}

leaf flow_control {
description "Configure if enable/disable flow control";
type console-flow-control;
default "0";
}

remote_device {
description "Configure the remote device name";
type stypes:hostname;
}
}

} /* end of container CONSOLE_PORT */

container CONSOLE_SWITCH {
description "CONSOLE_SWITCH part of config_db.json";

container console_mgmt {
leaf enabled {
description "This configuration indicate if enable console management feature on SONiC";
type console-mgmt-enabled;
default "no";
}
}

} /* end of container CONSOLE_SWITCH */

} /* end of top level container */

} /* end of module sonic-console */