diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-10-03 14:27:58 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-11-07 21:53:46 +0900 |
commit | e541ede1b5e4d08aaa3fffd1ee13744cc1b69c59 (patch) | |
tree | a1506709a7fff5bed29003fe02e71f1efd524a61 /server | |
parent | 8fed41e4cca863b20ff9467cbc33de2972717b86 (diff) |
config: Pass Global Config to SetDefaultNeighborConfig
In neighbor config, there are some parameters whose
default value can be changed depending on the global config.
This commit modifies the argument of config.SetDefaultNeighborConfigValues()
to pass the global config. It enables to change the default
settings of neighbor depending on the global config.
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'server')
-rw-r--r-- | server/peer.go | 2 | ||||
-rw-r--r-- | server/server.go | 2 | ||||
-rw-r--r-- | server/server_test.go | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/server/peer.go b/server/peer.go index 892395be..135713f9 100644 --- a/server/peer.go +++ b/server/peer.go @@ -79,7 +79,7 @@ func newDynamicPeer(g *config.Global, neighborAddress string, pg *config.PeerGro }).Debugf("Can't overwrite neighbor config: %s", err) return nil } - if err := config.SetDefaultNeighborConfigValues(&conf, g.Config.As); err != nil { + if err := config.SetDefaultNeighborConfigValues(&conf, g); err != nil { log.WithFields(log.Fields{ "Topic": "Peer", "Key": neighborAddress, diff --git a/server/server.go b/server/server.go index 18ff196d..9de1c8ad 100644 --- a/server/server.go +++ b/server/server.go @@ -1760,7 +1760,7 @@ func (server *BgpServer) addNeighbor(c *config.Neighbor) error { } } - if err := config.SetDefaultNeighborConfigValues(c, server.bgpConfig.Global.Config.As); err != nil { + if err := config.SetDefaultNeighborConfigValues(c, &server.bgpConfig.Global); err != nil { return err } diff --git a/server/server_test.go b/server/server_test.go index ac762176..bb9e7ff1 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -200,7 +200,8 @@ func TestNumGoroutineWithAddDeleteNeighbor(t *testing.T) { func newPeerandInfo(myAs, as uint32, address string, rib *table.TableManager) (*Peer, *table.PeerInfo) { nConf := &config.Neighbor{Config: config.NeighborConfig{PeerAs: as, NeighborAddress: address}} - config.SetDefaultNeighborConfigValues(nConf, myAs) + gConf := &config.Global{Config: config.GlobalConfig{As: myAs}} + config.SetDefaultNeighborConfigValues(nConf, gConf) policy := table.NewRoutingPolicy() policy.Reset(&config.RoutingPolicy{}, nil) p := NewPeer( |