summaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-07-06 15:49:35 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-07-06 23:56:54 +0900
commite4031c14a5060c4fadf7e3c655bd0f6d7714b634 (patch)
tree101986ba40d8cd3a5e2cfa8471bbc41b8bada765 /client
parent69f866a77cb83db8925fb95fb55d6086fbfe899c (diff)
api: decrease the dependency
move grpc_server.go to server/ Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'client')
-rw-r--r--client/client.go11
-rw-r--r--client/client_test.go3
2 files changed, 7 insertions, 7 deletions
diff --git a/client/client.go b/client/client.go
index 3e1cd235..d159ffed 100644
--- a/client/client.go
+++ b/client/client.go
@@ -29,6 +29,7 @@ import (
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/packet/bgp"
+ "github.com/osrg/gobgp/server"
)
type Client struct {
@@ -149,7 +150,7 @@ func (cli *Client) getNeighbor(name string, afi int, vrf string, enableAdvertise
continue
}
}
- n, err := api.NewNeighborFromAPIStruct(p)
+ n, err := server.NewNeighborFromAPIStruct(p)
if err != nil {
return nil, err
}
@@ -186,19 +187,19 @@ func (cli *Client) GetNeighbor(name string, options ...bool) (*config.Neighbor,
}
func (cli *Client) AddNeighbor(c *config.Neighbor) error {
- peer := api.NewPeerFromConfigStruct(c)
+ peer := server.NewPeerFromConfigStruct(c)
_, err := cli.cli.AddNeighbor(context.Background(), &api.AddNeighborRequest{Peer: peer})
return err
}
func (cli *Client) DeleteNeighbor(c *config.Neighbor) error {
- peer := api.NewPeerFromConfigStruct(c)
+ peer := server.NewPeerFromConfigStruct(c)
_, err := cli.cli.DeleteNeighbor(context.Background(), &api.DeleteNeighborRequest{Peer: peer})
return err
}
func (cli *Client) UpdateNeighbor(c *config.Neighbor, doSoftResetIn bool) (bool, error) {
- peer := api.NewPeerFromConfigStruct(c)
+ peer := server.NewPeerFromConfigStruct(c)
response, err := cli.cli.UpdateNeighbor(context.Background(), &api.UpdateNeighborRequest{Peer: peer, DoSoftResetIn: doSoftResetIn})
return response.NeedsSoftResetIn, err
}
@@ -833,7 +834,7 @@ func (c *MonitorNeighborStateClient) Recv() (*config.Neighbor, error) {
if err != nil {
return nil, err
}
- return api.NewNeighborFromAPIStruct(p)
+ return server.NewNeighborFromAPIStruct(p)
}
func (cli *Client) MonitorNeighborState(name string, current bool) (*MonitorNeighborStateClient, error) {
diff --git a/client/client_test.go b/client/client_test.go
index 6bcf73b2..63f430fb 100644
--- a/client/client_test.go
+++ b/client/client_test.go
@@ -19,7 +19,6 @@ import (
"testing"
"time"
- api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/server"
"github.com/stretchr/testify/assert"
@@ -29,7 +28,7 @@ func TestGetNeighbor(test *testing.T) {
assert := assert.New(test)
s := server.NewBgpServer()
go s.Serve()
- g := api.NewGrpcServer(s, ":50051")
+ g := server.NewGrpcServer(s, ":50051")
go g.Serve()
time.Sleep(time.Second)
cli, err := New("")