summaryrefslogtreecommitdiffhomepage
path: root/cmd/gobgpd
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-07-10 14:06:08 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-08 21:24:48 +0900
commit71e56c542e6a167dc3cd983aae2881a3c24c162a (patch)
treea449e3ed0889940fe47bb5f4ffca91228a4cc7e8 /cmd/gobgpd
parent3dc23d3075f13f2976afd255ef2fd9b1410acc77 (diff)
rpc cleanup
- clean up RPC function names - rewrite gobgp command to use the api instead of config package - delete unused client package Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'cmd/gobgpd')
-rw-r--r--cmd/gobgpd/main.go27
1 files changed, 11 insertions, 16 deletions
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go
index 31af0f67..146facad 100644
--- a/cmd/gobgpd/main.go
+++ b/cmd/gobgpd/main.go
@@ -175,7 +175,7 @@ func main() {
for {
select {
case <-sigCh:
- apiServer.Shutdown(context.Background(), &api.ShutdownRequest{})
+ apiServer.StopBgp(context.Background(), &api.StopBgpRequest{})
return
case newConfig := <-configCh:
var added, deleted, updated []config.Neighbor
@@ -184,7 +184,7 @@ func main() {
if c == nil {
c = newConfig
- if _, err := apiServer.StartServer(context.Background(), &api.StartServerRequest{
+ if _, err := apiServer.StartBgp(context.Background(), &api.StartBgpRequest{
Global: server.NewGlobalFromConfigStruct(&c.Global),
}); err != nil {
log.Fatalf("failed to set global config: %s", err)
@@ -208,13 +208,7 @@ func main() {
}
if len(newConfig.Collector.Config.Url) > 0 {
- if _, err := apiServer.AddCollector(context.Background(), &api.AddCollectorRequest{
- Url: c.Collector.Config.Url,
- DbName: c.Collector.Config.DbName,
- TableDumpInterval: c.Collector.Config.TableDumpInterval,
- }); err != nil {
- log.Fatalf("failed to set collector config: %s", err)
- }
+ log.Fatal("collector feature is not supported")
}
for _, c := range newConfig.RpkiServers {
@@ -374,7 +368,7 @@ func main() {
for _, pg := range deletedPg {
log.Infof("PeerGroup %s is deleted", pg.Config.PeerGroupName)
if _, err := apiServer.DeletePeerGroup(context.Background(), &api.DeletePeerGroupRequest{
- PeerGroup: server.NewPeerGroupFromConfigStruct(&pg),
+ Name: pg.Config.PeerGroupName,
}); err != nil {
log.Warn(err)
}
@@ -410,7 +404,7 @@ func main() {
}
for _, p := range added {
log.Infof("Peer %v is added", p.State.NeighborAddress)
- if _, err := apiServer.AddNeighbor(context.Background(), &api.AddNeighborRequest{
+ if _, err := apiServer.AddPeer(context.Background(), &api.AddPeerRequest{
Peer: server.NewPeerFromConfigStruct(&p),
}); err != nil {
log.Warn(err)
@@ -418,15 +412,15 @@ func main() {
}
for _, p := range deleted {
log.Infof("Peer %v is deleted", p.State.NeighborAddress)
- if _, err := apiServer.DeleteNeighbor(context.Background(), &api.DeleteNeighborRequest{
- Peer: server.NewPeerFromConfigStruct(&p),
+ if _, err := apiServer.DeletePeer(context.Background(), &api.DeletePeerRequest{
+ Address: p.State.NeighborAddress,
}); err != nil {
log.Warn(err)
}
}
for _, p := range updated {
log.Infof("Peer %v is updated", p.State.NeighborAddress)
- if u, err := apiServer.UpdateNeighbor(context.Background(), &api.UpdateNeighborRequest{
+ if u, err := apiServer.UpdatePeer(context.Background(), &api.UpdatePeerRequest{
Peer: server.NewPeerFromConfigStruct(&p),
}); err != nil {
log.Warn(err)
@@ -436,9 +430,10 @@ func main() {
}
if updatePolicy {
- if _, err := apiServer.SoftResetNeighbor(context.Background(), &api.SoftResetNeighborRequest{
+ if _, err := apiServer.ResetPeer(context.Background(), &api.ResetPeerRequest{
Address: "",
- Direction: api.SoftResetNeighborRequest_IN,
+ Direction: api.ResetPeerRequest_IN,
+ Soft: true,
}); err != nil {
log.Warn(err)
}