From 00e9610df02e3a9227a8a9324faed5fddfb7a87d Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Sun, 17 Jun 2018 18:00:25 +0900 Subject: gobgp: replace table.TableInfo usage with api.TableInfo Signed-off-by: FUJITA Tomonori --- client/client.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'client') diff --git a/client/client.go b/client/client.go index c733e592..04f148c0 100644 --- a/client/client.go +++ b/client/client.go @@ -304,8 +304,8 @@ func (cli *Client) GetVRFRIB(name string, family bgp.RouteFamily, prefixes []*ap return cli.getRIB(api.Resource_VRF, name, family, prefixes) } -func (cli *Client) getRIBInfo(resource api.Resource, name string, family bgp.RouteFamily) (*table.TableInfo, error) { - res, err := cli.cli.GetRibInfo(context.Background(), &api.GetRibInfoRequest{ +func (cli *Client) getRIBInfo(resource api.Resource, name string, family bgp.RouteFamily) (*api.TableInfo, error) { + r, err := cli.cli.GetRibInfo(context.Background(), &api.GetRibInfoRequest{ Info: &api.TableInfo{ Type: resource, Name: name, @@ -314,28 +314,24 @@ func (cli *Client) getRIBInfo(resource api.Resource, name string, family bgp.Rou }) if err != nil { return nil, err + } else { + return r.Info, nil } - return &table.TableInfo{ - NumDestination: int(res.Info.NumDestination), - NumPath: int(res.Info.NumPath), - NumAccepted: int(res.Info.NumAccepted), - }, nil - } -func (cli *Client) GetRIBInfo(family bgp.RouteFamily) (*table.TableInfo, error) { +func (cli *Client) GetRIBInfo(family bgp.RouteFamily) (*api.TableInfo, error) { return cli.getRIBInfo(api.Resource_GLOBAL, "", family) } -func (cli *Client) GetLocalRIBInfo(name string, family bgp.RouteFamily) (*table.TableInfo, error) { +func (cli *Client) GetLocalRIBInfo(name string, family bgp.RouteFamily) (*api.TableInfo, error) { return cli.getRIBInfo(api.Resource_LOCAL, name, family) } -func (cli *Client) GetAdjRIBInInfo(name string, family bgp.RouteFamily) (*table.TableInfo, error) { +func (cli *Client) GetAdjRIBInInfo(name string, family bgp.RouteFamily) (*api.TableInfo, error) { return cli.getRIBInfo(api.Resource_ADJ_IN, name, family) } -func (cli *Client) GetAdjRIBOutInfo(name string, family bgp.RouteFamily) (*table.TableInfo, error) { +func (cli *Client) GetAdjRIBOutInfo(name string, family bgp.RouteFamily) (*api.TableInfo, error) { return cli.getRIBInfo(api.Resource_ADJ_OUT, name, family) } -- cgit v1.2.3