diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-06-17 18:00:25 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-07-06 11:08:15 +0900 |
commit | 00e9610df02e3a9227a8a9324faed5fddfb7a87d (patch) | |
tree | 5b0b4717a9cef731c97fd157357dc869c6bac68c /client/client.go | |
parent | 51dad96b92fbd483d7674f8f8617cd2bf8ac965b (diff) |
gobgp: replace table.TableInfo usage with api.TableInfo
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'client/client.go')
-rw-r--r-- | client/client.go | 20 |
1 files changed, 8 insertions, 12 deletions
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) } |