summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-08-05 15:48:25 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-08-05 17:25:12 +0900
commit0b5bb073128b3000f383927a997d4a40d274f569 (patch)
tree27dfee4b4f436857e91ff549635e8ced5ff61c25 /server
parent0d14f7dca2f77f661e4baaaa9d85ff3d0967fe34 (diff)
fix policy dynamic update
handle dynamic policy peer binding Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go
index 78a15da9..46184697 100644
--- a/server/server.go
+++ b/server/server.go
@@ -73,6 +73,7 @@ type BgpServer struct {
globalTypeCh chan config.Global
addedPeerCh chan config.Neighbor
deletedPeerCh chan config.Neighbor
+ updatedPeerCh chan config.Neighbor
GrpcReqCh chan *GrpcRequest
listenPort int
policyUpdateCh chan config.RoutingPolicy
@@ -91,6 +92,7 @@ func NewBgpServer(port int, roaURL string) *BgpServer {
b.globalTypeCh = make(chan config.Global)
b.addedPeerCh = make(chan config.Neighbor)
b.deletedPeerCh = make(chan config.Neighbor)
+ b.updatedPeerCh = make(chan config.Neighbor)
b.GrpcReqCh = make(chan *GrpcRequest, 1)
b.policyUpdateCh = make(chan config.RoutingPolicy)
b.localRibMap = make(map[string]*LocalRib)
@@ -300,6 +302,15 @@ func (server *BgpServer) Serve() {
} else {
log.Info("Can't delete a peer configuration for ", addr)
}
+ case config := <-server.updatedPeerCh:
+ addr := config.NeighborConfig.NeighborAddress.String()
+ peer := server.neighborMap[addr]
+ if peer.conf.RouteServer.RouteServerClient == true {
+ peer.conf.ApplyPolicy = config.ApplyPolicy
+ loc := server.localRibMap[addr]
+ loc.setPolicy(peer, server.policyMap)
+ peer.setDistributePolicy(server.policyMap)
+ }
case e := <-incoming:
peer, found := server.neighborMap[e.MsgSrc]
if !found {
@@ -695,6 +706,10 @@ func (server *BgpServer) PeerDelete(peer config.Neighbor) {
server.deletedPeerCh <- peer
}
+func (server *BgpServer) PeerUpdate(peer config.Neighbor) {
+ server.updatedPeerCh <- peer
+}
+
func (server *BgpServer) UpdatePolicy(policy config.RoutingPolicy) {
server.policyUpdateCh <- policy
}