summaryrefslogtreecommitdiffhomepage
path: root/api/grpc_server.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r--api/grpc_server.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go
index 4d366482..6f082e26 100644
--- a/api/grpc_server.go
+++ b/api/grpc_server.go
@@ -1360,6 +1360,21 @@ func (s *Server) DeleteNeighbor(ctx context.Context, arg *DeleteNeighborRequest)
}})
}
+func (s *Server) UpdateNeighbor(ctx context.Context, arg *UpdateNeighborRequest) (*UpdateNeighborResponse, error) {
+ c, err := NewNeighborFromAPIStruct(arg.Peer)
+ if err != nil {
+ return nil, err
+ }
+ needsSoftResetIn, err := s.bgpServer.UpdateNeighbor(c)
+ if err != nil {
+ return nil, err
+ }
+ if arg.DoSoftResetIn && needsSoftResetIn {
+ return &UpdateNeighborResponse{NeedsSoftResetIn: false}, s.bgpServer.SoftResetIn("", bgp.RouteFamily(0))
+ }
+ return &UpdateNeighborResponse{NeedsSoftResetIn: needsSoftResetIn}, nil
+}
+
func NewPrefixFromApiStruct(a *Prefix) (*table.Prefix, error) {
_, prefix, err := net.ParseCIDR(a.IpPrefix)
if err != nil {