summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-03-16 16:02:34 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-03-17 10:47:03 +0900
commit5120cfc7ca03bb5742123b16d1452749d62c8db4 (patch)
treed0b2c75657080546e660cd871094b712f88845c0 /server
parentb06b3ad42fe07cafd4ffee3e21068a324bff5bba (diff)
config: move Mrt/Bmp configuration outside of Global configuration
Global config basically store configuration whose change will cause all neighbor session restart. Mrt and Bmp configuration is not such. Put them outside of Global config. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go63
1 files changed, 34 insertions, 29 deletions
diff --git a/server/server.go b/server/server.go
index c93bc55b..d5cc8882 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1102,24 +1102,53 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *FsmMsg) []*SenderMsg {
}
func (server *BgpServer) SetGlobalType(g config.Global) error {
- {
+ ch := make(chan *GrpcResponse)
+ server.GrpcReqCh <- &GrpcRequest{
+ RequestType: REQ_MOD_GLOBAL_CONFIG,
+ Data: &g,
+ ResponseCh: ch,
+ }
+ if err := (<-ch).Err(); err != nil {
+ return err
+ }
+ if g.Zebra.Enabled {
+ cli, err := NewZclient(g.Zebra.Url, g.Zebra.RedistributeRouteTypeList)
+ if err != nil {
+ return err
+ }
+ server.zclient = cli
+ server.zapiMsgCh = server.zclient.Receive()
+ }
+ return nil
+}
+
+func (server *BgpServer) SetRpkiConfig(c []config.RpkiServer) {
+ server.rpkiConfigCh <- c
+}
+
+func (server *BgpServer) SetBmpConfig(c []config.BmpServer) error {
+ for _, s := range c {
ch := make(chan *GrpcResponse)
server.GrpcReqCh <- &GrpcRequest{
- RequestType: REQ_MOD_GLOBAL_CONFIG,
- Data: &g,
+ RequestType: REQ_MOD_BMP,
+ Data: &s.Config,
ResponseCh: ch,
}
if err := (<-ch).Err(); err != nil {
return err
}
}
- if g.Mrt.FileName != "" {
+ return nil
+}
+
+func (server *BgpServer) SetMrtConfig(c config.Mrt) error {
+ if c.FileName != "" {
ch := make(chan *GrpcResponse)
server.GrpcReqCh <- &GrpcRequest{
RequestType: REQ_MOD_MRT,
Data: &api.ModMrtArguments{
Operation: api.Operation_ADD,
- Filename: g.Mrt.FileName,
+ Filename: c.FileName,
},
ResponseCh: ch,
}
@@ -1127,33 +1156,9 @@ func (server *BgpServer) SetGlobalType(g config.Global) error {
return err
}
}
- for _, s := range g.BmpServers {
- ch := make(chan *GrpcResponse)
- server.GrpcReqCh <- &GrpcRequest{
- RequestType: REQ_MOD_BMP,
- Data: &s.Config,
- ResponseCh: ch,
- }
- if err := (<-ch).Err(); err != nil {
- return err
- }
- }
-
- if g.Zebra.Enabled {
- cli, err := NewZclient(g.Zebra.Url, g.Zebra.RedistributeRouteTypeList)
- if err != nil {
- return err
- }
- server.zclient = cli
- server.zapiMsgCh = server.zclient.Receive()
- }
return nil
}
-func (server *BgpServer) SetRpkiConfig(c []config.RpkiServer) {
- server.rpkiConfigCh <- c
-}
-
func (server *BgpServer) PeerAdd(peer config.Neighbor) {
server.addedPeerCh <- peer
}