diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-11 05:09:13 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-04-20 13:14:09 +0900 |
commit | 802879087ddf14da1c2dab90d05dd09debb747a7 (patch) | |
tree | 564416d955485fdaed137c0836a6a66907ed10b9 /config | |
parent | d62e65f4fe06deca5c4ce7dee957a9b517b80f12 (diff) |
server: support route-target constraint
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config')
-rw-r--r-- | config/bgp_configs.go | 21 | ||||
-rw-r--r-- | config/util.go | 9 |
2 files changed, 30 insertions, 0 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 47d070b4..1b3d2a73 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -2597,6 +2597,22 @@ func (lhs *Collector) Equal(rhs *Collector) bool { return true } +//struct for container gobgp:route-target-membership +type RouteTargetMembership struct { + // original -> gobgp:deferral-time + DeferralTime uint16 `mapstructure:"deferral-time"` +} + +func (lhs *RouteTargetMembership) Equal(rhs *RouteTargetMembership) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.DeferralTime != rhs.DeferralTime { + return false + } + return true +} + //struct for container bgp-mp:l2vpn-evpn type L2vpnEvpn struct { // original -> bgp-mp:prefix-limit @@ -3224,6 +3240,8 @@ type AfiSafi struct { UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths"` // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` + // original -> gobgp:route-target-membership + RouteTargetMembership RouteTargetMembership `mapstructure:"route-target-membership"` } func (lhs *AfiSafi) Equal(rhs *AfiSafi) bool { @@ -3284,6 +3302,9 @@ func (lhs *AfiSafi) Equal(rhs *AfiSafi) bool { if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { return false } + if !lhs.RouteTargetMembership.Equal(&(rhs.RouteTargetMembership)) { + return false + } return true } diff --git a/config/util.go b/config/util.go index 47edc98f..8d7d2546 100644 --- a/config/util.go +++ b/config/util.go @@ -57,3 +57,12 @@ func CreateRfMap(p *Neighbor) map[bgp.RouteFamily]bool { } return rfMap } + +func GetAfiSafi(p *Neighbor, family bgp.RouteFamily) *AfiSafi { + for _, a := range p.AfiSafis { + if string(a.AfiSafiName) == family.String() { + return &a + } + } + return nil +} |