Add DASH yang (#13078)

* Introduce Sonic Yang for DASH for the following tables:
This commit is contained in:
Prince Sunny 2023-01-03 09:19:42 -08:00 committed by GitHub
parent f84d8b9635
commit fa9abb6bcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 651 additions and 0 deletions

View File

@ -100,6 +100,7 @@ setup(
'./yang-models/sonic-copp.yang',
'./yang-models/sonic-console.yang',
'./yang-models/sonic-crm.yang',
'./yang-models/sonic-dash.yang',
'./yang-models/sonic-default-lossless-buffer-parameter.yang',
'./yang-models/sonic-device_metadata.yang',
'./yang-models/sonic-device_neighbor.yang',

View File

@ -2140,6 +2140,12 @@
"ip": "kubernetes.apiserver.com",
"port": "6443"
}
},
"DASH_VNET": {
"Vnet1": {
"vni": "10",
"guid":"guid-vnet1"
}
}
},
"SAMPLE_CONFIG_DB_UNKNOWN": {

View File

@ -0,0 +1,25 @@
{
"DASH_VNET_TABLE_WITH_CORRECT_CONFIG": {
"desc": "DASH VNET TABLE WITH VALID CONFIG."
},
"DASH_ENI_TABLE_WITH_CORRECT_CONFIG": {
"desc": "DASH ENI TABLE WITH VALID CONFIG."
},
"DASH_ROUTING_TYPE_TABLE_WITH_CORRECT_CONFIG": {
"desc": "DASH ROUTING TYPE TABLE WITH VALID CONFIG."
},
"DASH_MAPPING_TABLE_WITH_NON_EXISTENT_VNET": {
"desc": "DASH MAPPING TABLE_WITH_NON_EXISTENT VNET failure.",
"eStrKey" : "LeafRef"
},
"DASH_ROUTE_TABLE_WITH_INCORRECT_IPPREFIX": {
"desc": "DASH ROUTE TABLE WITH INVALID IP PREFIX.",
"eStrKey": "InvalidValue"
},
"DASH_MAPPING_TABLE_WITH_VALID_CONFIG": {
"desc": "DASH MAPPING TABLE WITH VALID CONFIG."
},
"DASH_ROUTE_TABLE_WITH_VALID_CONFIG": {
"desc": "DASH ROUTE TABLE WITH VALID CONFIG."
}
}

View File

@ -0,0 +1,143 @@
{
"DASH_VNET_TABLE_WITH_CORRECT_CONFIG": {
"sonic-dash:sonic-dash": {
"sonic-dash:DASH_VNET": {
"DASH_VNET_LIST": [{
"name": "Vnet1",
"vni": "10",
"guid":"guid-vnet1"
}]
}
}
},
"DASH_ENI_TABLE_WITH_CORRECT_CONFIG": {
"sonic-dash:sonic-dash": {
"sonic-dash:DASH_ENI": {
"DASH_ENI_LIST": [{
"name": "F9-22",
"vnet": "Vnet1",
"eni_id":"guid-eni1",
"mac_address":"F9:22:83:99:22:A2"
}]
},
"sonic-dash:DASH_VNET": {
"DASH_VNET_LIST": [{
"name": "Vnet1",
"vni": "10",
"guid":"guid-vnet1"
}]
}
}
},
"DASH_ROUTING_TYPE_TABLE_WITH_CORRECT_CONFIG": {
"sonic-dash:sonic-dash": {
"sonic-dash:DASH_ROUTING_TYPE": {
"DASH_ROUTING_TYPE_LIST": [{
"name": "vnet_direct",
"action_name": "act_name",
"action_type":"maprouting"
},
{
"name": "vnet_encap",
"action_name": "act_name1",
"action_type": "staticencap",
"encap_type": "vxlan"
}]
}
}
},
"DASH_MAPPING_TABLE_WITH_NON_EXISTENT_VNET": {
"sonic-dash:sonic-dash": {
"sonic-dash:DASH_VNET_MAPPING_TABLE": {
"DASH_VNET_MAPPING_TABLE_LIST": [{
"vnet": "Vnet2",
"ip_addr": "10.0.0.6",
"routing_type":"vnet_encap",
"underlay_ip":"2601:12:7a:1::1234",
"mac_address":"F9:22:83:99:22:A2"
}]
}
}
},
"DASH_ROUTE_TABLE_WITH_INCORRECT_IPPREFIX": {
"sonic-dash:sonic-dash": {
"sonic-dash:DASH_ROUTE_TABLE": {
"DASH_ROUTE_TABLE_LIST": [{
"eni": "F9-22",
"prefix": "10.0.0.6",
"action_type":"vnet_encap"
}]
},
"sonic-dash:DASH_ROUTING_TYPE": {
"DASH_ROUTING_TYPE_LIST": [{
"name": "vnet_encap",
"action_name": "act_name1",
"action_type": "staticencap",
"encap_type": "vxlan"
}]
}
}
},
"DASH_MAPPING_TABLE_WITH_VALID_CONFIG": {
"sonic-dash:sonic-dash": {
"sonic-dash:DASH_VNET_MAPPING_TABLE": {
"DASH_VNET_MAPPING_TABLE_LIST": [{
"vnet": "Vnet1",
"ip_addr": "10.0.0.6",
"routing_type":"vnet_encap",
"underlay_ip":"2601:12:7a:1::1234",
"mac_address":"F9:22:83:99:22:A2"
}]
},
"sonic-dash:DASH_ROUTING_TYPE": {
"DASH_ROUTING_TYPE_LIST": [{
"name": "vnet_encap",
"action_name": "act_name1",
"action_type": "staticencap",
"encap_type": "vxlan"
}]
},
"sonic-dash:DASH_VNET": {
"DASH_VNET_LIST": [{
"name": "Vnet1",
"vni": "10",
"guid":"guid-vnet1"
}]
}
}
},
"DASH_ROUTE_TABLE_WITH_VALID_CONFIG": {
"sonic-dash:sonic-dash": {
"sonic-dash:DASH_ROUTE_TABLE": {
"DASH_ROUTE_TABLE_LIST": [{
"eni": "F9-22",
"prefix": "10.0.0.6/32",
"action_type":"vnet",
"vnet":"Vnet1"
}]
},
"sonic-dash:DASH_ROUTING_TYPE": {
"DASH_ROUTING_TYPE_LIST": [{
"name": "vnet",
"action_name": "act_name1",
"action_type": "maprouting"
}]
},
"sonic-dash:DASH_ENI": {
"DASH_ENI_LIST": [{
"name": "F9-22",
"vnet": "Vnet1",
"eni_id":"guid-eni1",
"mac_address":"F9:22:83:99:22:A2"
}]
},
"sonic-dash:DASH_VNET": {
"DASH_VNET_LIST": [{
"name": "Vnet1",
"vni": "10",
"guid":"guid-vnet1"
}]
}
}
}
}

View File

@ -0,0 +1,476 @@
module sonic-dash {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-dash";
prefix dash;
import ietf-yang-types {
prefix yang;
}
import ietf-inet-types {
prefix inet;
}
import sonic-types {
prefix stypes;
}
organization
"SONiC";
contact
"SONiC";
description
"SONIC DASH YANG Module for SONiC OS";
revision 2022-12-07 {
description
"Initial revision.";
}
container sonic-dash {
container DASH_VNET {
description "DASH VNET configuration, part of APP_DB. Used for gNMI clients to configure SONiC";
list DASH_VNET_LIST {
key "name";
leaf name {
type string {
pattern "Vnet[a-zA-Z0-9_-]+" {
error-message "Invalid Vnet name";
error-app-tag vnet-name-invalid;
}
}
}
leaf vni {
type uint32 {
range 1..16777215;
}
}
leaf guid {
description "Guid used for Vnet identification";
type string {
length 1..255;
}
}
leaf-list address_spaces {
type stypes:sonic-ip-prefix;
}
} /* end of list DASH_VNET_LIST */
} /* end of container DASH_VNET */
container DASH_QOS {
description "DASH QOS configs to specify bandwidth, cps, part of APP_DB";
list DASH_QOS_LIST {
key "name";
leaf name{
type string {
length 1..255;
}
}
leaf bw {
description "Bandwidth in kbps";
type uint64 {
range "0..100000000" {
error-message "kbps value out of range";
}
}
}
leaf cps {
description "Max number of connections per second";
type uint64 {
range "0..100000000" {
error-message "cps value out of range";
}
}
}
leaf flows {
description "Number of flows";
type uint64 {
range "0..100000000" {
error-message "flows value out of range";
}
}
}
} /* end of list DASH_QOS_LIST */
} /* end of container DASH_QOS */
container DASH_ENI {
description "DASH ENI object to specify eni params; part of APP_DB";
list DASH_ENI_LIST {
key "name";
leaf name{
type string {
length 1..255;
}
}
leaf eni_id{
description "ENI guid for cross reference and identification";
type string {
length 1..255;
}
}
leaf mac_address {
type yang:mac-address;
}
leaf qos {
type leafref {
path /dash:sonic-dash/dash:DASH_QOS/dash:DASH_QOS_LIST/dash:name;
}
}
leaf vnet {
type leafref {
path /dash:sonic-dash/dash:DASH_VNET/dash:DASH_VNET_LIST/dash:name;
}
}
} /* end of list DASH_ENI_LIST */
} /* end of container DASH_ENI */
container DASH_ACL_IN {
description "DASH Ingress ACL to specify stage and group; part of APP_DB";
list DASH_ACL_IN_LIST {
key "eni stage";
leaf eni {
type leafref {
path /dash:sonic-dash/dash:DASH_ENI/dash:DASH_ENI_LIST/dash:name;
}
}
leaf stage {
type uint8 {
range 1..5;
}
}
leaf acl_group_id {
type leafref {
path /dash:sonic-dash/dash:DASH_ACL_GROUP/dash:DASH_ACL_GROUP_LIST/dash:name;
}
}
} /* end of list DASH_ACL_IN_LIST */
} /* end of container DASH_ACL_IN */
container DASH_ACL_OUT {
description "DASH Egress ACL to specify stage and group; part of APP_DB";
list DASH_ACL_OUT_LIST {
key "eni stage";
leaf eni {
type leafref {
path /dash:sonic-dash/dash:DASH_ENI/dash:DASH_ENI_LIST/dash:name;
}
}
leaf stage {
type uint8 {
range 1..5;
}
}
leaf acl_group_id {
type leafref {
path /dash:sonic-dash/dash:DASH_ACL_GROUP/dash:DASH_ACL_GROUP_LIST/dash:name;
}
}
} /* end of list DASH_ACL_OUT_LIST */
} /* end of container DASH_ACL_OUT */
container DASH_ACL_GROUP {
description "DASH ACL group to specify IP version; part of APP_DB";
list DASH_ACL_GROUP_LIST {
key "name";
leaf name {
type string {
length 1..255;
}
}
leaf ip_version {
type string {
pattern "ipv4|ipv6";
}
}
leaf guid {
description "Guid used for ACL group identification";
type string {
length 1..255;
}
}
} /* end of list DASH_ACL_GROUP_LIST */
} /* end of container DASH_ACL_GROUP */
container DASH_ACL_RULE {
description "DASH ACL rule; part of APP_DB";
list DASH_ACL_RULE_LIST {
key "acl_group_id name";
leaf acl_group_id {
type leafref {
path /dash:sonic-dash/dash:DASH_ACL_GROUP/dash:DASH_ACL_GROUP_LIST/dash:name;
}
}
leaf name {
type string {
length 1..255;
}
}
leaf priority {
type uint32 {
range 0..16777215;
}
}
leaf action {
type string {
pattern "allow|deny";
}
}
leaf terminating {
type boolean;
default false;
description "If set to true, stop processing further rules";
}
leaf-list ip_protocol {
description "IP Protocol (tcp or udp or icmp etc)";
type stypes:ip-protocol-type;
}
leaf-list src_addr {
type stypes:sonic-ip-prefix;
}
leaf-list dst_addr {
type stypes:sonic-ip-prefix;
}
leaf-list src_port {
description "List of L4 source port range as pattern '0-65365'";
type string {
pattern '([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])-([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])';
}
}
leaf-list dst_port {
description "List of L4 dst port range as pattern '0-65365'";
type string {
pattern '([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])-([0-9]{1,4}|[0-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-2][0-9]{2}|[6][5][3][0-5]{2}|[6][5][3][6][0-5])';
}
}
} /* end of list DASH_ACL_RULE_LIST */
} /* end of container DASH_ACL_RULE */
container DASH_APPLIANCE {
description "DASH general appliance configs; part of APP_DB";
list DASH_APPLIANCE_LIST {
key "name";
leaf name {
type string {
length 1..255;
}
}
leaf sip {
type inet:ip-address;
}
leaf vni {
description "VM VNI used for setting direction";
type uint32 {
range 1..16777215;
}
}
} /* end of list DASH_APPLIANCE_LIST */
} /* end of container DASH_APPLIANCE */
container DASH_ROUTING_TYPE {
description "DASH Routing types and actions; part of APP_DB";
list DASH_ROUTING_TYPE_LIST {
key "name";
leaf name {
type string {
pattern "direct|vnet|vnet_direct|vnet_encap|drop|appliance|privatelink|privatelinknsg|servicetunnel";
}
}
leaf action_name {
type string {
length 1..255;
}
}
leaf action_type {
type string {
pattern "none|maprouting|direct|staticencap|appliance|4to6|mapdecap|decap|drop";
}
}
leaf encap_type {
type string {
pattern "vxlan|nvgre";
}
}
leaf vni {
type uint32 {
range 1..16777215;
}
}
} /* end of list DASH_ROUTING_TYPE_LIST */
} /* end of container DASH_ROUTING_TYPE */
container DASH_ROUTE_TABLE {
description "DASH Route table (LPM) associated to an ENI for outbound routing; part of APP_DB";
list DASH_ROUTE_TABLE_LIST {
key "eni prefix";
leaf eni {
type leafref {
path /dash:sonic-dash/dash:DASH_ENI/dash:DASH_ENI_LIST/dash:name;
}
}
leaf prefix {
type stypes:sonic-ip-prefix;
}
leaf action_type {
type leafref {
path /dash:sonic-dash/dash:DASH_ROUTING_TYPE/dash:DASH_ROUTING_TYPE_LIST/dash:name;
}
}
leaf vnet {
when "((current()/../action_type = 'vnet') or (current()/../action_type = 'vnet-direct'))";
type leafref {
path /dash:sonic-dash/dash:DASH_VNET/dash:DASH_VNET_LIST/dash:name;
}
}
leaf appliance {
when "(current()/../action_type = 'appliance')";
type leafref {
path /dash:sonic-dash/dash:DASH_APPLIANCE/dash:DASH_APPLIANCE_LIST/dash:name;
}
}
leaf overlay_ip {
when "((current()/../action_type = 'vnet') or (current()/../action_type = 'vnet-direct'))";
description "Overlay IP to use for mapping lookup, if routing_type is vnet-direct";
type inet:ip-address;
}
leaf overlay_sip {
when "(current()/../action_type = 'servicetunnel')";
description "Overlay src ip for service tunnel";
type inet:ip-address;
}
leaf overlay_dip {
when "(current()/../action_type = 'servicetunnel')";
description "Overlay dst ip for service tunnel";
type inet:ip-address;
}
leaf underlay_sip {
when "(current()/../action_type = 'servicetunnel')";
description "Underlay src ip for service tunnel";
type inet:ip-address;
}
leaf underlay_dip{
when "(current()/../action_type = 'servicetunnel')";
description "Underlay dst ip for service tunnel";
type inet:ip-address;
}
} /* end of list DASH_ROUTE_TABLE_LIST */
} /* end of container DASH_ROUTE_TABLE */
container DASH_VNET_MAPPING_TABLE {
description "DASH Mapping table associated to a Vnet; part of APP_DB";
list DASH_VNET_MAPPING_TABLE_LIST {
key "vnet ip_addr";
leaf vnet {
type leafref {
path /dash:sonic-dash/dash:DASH_VNET/dash:DASH_VNET_LIST/dash:name;
}
}
leaf ip_addr {
description "Overlay CA address";
type inet:ip-address;
}
leaf routing_type {
type leafref {
path /dash:sonic-dash/dash:DASH_ROUTING_TYPE/dash:DASH_ROUTING_TYPE_LIST/dash:name;
}
}
leaf underlay_ip {
description "PA address";
type inet:ip-address;
}
leaf mac_address {
type yang:mac-address;
}
leaf use_dst_vni {
type boolean;
default false;
description "If set to true, use destination VNET VNI for encap";
}
} /* end of list DASH_MAPPING_TABLE_LIST */
} /* end of container DASH_MAPPING_TABLE */
} /* end of container sonic-dash */
} /* end of module sonic-dash */