summaryrefslogtreecommitdiffhomepage
path: root/config/util.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-01-02 02:13:30 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-01-09 05:17:57 -0800
commitcc8d0fd748f83d774ec59e680586421cd9d9a6d2 (patch)
tree393a564c3d6389084f098732528b3b4206cd60de /config/util.go
parent0c1c373e498db1023e4f307f362598a096e36df0 (diff)
config: refactor config structure
- change config variable name to chaincase from camelcase - remove unnecessary wrapper structs which only contain one slice field Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config/util.go')
-rw-r--r--config/util.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/config/util.go b/config/util.go
index cc7cbba1..ca2ebe4c 100644
--- a/config/util.go
+++ b/config/util.go
@@ -21,7 +21,7 @@ import (
func IsConfederationMember(g *Global, p *Neighbor) bool {
if p.Config.PeerAs != g.Config.As {
- for _, member := range g.Confederation.Config.MemberAs {
+ for _, member := range g.Confederation.Config.MemberAsList {
if member == p.Config.PeerAs {
return true
}
@@ -34,9 +34,11 @@ func IsEBGPPeer(g *Global, p *Neighbor) bool {
return p.Config.PeerAs != g.Config.As
}
+type AfiSafis []AfiSafi
+
func (c AfiSafis) ToRfList() ([]bgp.RouteFamily, error) {
- rfs := make([]bgp.RouteFamily, 0, len(c.AfiSafiList))
- for _, rf := range c.AfiSafiList {
+ rfs := make([]bgp.RouteFamily, 0, len(c))
+ for _, rf := range c {
k, err := bgp.GetRouteFamily(rf.AfiSafiName)
if err != nil {
return nil, err
@@ -47,7 +49,7 @@ func (c AfiSafis) ToRfList() ([]bgp.RouteFamily, error) {
}
func CreateRfMap(p *Neighbor) map[bgp.RouteFamily]bool {
- rfs, _ := p.AfiSafis.ToRfList()
+ rfs, _ := AfiSafis(p.AfiSafis).ToRfList()
rfMap := make(map[bgp.RouteFamily]bool)
for _, rf := range rfs {
rfMap[rf] = true