[chassis][yang]yang model for bgp voq chassis neighbor (#10642)
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com Why I did it Fixes #10158 How I did it Add yang model for config_db table BGP_VOQ_CHASSIS_NEIGHBOR and UT
This commit is contained in:
parent
288d667c66
commit
0dcbfa3a97
@ -87,6 +87,7 @@ setup(
|
|||||||
'./yang-models/sonic-bgp-peergroup.yang',
|
'./yang-models/sonic-bgp-peergroup.yang',
|
||||||
'./yang-models/sonic-bgp-peerrange.yang',
|
'./yang-models/sonic-bgp-peerrange.yang',
|
||||||
'./yang-models/sonic-bgp-allowed-prefix.yang',
|
'./yang-models/sonic-bgp-allowed-prefix.yang',
|
||||||
|
'./yang-models/sonic-bgp-voq-chassis-neighbor.yang',
|
||||||
'./yang-models/sonic-breakout_cfg.yang',
|
'./yang-models/sonic-breakout_cfg.yang',
|
||||||
'./yang-models/sonic-buffer-pg.yang',
|
'./yang-models/sonic-buffer-pg.yang',
|
||||||
'./yang-models/sonic-buffer-pool.yang',
|
'./yang-models/sonic-buffer-pool.yang',
|
||||||
|
@ -1729,6 +1729,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR": {
|
||||||
|
"10.0.0.1": {
|
||||||
|
"asn": "64850",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "10.0.0.2",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
},
|
||||||
|
"3333::3:6": {
|
||||||
|
"asn": "64850",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "3333::3:3",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"MACSEC_PROFILE": {
|
"MACSEC_PROFILE": {
|
||||||
"test": {
|
"test": {
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR_TEST" : {
|
||||||
|
"desc": "Load bgp voq chassis neighbor"
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_WITH_INVALID_SWITCH_TYPE_TEST" : {
|
||||||
|
"desc": "Load bgp voq chassis on non voq chassis switch",
|
||||||
|
"eStr": ["Bgp voq neighbor are applicable only when switch_type is voq"]
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_ABSENT_LOCAL_ADDRESS_TEST" : {
|
||||||
|
"desc": "Load bgp voq chassis with no local address",
|
||||||
|
"eStrKey" : "Mandatory"
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_INVALID_LOCAL_ADDRESS_ADDRESS_FAMILY_TEST": {
|
||||||
|
"desc": "Load ipv6 bgp voq chassis with ipv4 local address",
|
||||||
|
"eStr": ["local address and neighbor address family doesnt match"]
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_INVALID_ASN_TEST": {
|
||||||
|
"desc" :"Load bgp voq chassis neighbor with asn number different than local asn",
|
||||||
|
"eStr": ["Voq chassis BGP neighbors should have same ASN as defined in device metadata"]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,206 @@
|
|||||||
|
{
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR_TEST": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": {
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [
|
||||||
|
{
|
||||||
|
"neighbor": "10.0.0.1",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "10.0.0.2",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neighbor": "3333::3:6",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "3333::3:3",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-device_metadata:sonic-device_metadata": {
|
||||||
|
"sonic-device_metadata:DEVICE_METADATA": {
|
||||||
|
"localhost": {
|
||||||
|
"bgp_asn": "65001",
|
||||||
|
"default_bgp_status": "up",
|
||||||
|
"hostname": "sonic-chassis",
|
||||||
|
"platform": "voq-chassis",
|
||||||
|
"switch_type": "voq"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_WITH_INVALID_SWITCH_TYPE_TEST": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": {
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [
|
||||||
|
{
|
||||||
|
"neighbor": "10.0.0.1",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "10.0.0.2",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neighbor": "3333::3:6",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "3333::3:3",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-device_metadata:sonic-device_metadata": {
|
||||||
|
"sonic-device_metadata:DEVICE_METADATA": {
|
||||||
|
"localhost": {
|
||||||
|
"bgp_asn": "65001",
|
||||||
|
"default_bgp_status": "up",
|
||||||
|
"hostname": "sonic-chassis",
|
||||||
|
"platform": "voq-chassis",
|
||||||
|
"switch_type": "chassis-packet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_ABSENT_LOCAL_ADDRESS_TEST": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": {
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [
|
||||||
|
{
|
||||||
|
"neighbor": "10.0.0.1",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "10.0.0.2",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neighbor": "3333::3:6",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-device_metadata:sonic-device_metadata": {
|
||||||
|
"sonic-device_metadata:DEVICE_METADATA": {
|
||||||
|
"localhost": {
|
||||||
|
"bgp_asn": "65001",
|
||||||
|
"default_bgp_status": "up",
|
||||||
|
"hostname": "sonic-chassis",
|
||||||
|
"platform": "voq-chassis",
|
||||||
|
"switch_type": "voq"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_INVALID_LOCAL_ADDRESS_ADDRESS_FAMILY_TEST": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": {
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [
|
||||||
|
{
|
||||||
|
"neighbor": "10.0.0.1",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "10.0.0.2",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neighbor": "3333::3:6",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "3.3.3.3",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-device_metadata:sonic-device_metadata": {
|
||||||
|
"sonic-device_metadata:DEVICE_METADATA": {
|
||||||
|
"localhost": {
|
||||||
|
"bgp_asn": "65001",
|
||||||
|
"default_bgp_status": "up",
|
||||||
|
"hostname": "sonic-chassis",
|
||||||
|
"platform": "voq-chassis",
|
||||||
|
"switch_type": "voq"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"BGP_VOQ_CHASSIS_INVALID_ASN_TEST": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:sonic-bgp-voq-chassis-neighbor": {
|
||||||
|
"sonic-bgp-voq-chassis-neighbor:BGP_VOQ_CHASSIS_NEIGHBOR": {
|
||||||
|
"BGP_VOQ_CHASSIS_NEIGHBOR_LIST": [
|
||||||
|
{
|
||||||
|
"neighbor": "10.0.0.1",
|
||||||
|
"asn": "65000",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "10.0.0.2",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neighbor": "3333::3:6",
|
||||||
|
"asn": "65001",
|
||||||
|
"holdtime": "180",
|
||||||
|
"keepalive": "60",
|
||||||
|
"local_addr": "3333::3:3",
|
||||||
|
"name": "sonic-chassis-lc3",
|
||||||
|
"nhopself": "0",
|
||||||
|
"rrclient": "0",
|
||||||
|
"admin_status": "up"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-device_metadata:sonic-device_metadata": {
|
||||||
|
"sonic-device_metadata:DEVICE_METADATA": {
|
||||||
|
"localhost": {
|
||||||
|
"bgp_asn": "65001",
|
||||||
|
"default_bgp_status": "up",
|
||||||
|
"hostname": "sonic-chassis",
|
||||||
|
"platform": "voq-chassis",
|
||||||
|
"switch_type": "voq"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
module sonic-bgp-voq-chassis-neighbor {
|
||||||
|
namespace "http://github.com/Azure/sonic-bgp-voq-chassis-neighbor";
|
||||||
|
prefix bgpintnbr;
|
||||||
|
yang-version 1.1;
|
||||||
|
|
||||||
|
import ietf-inet-types {
|
||||||
|
prefix inet;
|
||||||
|
}
|
||||||
|
|
||||||
|
import sonic-device_metadata {
|
||||||
|
prefix dm;
|
||||||
|
}
|
||||||
|
|
||||||
|
import sonic-bgp-common {
|
||||||
|
prefix bgpcmn;
|
||||||
|
}
|
||||||
|
organization
|
||||||
|
"SONiC";
|
||||||
|
|
||||||
|
contact
|
||||||
|
"SONiC";
|
||||||
|
|
||||||
|
description
|
||||||
|
"SONIC BGP Internal Neighbor for voq chassis platforms";
|
||||||
|
|
||||||
|
revision 2021-04-10 {
|
||||||
|
description
|
||||||
|
"Initial revision.";
|
||||||
|
}
|
||||||
|
|
||||||
|
container sonic-bgp-voq-chassis-neighbor {
|
||||||
|
container BGP_VOQ_CHASSIS_NEIGHBOR {
|
||||||
|
list BGP_VOQ_CHASSIS_NEIGHBOR_LIST {
|
||||||
|
description "List for internal neighbors in voq chassis platforms";
|
||||||
|
key "neighbor";
|
||||||
|
|
||||||
|
leaf neighbor {
|
||||||
|
type inet:ip-address;
|
||||||
|
description "BGP Neighbor address";
|
||||||
|
}
|
||||||
|
|
||||||
|
uses bgpcmn:sonic-bgp-cmn-neigh {
|
||||||
|
|
||||||
|
refine asn {
|
||||||
|
must "(current() = /dm:sonic-device_metadata/dm:DEVICE_METADATA/dm:localhost/dm:bgp_asn)" {
|
||||||
|
error-message "Voq chassis BGP neighbors should have same ASN as defined in device metadata";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refine local_addr {
|
||||||
|
mandatory true;
|
||||||
|
must "((contains(../neighbor, '.') and contains(current(), '.')) or
|
||||||
|
(contains(../neighbor, ':') and contains(current(), ':')))" {
|
||||||
|
error-message "local address and neighbor address family doesnt match";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
must "(/dm:sonic-device_metadata/dm:DEVICE_METADATA/dm:localhost/dm:switch_type = 'voq')" {
|
||||||
|
error-message "Bgp voq neighbor are applicable only when switch_type is voq";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user