summaryrefslogtreecommitdiffhomepage
path: root/gobgpd
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2018-06-05 14:18:49 +0900
committerSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2018-06-13 13:57:04 +0900
commit000589f3cfa62d1cc62a84e3ce3723fc5b306144 (patch)
tree8675ce845282fad5ada375700e331221ea7930ef /gobgpd
parentc821cfbc8e04bb05bf0e300e52693b5085e1bfef (diff)
api: Implement UpdatePolicy()
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'gobgpd')
-rw-r--r--gobgpd/main.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go
index ec414d1d..e8f15f10 100644
--- a/gobgpd/main.go
+++ b/gobgpd/main.go
@@ -266,8 +266,14 @@ func main() {
}
}
p := config.ConfigSetToRoutingPolicy(newConfig)
- if err := bgpServer.UpdatePolicy(*p); err != nil {
- log.Fatalf("failed to set routing policy: %s", err)
+ rp, err := api.NewAPIRoutingPolicyFromConfigStruct(p)
+ if err != nil {
+ log.Warn(err)
+ } else {
+ apiServer.UpdatePolicy(context.Background(), &api.UpdatePolicyRequest{
+ Sets: rp.DefinedSet,
+ Policies: rp.PolicyDefinition,
+ })
}
added = newConfig.Neighbors
@@ -288,7 +294,15 @@ func main() {
if updatePolicy {
log.Info("Policy config is updated")
p := config.ConfigSetToRoutingPolicy(newConfig)
- bgpServer.UpdatePolicy(*p)
+ rp, err := api.NewAPIRoutingPolicyFromConfigStruct(p)
+ if err != nil {
+ log.Warn(err)
+ } else {
+ apiServer.UpdatePolicy(context.Background(), &api.UpdatePolicyRequest{
+ Sets: rp.DefinedSet,
+ Policies: rp.PolicyDefinition,
+ })
+ }
}
// global policy update
if !newConfig.Global.ApplyPolicy.Config.Equal(&c.Global.ApplyPolicy.Config) {