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] add peer switch model #11828

Merged
merged 5 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
142 changes: 78 additions & 64 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Table of Contents
* [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue)
* [NTP Global Configuration](#ntp-global-configuration)
* [NTP and SYSLOG servers](#ntp-and-syslog-servers)
* [Peer Switch](#peer-switch)
* [Policer](#policer)
* [Port](#port)
* [Port Channel](#port-channel)
Expand Down Expand Up @@ -724,41 +725,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**,
**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 +1115,64 @@ 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"
}
}
}
```

### Peer Switch

Below is an exmaple of the peer switch table configuration.
```
{
"PEER_SWITCH": {
"vlab-05": {
"address_ipv4": "10.1.0.33"
}
}
}
```

### 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 @@ -152,6 +152,7 @@ def run(self):
'./yang-models/sonic-storm-control.yang',
'./yang-models/sonic-tc-priority-group-map.yang',
'./yang-models/sonic-tc-queue-map.yang',
'./yang-models/sonic-peer-switch.yang',
'./yang-models/sonic-pfc-priority-queue-map.yang',
'./yang-models/sonic-pfc-priority-priority-group-map.yang',
'./yang-models/sonic-port-qos-map.yang',
Expand Down
5 changes: 5 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 @@ -1798,6 +1798,11 @@
}
},

"PEER_SWITCH": {
"vlab-05": {
"address_ipv4": "10.1.0.33"
}
},

"POLICER": {
"everflow_static_policer": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"PEER_SWITCH_LOAD_NORMAL": {
"desc": "Load PEER_SWITCH for dualtor device."
},
"PEER_SWITCH_MISSING_DEVICE__NAME": {
"desc": "Load PEER_SWITCH missing PEER Device name.",
"eStrKey": "Mandatory"
},
"PEER_SWITCH_INVALID_IP_ADDRESS": {
"desc": "Load PEER_SWITCH with invalid IPv4 Address.",
"eStrKey": "Pattern"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"PEER_SWITCH_LOAD_NORMAL": {
"sonic-peer-switch:sonic-peer-switch": {
"sonic-peer-switch:PEER_SWITCH": {
"PEER_SWITCH_LIST": [
{
"peer_switch": "vlab-05",
"address_ipv4": "10.1.0.33"
}
]
}
}
},

"PEER_SWITCH_MISSING_DEVICE__NAME": {
"sonic-peer-switch:sonic-peer-switch": {
"sonic-peer-switch:PEER_SWITCH": {
"PEER_SWITCH_LIST": [
{
"address_ipv4": "10.1.0.33"
}
]
}
}
},

"PEER_SWITCH_INVALID_IP_ADDRESS": {
"sonic-peer-switch:sonic-peer-switch": {
"sonic-peer-switch:PEER_SWITCH": {
"PEER_SWITCH_LIST": [
{
"peer_switch": "vlab-05",
"address_ipv4": "10.1.0.33/32"
}
]
}
}
}
}
49 changes: 49 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-peer-switch.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module sonic-peer-switch {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-peer-switch";
prefix peer_switch;

import ietf-inet-types {
prefix inet;
}

import sonic-types {
prefix stypes;
}

organization
"SONiC";

contact
"SONiC";

description
"SONiC DualToR peer switch data";

revision 2022-08-23 {
description
"Initial revision";
}

container sonic-peer-switch {
container PEER_SWITCH {
list PEER_SWITCH_LIST {
max-elements 1;

key "peer_switch";

leaf peer_switch {
type stypes:hostname;

description "SONiC DualToR peer host name.";
}

leaf address_ipv4 {
type inet:ipv4-address;

description "SONiC DualToR peer's IPv4 address.";
}
}
}
}
}