sonic-buildimage/src/sonic-yang-models/yang-models/sonic-bgp-internal-neighbor.yang
arlakshm 288d667c66
[yang][multi-asic]bgp internal neighbor yang model (#10632)
closes #10157

Why I did it
Add yang model for the bgp_internal_neighbor table in config_db

How I did it
Add new yang model file and unit tests

How to verify it
UT and compile sonic_yang_models-1.0-py3-none-any.whl and sonic_yang_mgmt-1.0-py3-none-any.whl

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
2022-05-04 15:05:44 -07:00

58 lines
1.7 KiB
YANG

module sonic-bgp-internal-neighbor {
namespace "http://github.com/Azure/sonic-bgp-internal-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 multi asic platforms";
revision 2021-04-10 {
description
"Initial revision.";
}
container sonic-bgp-internal-neighbor {
container BGP_INTERNAL_NEIGHBOR {
list BGP_INTERNAL_NEIGHBOR_LIST {
description "List for internal neighbors in multi asic 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 "Internal iBGP 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";
}
}
}
}
}
}
}