support BGP_ALLOWED_PREFIXES (#10142)

This commit is contained in:
StormLiangMS 2022-03-05 09:20:38 +08:00 committed by GitHub
parent c40f04f0e2
commit 55a0722a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 323 additions and 4 deletions

View File

@ -85,6 +85,7 @@ setup(
'./yang-models/sonic-bgp-neighbor.yang',
'./yang-models/sonic-bgp-peergroup.yang',
'./yang-models/sonic-bgp-peerrange.yang',
'./yang-models/sonic-bgp-allowed-prefix.yang',
'./yang-models/sonic-breakout_cfg.yang',
'./yang-models/sonic-buffer-pg.yang',
'./yang-models/sonic-buffer-pool.yang',
@ -126,11 +127,8 @@ setup(
'./yang-models/sonic-versions.yang',
'./yang-models/sonic-vlan.yang',
'./yang-models/sonic-vrf.yang',
'./yang-models/sonic-mclag.yang',
'./yang-models/sonic-vlan-sub-interface.yang',
'./yang-models/sonic-warm-restart.yang',
'./yang-models/sonic-lldp.yang',
'./yang-models/sonic-scheduler.yang',
@ -153,6 +151,7 @@ setup(
'./cvlyang-models/sonic-bgp-neighbor.yang',
'./cvlyang-models/sonic-bgp-peergroup.yang',
'./cvlyang-models/sonic-bgp-peerrange.yang',
'./cvlyang-models/sonic-bgp-allowed-prefix.yang',
'./cvlyang-models/sonic-breakout_cfg.yang',
'./cvlyang-models/sonic-copp.yang',
'./cvlyang-models/sonic-crm.yang',

View File

@ -1216,6 +1216,14 @@
"peer_group": "PG1"
}
},
"BGP_ALLOWED_PREFIXES" :{
"DEPLOYMENT_ID|4|123:123": {
"default_action": "permit"
},
"DEPLOYMENT_ID|5": {
"default_action": "permit"
}
},
"ROUTE_MAP_SET": {
"map1": {
}

View File

@ -157,7 +157,46 @@
},
"BGP_PEERRANGE_ALL_VALID": {
"desc": "Configure BGP peer range table."
}
},
"BGP_ALLOWED_PREFIXES_COM_LIST_ALL_VALID": {
"desc": "Configue BGP allowed prefix list."
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEPLOYMENT": {
"desc": "Invalid default action.",
"eStrKey" : "Pattern"
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEFAULT_ACTION": {
"desc": "Invalid default action.",
"eStrKey" : "InvalidValue",
"eStr" : ["default_action"]
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV4": {
"desc": "Invalid IPv4 prefix.",
"eStrKey" : "Pattern"
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV6": {
"desc": "Invalid IPv6 prefix.",
"eStrKey" : "Pattern"
},
"BGP_ALLOWED_PREFIXES_LIST_ALL_VALID": {
"desc": "Configue BGP allowed prefix list."
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_DEPLOYMENT": {
"desc": "Invalid default action.",
"eStrKey" : "Pattern"
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_DEFAULT_ACTION": {
"desc": "Invalid default action.",
"eStrKey" : "InvalidValue",
"eStr" : ["default_action"]
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV4": {
"desc": "Invalid IPv4 prefix.",
"eStrKey" : "Pattern"
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV6": {
"desc": "Invalid IPv6 prefix.",
"eStrKey" : "Pattern"
}
}

View File

@ -1420,6 +1420,177 @@
]
}
}
},
"BGP_ALLOWED_PREFIXES_COM_LIST_ALL_VALID": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_COM_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"community": "123:123",
"default_action": "permit",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
},
{
"deployment": "DEPLOYMENT_ID",
"id": "5",
"community": "456:456",
"default_action": "permit",
"prefixes_v4": ["10.10.0.0/24", "10.11.0.0/24"],
"prefixes_v6": ["fc00:f1::/64", "fc00:a1::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEPLOYMENT": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_COM_LIST": [
{
"deployment": "DEPLOYMENTID",
"id": "4",
"community": "123:123",
"default_action": "permitall",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEFAULT_ACTION": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_COM_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"community": "123:123",
"default_action": "permitall",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV4": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_COM_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"community": "123:123",
"default_action": "permit",
"prefixes_v4": ["10.0.0.0/48", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV6": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_COM_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"community": "123:123",
"default_action": "permit",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0./24"],
"prefixes_v6": ["fc00:f0::/129", "fc00:a0::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_LIST_ALL_VALID": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"default_action": "permit",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
},
{
"deployment": "DEPLOYMENT_ID",
"id": "5",
"default_action": "permit",
"prefixes_v4": ["10.10.0.0/24", "10.11.0.0/24"],
"prefixes_v6": ["fc00:f1::/64", "fc00:a1::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_DEPLOYMENT": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_LIST": [
{
"deployment": "DEPLOYMENTID",
"id": "4",
"default_action": "permitall",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_DEFAULT_ACTION": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"default_action": "permitall",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV4": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"default_action": "permit",
"prefixes_v4": ["10.0.0.0/48", "10.1.0.0/24"],
"prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"]
}
]
}
}
},
"BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV6": {
"sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": {
"sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": {
"BGP_ALLOWED_PREFIXES_LIST": [
{
"deployment": "DEPLOYMENT_ID",
"id": "4",
"default_action": "permit",
"prefixes_v4": ["10.0.0.0/24", "10.1.0.0./24"],
"prefixes_v6": ["fc00:f0::/129", "fc00:a0::/64"]
}
]
}
}
}
}

View File

@ -0,0 +1,102 @@
module sonic-bgp-allowed-prefix {
namespace "http://github.com/Azure/sonic-bgp-allowed-prefix";
prefix bgppre;
yang-version 1.1;
import sonic-bgp-common {
prefix bgpcmn;
}
import ietf-inet-types {
prefix inet;
}
import sonic-routing-policy-sets {
prefix rpolsets;
}
organization
"SONiC";
contact
"SONiC";
description
"SONIC BGP Allowed Prefix";
revision 2022-02-26 {
description
"Initial revision.";
}
container sonic-bgp-allowed-prefix {
container BGP_ALLOWED_PREFIXES {
list BGP_ALLOWED_PREFIXES_COM_LIST {
key "deployment id community";
leaf deployment {
type string {
pattern "DEPLOYMENT_ID";
}
description "BGP allowed prefix list key type";
}
leaf id {
type uint32;
description "BGP allowed prefix list deployment id";
}
leaf community {
type string;
description "BGP allowed prefix list deployment community";
}
leaf default_action {
type rpolsets:routing-policy-action-type;
description "Permit/Deny action for BGP allow prefix list";
}
leaf-list prefixes_v4 {
type inet:ipv4-prefix;
description "BGP V4 allowed prefix list";
}
leaf-list prefixes_v6 {
type inet:ipv6-prefix;
description "BGP V6 allowed prefix list";
}
}
list BGP_ALLOWED_PREFIXES_LIST {
key "deployment id";
leaf deployment {
type string {
pattern "DEPLOYMENT_ID";
}
description "BGP allowed prefix list key type";
}
leaf id {
type uint32;
description "BGP allowed prefix list deployment id";
}
leaf default_action {
type rpolsets:routing-policy-action-type;
description "Permit/Deny action for BGP allow prefix list";
}
leaf-list prefixes_v4 {
type inet:ipv4-prefix;
description "BGP V4 allowed prefix list";
}
leaf-list prefixes_v6 {
type inet:ipv6-prefix;
description "BGP V6 allowed prefix list";
}
}
}
}
}