From e4031c14a5060c4fadf7e3c655bd0f6d7714b634 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 6 Jul 2018 15:49:35 +0900 Subject: api: decrease the dependency move grpc_server.go to server/ Signed-off-by: FUJITA Tomonori --- client/client.go | 11 ++++++----- client/client_test.go | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'client') 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("") -- cgit v1.2.3