summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
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
}