summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-06-17 18:00:25 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-07-06 11:08:15 +0900
commit00e9610df02e3a9227a8a9324faed5fddfb7a87d (patch)
tree5b0b4717a9cef731c97fd157357dc869c6bac68c
parent51dad96b92fbd483d7674f8f8617cd2bf8ac965b (diff)
gobgp: replace table.TableInfo usage with api.TableInfo
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--client/client.go20
-rw-r--r--gobgp/cmd/neighbor.go2
2 files changed, 9 insertions, 13 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)
}
diff --git a/gobgp/cmd/neighbor.go b/gobgp/cmd/neighbor.go
index 25a3084b..32b1ec60 100644
--- a/gobgp/cmd/neighbor.go
+++ b/gobgp/cmd/neighbor.go
@@ -666,7 +666,7 @@ func showRibInfo(r, name string) error {
return err
}
- var info *table.TableInfo
+ var info *api.TableInfo
switch r {
case CMD_GLOBAL:
info, err = client.GetRIBInfo(family)