add Tunnel yang model (#12232)
#### Why I did it Add yang model for TUNNEL config #### How I did it created sonic-tunnel.yang file and tests #### How to verify it `make target/python-wheels/bullseye/sonic_yang_models-1.0-py3-none-any.whl` #### Link to config_db schema for YANG module changes https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#tunnel
This commit is contained in:
parent
e0c29aabe0
commit
86a5a7f1ea
@ -54,6 +54,7 @@ Table of Contents
|
||||
* [TC to Priority group map](#tc-to-priority-group-map)
|
||||
* [TC to Queue map](#tc-to-queue-map)
|
||||
* [Telemetry](#telemetry)
|
||||
* [Tunnel](#tunnel)
|
||||
* [Versions](#versions)
|
||||
* [VLAN](#vlan)
|
||||
* [VLAN_MEMBER](#vlan_member)
|
||||
@ -1594,6 +1595,61 @@ Container side configuration:
|
||||
}
|
||||
```
|
||||
|
||||
### Tunnel
|
||||
|
||||
This table configures the MUX tunnel for Dual-ToR setup
|
||||
```
|
||||
{
|
||||
"TUNNEL": {
|
||||
"MuxTunnel0": {
|
||||
"dscp_mode": "uniform",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"ecn_mode": "copy_from_outer",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "pipe",
|
||||
"tunnel_type": "IPINIP"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
different example for configuring MUX tunnel
|
||||
```
|
||||
{
|
||||
"TUNNEL": {
|
||||
"MuxTunnel0": {
|
||||
"dscp_mode": "pipe",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"ecn_mode": "standard",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "uniform",
|
||||
"tunnel_type": "IPINIP"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
example mux tunnel configuration for when tunnel_qos_remap is enabled
|
||||
```
|
||||
{
|
||||
"TUNNEL": {
|
||||
"MuxTunnel0": {
|
||||
"tunnel_type": "IPINIP",
|
||||
"src_ip": "10.1.0.33",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"dscp_mode": "pipe",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ecn_mode": "copy_from_outer",
|
||||
"ttl_mode": "uniform",
|
||||
"decap_dscp_to_tc_map": "DecapDscpToTcMap",
|
||||
"decap_tc_to_pg_map": "DecapTcToPgMap",
|
||||
"encap_tc_to_dscp_map": "EncapTcToQueueMap",
|
||||
"encap_tc_to_queue_map": "EncapTcToDscpMap"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Versions
|
||||
|
||||
This table is where the curret version of the software is recorded.
|
||||
|
@ -145,6 +145,7 @@ setup(
|
||||
'./yang-models/sonic-system-aaa.yang',
|
||||
'./yang-models/sonic-system-tacacs.yang',
|
||||
'./yang-models/sonic-telemetry.yang',
|
||||
'./yang-models/sonic-tunnel.yang',
|
||||
'./yang-models/sonic-types.yang',
|
||||
'./yang-models/sonic-versions.yang',
|
||||
'./yang-models/sonic-vlan.yang',
|
||||
|
@ -1144,14 +1144,45 @@
|
||||
"TELEMETRY": {
|
||||
"certs": {
|
||||
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer",
|
||||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer",
|
||||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key"
|
||||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer",
|
||||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key"
|
||||
},
|
||||
"gnmi": {
|
||||
"client_auth": "true",
|
||||
"log_level": "2",
|
||||
"port": "50051"
|
||||
}
|
||||
"gnmi": {
|
||||
"client_auth": "true",
|
||||
"log_level": "2",
|
||||
"port": "50051"
|
||||
}
|
||||
},
|
||||
"TUNNEL": {
|
||||
"MuxTunnel0": {
|
||||
"dscp_mode": "uniform",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"ecn_mode": "copy_from_outer",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "pipe",
|
||||
"tunnel_type": "IPINIP"
|
||||
},
|
||||
"MuxTunnel1": {
|
||||
"dscp_mode": "pipe",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"ecn_mode": "standard",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "uniform",
|
||||
"tunnel_type": "IPINIP"
|
||||
},
|
||||
"MuxTunnel2": {
|
||||
"tunnel_type": "IPINIP",
|
||||
"src_ip": "10.1.0.33",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"dscp_mode": "pipe",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ecn_mode": "copy_from_outer",
|
||||
"ttl_mode": "uniform",
|
||||
"decap_dscp_to_tc_map": "Dscp_to_tc_map1",
|
||||
"decap_tc_to_pg_map": "tc_to_pg_map1",
|
||||
"encap_tc_to_dscp_map": "EncapTcToQueueMap",
|
||||
"encap_tc_to_queue_map": "tc_to_q_map1"
|
||||
}
|
||||
},
|
||||
"RESTAPI": {
|
||||
"certs": {
|
||||
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"TUNNEL_LOAD_NORMAL": {
|
||||
"desc": "Load TUNNEL for dualtor device."
|
||||
},
|
||||
"TUNNEL_INVALID_ADDR": {
|
||||
"desc": "Load TUNNEL with invalid IPv4 Address.",
|
||||
"eStr": ["does not satisfy the constraint"]
|
||||
},
|
||||
"TUNNEL_SRC_IP_NOT_PEER_SWITCH": {
|
||||
"desc": "Load TUNNEL with wrong IPv4 Address.",
|
||||
"eStr": ["points to a non-existing leaf."]
|
||||
},
|
||||
"TUNNEL_MISSING_MUX_TUNNEL": {
|
||||
"desc": "Load MUX_TUNNEL missing name.",
|
||||
"eStr": ["Missing required element"]
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,143 @@
|
||||
{
|
||||
"TUNNEL_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"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-dscp-tc-map:sonic-dscp-tc-map": {
|
||||
"sonic-dscp-tc-map:DSCP_TO_TC_MAP": {
|
||||
"DSCP_TO_TC_MAP_LIST": [
|
||||
{
|
||||
"name": "DecapDscpToTcMap",
|
||||
"DSCP_TO_TC_MAP": [
|
||||
{
|
||||
"dscp": "1",
|
||||
"tc": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-tc-priority-group-map:sonic-tc-priority-group-map": {
|
||||
"sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": {
|
||||
"TC_TO_PRIORITY_GROUP_MAP_LIST": [
|
||||
{
|
||||
"name": "DecapTcToPgMap",
|
||||
"TC_TO_PRIORITY_GROUP_MAP": [
|
||||
{
|
||||
"tc": "1",
|
||||
"pg": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-tc-queue-map:sonic-tc-queue-map": {
|
||||
"sonic-tc-queue-map:TC_TO_QUEUE_MAP": {
|
||||
"TC_TO_QUEUE_MAP_LIST": [
|
||||
{
|
||||
"name": "EncapTcToQueueMap",
|
||||
"TC_TO_QUEUE_MAP": [
|
||||
{
|
||||
"tc": "1",
|
||||
"qindex": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-tunnel:sonic-tunnel": {
|
||||
"sonic-tunnel:TUNNEL": {
|
||||
"TUNNEL_LIST": [
|
||||
{
|
||||
"mux_tunnel": "MuxTunnel0",
|
||||
"dscp_mode": "pipe",
|
||||
"src_ip": "10.1.0.33",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"ecn_mode": "standard",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "pipe",
|
||||
"tunnel_type": "IPINIP",
|
||||
"decap_dscp_to_tc_map": "DecapDscpToTcMap",
|
||||
"decap_tc_to_pg_map": "DecapTcToPgMap",
|
||||
"encap_tc_to_dscp_map": "EncapTcToDscpMap",
|
||||
"encap_tc_to_queue_map": "EncapTcToQueueMap"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"TUNNEL_INVALID_ADDR": {
|
||||
"sonic-tunnel:sonic-tunnel": {
|
||||
"sonic-tunnel:TUNNEL": {
|
||||
"TUNNEL_LIST": [
|
||||
{
|
||||
"mux_tunnel": "MuxTunnel0",
|
||||
"dscp_mode": "pipe",
|
||||
"dst_ip": "10.1.0.33/32",
|
||||
"ecn_mode": "standard",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "pipe",
|
||||
"tunnel_type": "IPINIP"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"TUNNEL_SRC_IP_NOT_PEER_SWITCH": {
|
||||
"sonic-peer-switch:sonic-peer-switch": {
|
||||
"sonic-peer-switch:PEER_SWITCH": {
|
||||
"PEER_SWITCH_LIST": [
|
||||
{
|
||||
"peer_switch": "vlab-05",
|
||||
"address_ipv4": "10.1.0.33"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-tunnel:sonic-tunnel": {
|
||||
"sonic-tunnel:TUNNEL": {
|
||||
"TUNNEL_LIST": [
|
||||
{
|
||||
"mux_tunnel": "MuxTunnel0",
|
||||
"dscp_mode": "pipe",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"src_ip": "10.1.0.32",
|
||||
"ecn_mode": "standard",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "pipe",
|
||||
"tunnel_type": "IPINIP"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"TUNNEL_MISSING_MUX_TUNNEL": {
|
||||
"sonic-tunnel:sonic-tunnel": {
|
||||
"sonic-tunnel:TUNNEL": {
|
||||
"TUNNEL_LIST": [
|
||||
{
|
||||
"dscp_mode": "pipe",
|
||||
"dst_ip": "10.1.0.32",
|
||||
"ecn_mode": "standard",
|
||||
"encap_ecn_mode": "standard",
|
||||
"ttl_mode": "pipe",
|
||||
"tunnel_type": "IPINIP"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
122
src/sonic-yang-models/yang-models/sonic-tunnel.yang
Normal file
122
src/sonic-yang-models/yang-models/sonic-tunnel.yang
Normal file
@ -0,0 +1,122 @@
|
||||
module sonic-tunnel {
|
||||
yang-version 1.1;
|
||||
namespace "http://github.com/sonic-net/sonic-tunnel";
|
||||
prefix tunnel;
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-peer-switch {
|
||||
prefix ps;
|
||||
}
|
||||
|
||||
import sonic-dscp-tc-map {
|
||||
prefix dtm;
|
||||
}
|
||||
|
||||
import sonic-tc-priority-group-map {
|
||||
prefix tpgm;
|
||||
}
|
||||
|
||||
import sonic-tc-queue-map {
|
||||
prefix tqm;
|
||||
}
|
||||
|
||||
organization
|
||||
"SONiC";
|
||||
|
||||
contact
|
||||
"SONiC";
|
||||
|
||||
description
|
||||
"SONiC DualToR tunnel data";
|
||||
|
||||
revision 2022-08-23 {
|
||||
description
|
||||
"Initial revision";
|
||||
}
|
||||
|
||||
container sonic-tunnel {
|
||||
container TUNNEL {
|
||||
description "TUNNEL configuration for SONiC Dual-ToR";
|
||||
list TUNNEL_LIST {
|
||||
key "mux_tunnel";
|
||||
|
||||
leaf mux_tunnel {
|
||||
description "Name of MuxTunnel";
|
||||
type string {
|
||||
pattern "MuxTunnel[0-9]+";
|
||||
}
|
||||
}
|
||||
|
||||
leaf dscp_mode {
|
||||
description "DSCP mode";
|
||||
type string {
|
||||
pattern "uniform|pipe";
|
||||
}
|
||||
}
|
||||
|
||||
leaf src_ip {
|
||||
description "source IPv4 address off the tunnel. Must be SONiC DualToR peer IPv4 address.";
|
||||
type leafref {
|
||||
path "/ps:sonic-peer-switch/ps:PEER_SWITCH/ps:PEER_SWITCH_LIST/ps:address_ipv4";
|
||||
}
|
||||
}
|
||||
|
||||
leaf dst_ip {
|
||||
description "IPv4 address of this switch.";
|
||||
type inet:ipv4-address;
|
||||
}
|
||||
|
||||
leaf ecn_mode {
|
||||
description "ECN mode";
|
||||
type string {
|
||||
pattern "copy_from_outer|standard";
|
||||
}
|
||||
}
|
||||
|
||||
leaf encap_ecn_mode {
|
||||
description "Encap ECN mode";
|
||||
type string {
|
||||
pattern "standard";
|
||||
}
|
||||
}
|
||||
|
||||
leaf ttl_mode {
|
||||
description "TTL mode";
|
||||
type string {
|
||||
pattern "uniform|pipe";
|
||||
}
|
||||
}
|
||||
|
||||
leaf tunnel_type {
|
||||
description "Tunnel type";
|
||||
type string {
|
||||
pattern "IPINIP";
|
||||
}
|
||||
}
|
||||
|
||||
leaf decap_dscp_to_tc_map {
|
||||
description "Decap DSCP to TC map";
|
||||
type string;
|
||||
}
|
||||
|
||||
leaf decap_tc_to_pg_map {
|
||||
description "Decap TC to PG map";
|
||||
type string;
|
||||
}
|
||||
|
||||
leaf encap_tc_to_dscp_map {
|
||||
description "Encap TC to DSCP map";
|
||||
type string;
|
||||
}
|
||||
|
||||
leaf encap_tc_to_queue_map {
|
||||
description "Encap TC to Queue map";
|
||||
type string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user