diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-02 02:13:30 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-09 05:17:57 -0800 |
commit | cc8d0fd748f83d774ec59e680586421cd9d9a6d2 (patch) | |
tree | 393a564c3d6389084f098732528b3b4206cd60de /config/serve.go | |
parent | 0c1c373e498db1023e4f307f362598a096e36df0 (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/serve.go')
-rw-r--r-- | config/serve.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/config/serve.go b/config/serve.go index 6de993b8..10eed911 100644 --- a/config/serve.go +++ b/config/serve.go @@ -78,23 +78,23 @@ func UpdateConfig(curC *Bgp, newC *Bgp) (*Bgp, []Neighbor, []Neighbor, []Neighbo deleted := []Neighbor{} updated := []Neighbor{} - for _, n := range newC.Neighbors.NeighborList { - if idx := inSlice(n, curC.Neighbors.NeighborList); idx < 0 { + for _, n := range newC.Neighbors { + if idx := inSlice(n, curC.Neighbors); idx < 0 { added = append(added, n) } else { - if !reflect.DeepEqual(n.ApplyPolicy, curC.Neighbors.NeighborList[idx].ApplyPolicy) { + if !reflect.DeepEqual(n.ApplyPolicy, curC.Neighbors[idx].ApplyPolicy) { updated = append(updated, n) } } } - for _, n := range curC.Neighbors.NeighborList { - if inSlice(n, newC.Neighbors.NeighborList) < 0 { + for _, n := range curC.Neighbors { + if inSlice(n, newC.Neighbors) < 0 { deleted = append(deleted, n) } } - bgpConfig.Neighbors.NeighborList = newC.Neighbors.NeighborList + bgpConfig.Neighbors = newC.Neighbors return &bgpConfig, added, deleted, updated } |