diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-06-17 22:25:44 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-07-06 11:08:15 +0900 |
commit | cc92e7e3476f416b533de3f1a68de71c5af476c5 (patch) | |
tree | 48ae3d75fa92f33cb54c102c0b03dabb4086b8e3 /client/client.go | |
parent | 00e9610df02e3a9227a8a9324faed5fddfb7a87d (diff) |
gobgp: fix client.AddPath to use api.Path instead of table.Path
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'client/client.go')
-rw-r--r-- | client/client.go | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/client/client.go b/client/client.go index 04f148c0..c62310a3 100644 --- a/client/client.go +++ b/client/client.go @@ -339,14 +339,10 @@ type AddPathByStreamClient struct { stream api.GobgpApi_InjectMrtClient } -func (c *AddPathByStreamClient) Send(paths ...*table.Path) error { - ps := make([]*api.Path, 0, len(paths)) - for _, p := range paths { - ps = append(ps, api.ToPathApiInBin(p, nil)) - } +func (c *AddPathByStreamClient) Send(paths ...*api.Path) error { return c.stream.Send(&api.InjectMrtRequest{ Resource: api.Resource_GLOBAL, - Paths: ps, + Paths: paths, }) } @@ -363,7 +359,7 @@ func (cli *Client) AddPathByStream() (*AddPathByStreamClient, error) { return &AddPathByStreamClient{stream}, nil } -func (cli *Client) addPath(vrfID string, pathList []*table.Path) ([]byte, error) { +func (cli *Client) addPath(vrfID string, pathList []*api.Path) ([]byte, error) { resource := api.Resource_GLOBAL if vrfID != "" { resource = api.Resource_VRF @@ -373,7 +369,7 @@ func (cli *Client) addPath(vrfID string, pathList []*table.Path) ([]byte, error) r, err := cli.cli.AddPath(context.Background(), &api.AddPathRequest{ Resource: resource, VrfId: vrfID, - Path: api.ToPathApi(path, nil), + Path: path, }) if err != nil { return nil, err @@ -383,18 +379,18 @@ func (cli *Client) addPath(vrfID string, pathList []*table.Path) ([]byte, error) return uuid, nil } -func (cli *Client) AddPath(pathList []*table.Path) ([]byte, error) { +func (cli *Client) AddPath(pathList []*api.Path) ([]byte, error) { return cli.addPath("", pathList) } -func (cli *Client) AddVRFPath(vrfID string, pathList []*table.Path) ([]byte, error) { +func (cli *Client) AddVRFPath(vrfID string, pathList []*api.Path) ([]byte, error) { if vrfID == "" { return nil, fmt.Errorf("VRF ID is empty") } return cli.addPath(vrfID, pathList) } -func (cli *Client) deletePath(uuid []byte, f bgp.RouteFamily, vrfID string, pathList []*table.Path) error { +func (cli *Client) deletePath(uuid []byte, f bgp.RouteFamily, vrfID string, pathList []*api.Path) error { var reqs []*api.DeletePathRequest resource := api.Resource_GLOBAL @@ -407,7 +403,7 @@ func (cli *Client) deletePath(uuid []byte, f bgp.RouteFamily, vrfID string, path reqs = append(reqs, &api.DeletePathRequest{ Resource: resource, VrfId: vrfID, - Path: api.ToPathApi(path, nil), + Path: path, }) } default: @@ -427,11 +423,11 @@ func (cli *Client) deletePath(uuid []byte, f bgp.RouteFamily, vrfID string, path return nil } -func (cli *Client) DeletePath(pathList []*table.Path) error { +func (cli *Client) DeletePath(pathList []*api.Path) error { return cli.deletePath(nil, bgp.RouteFamily(0), "", pathList) } -func (cli *Client) DeleteVRFPath(vrfID string, pathList []*table.Path) error { +func (cli *Client) DeleteVRFPath(vrfID string, pathList []*api.Path) error { if vrfID == "" { return fmt.Errorf("VRF ID is empty") } |