summaryrefslogtreecommitdiffhomepage
path: root/client/client.go
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2018-06-19 13:40:15 +0900
committerIWASE Yusuke <iwase.yusuke0@gmail.com>2018-06-19 13:41:53 +0900
commit267a23c19086a795eb0a35c1ae4ebe4237015ac0 (patch)
tree397e9e9adb9484ad3a3f8e3b6ba8b73b5f92b927 /client/client.go
parentb992c538652580cb4150524328dc2c3b13425863 (diff)
cli: Use api struct in VRF commands
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'client/client.go')
-rw-r--r--client/client.go28
1 files changed, 2 insertions, 26 deletions
diff --git a/client/client.go b/client/client.go
index 3bdef91d..05877198 100644
--- a/client/client.go
+++ b/client/client.go
@@ -461,36 +461,12 @@ func (cli *Client) DeletePathByFamily(family bgp.RouteFamily) error {
return cli.deletePath(nil, family, "", nil)
}
-func (cli *Client) GetVRF() ([]*table.Vrf, error) {
+func (cli *Client) GetVRF() ([]*api.Vrf, error) {
ret, err := cli.cli.GetVrf(context.Background(), &api.GetVrfRequest{})
if err != nil {
return nil, err
}
- var vrfs []*table.Vrf
-
- for _, vrf := range ret.Vrfs {
- rd, err := api.UnmarshalRD(vrf.Rd)
- if err != nil {
- return nil, err
- }
- importRT, err := api.UnmarshalRTs(vrf.ImportRt)
- if err != nil {
- return nil, err
- }
- exportRT, err := api.UnmarshalRTs(vrf.ExportRt)
- if err != nil {
- return nil, err
- }
- vrfs = append(vrfs, &table.Vrf{
- Name: vrf.Name,
- Id: vrf.Id,
- Rd: rd,
- ImportRt: importRT,
- ExportRt: exportRT,
- })
- }
-
- return vrfs, nil
+ return ret.Vrfs, nil
}
func (cli *Client) AddVRF(name string, id int, rd bgp.RouteDistinguisherInterface, im, ex []bgp.ExtendedCommunityInterface) error {