summaryrefslogtreecommitdiffhomepage
path: root/server/zclient_test.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-21 13:23:15 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-21 13:23:15 +0900
commit43dc07d72353fc8bcb79a18a5739ea0a90dda6bb (patch)
treedcd049f3e12c4b2caa156127a7262893c01d2a7c /server/zclient_test.go
parent300284ce4aff7a11bbd001da295be5464ecf58cc (diff)
move gRPC-related code for REQ_ADD_PATH and REQ_DELETE_PATH to grpc_server.go
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/zclient_test.go')
-rw-r--r--server/zclient_test.go45
1 files changed, 12 insertions, 33 deletions
diff --git a/server/zclient_test.go b/server/zclient_test.go
index 8067c53f..f4391b09 100644
--- a/server/zclient_test.go
+++ b/server/zclient_test.go
@@ -16,7 +16,6 @@
package server
import (
- "github.com/osrg/gobgp/gobgp/cmd"
"github.com/osrg/gobgp/table"
"github.com/osrg/gobgp/zebra"
"github.com/stretchr/testify/assert"
@@ -53,14 +52,9 @@ func Test_createRequestFromIPRouteMessage(t *testing.T) {
m.Header = *h
m.Body = b
- p := createRequestFromIPRouteMessage(m)
- assert.NotNil(p)
- paths, err := cmd.ApiStruct2Path(p.Path)
- assert.Nil(err)
- assert.Equal(len(paths), 1)
- path := paths[0]
- pp := table.NewPath(nil, path.Nlri, path.IsWithdraw, path.PathAttrs, time.Now(), false)
- pp.SetIsFromExternal(p.Path.IsFromExternal)
+ path := createPathFromIPRouteMessage(m)
+ pp := table.NewPath(nil, path.GetNlri(), path.IsWithdraw, path.GetPathAttrs(), time.Now(), false)
+ pp.SetIsFromExternal(path.IsFromExternal())
assert.Equal("0.0.0.0", pp.GetNexthop().String())
assert.Equal("192.168.100.0/24", pp.GetNlri().String())
assert.True(pp.IsFromExternal())
@@ -69,14 +63,9 @@ func Test_createRequestFromIPRouteMessage(t *testing.T) {
// withdraw
h.Command = zebra.IPV4_ROUTE_DELETE
m.Header = *h
- p = createRequestFromIPRouteMessage(m)
- assert.NotNil(p)
- paths, err = cmd.ApiStruct2Path(p.Path)
- assert.Nil(err)
- assert.Equal(len(paths), 1)
- path = paths[0]
- pp = table.NewPath(nil, path.Nlri, path.IsWithdraw, path.PathAttrs, time.Now(), false)
- pp.SetIsFromExternal(p.Path.IsFromExternal)
+ path = createPathFromIPRouteMessage(m)
+ pp = table.NewPath(nil, path.GetNlri(), path.IsWithdraw, path.GetPathAttrs(), time.Now(), false)
+ pp.SetIsFromExternal(path.IsFromExternal())
assert.Equal("0.0.0.0", pp.GetNexthop().String())
assert.Equal("192.168.100.0/24", pp.GetNlri().String())
med, _ := pp.GetMed()
@@ -92,14 +81,9 @@ func Test_createRequestFromIPRouteMessage(t *testing.T) {
m.Header = *h
m.Body = b
- p = createRequestFromIPRouteMessage(m)
- assert.NotNil(p)
- paths, err = cmd.ApiStruct2Path(p.Path)
- assert.Nil(err)
- assert.Equal(len(paths), 1)
- path = paths[0]
- pp = table.NewPath(nil, path.Nlri, path.IsWithdraw, path.PathAttrs, time.Now(), false)
- pp.SetIsFromExternal(p.Path.IsFromExternal)
+ path = createPathFromIPRouteMessage(m)
+ pp = table.NewPath(nil, path.GetNlri(), path.IsWithdraw, path.GetPathAttrs(), time.Now(), false)
+ pp.SetIsFromExternal(path.IsFromExternal())
assert.Equal("::", pp.GetNexthop().String())
assert.Equal("2001:db8:0:f101::/64", pp.GetNlri().String())
med, _ = pp.GetMed()
@@ -110,14 +94,9 @@ func Test_createRequestFromIPRouteMessage(t *testing.T) {
// withdraw
h.Command = zebra.IPV6_ROUTE_DELETE
m.Header = *h
- p = createRequestFromIPRouteMessage(m)
- assert.NotNil(p)
- paths, err = cmd.ApiStruct2Path(p.Path)
- assert.Nil(err)
- assert.Equal(len(paths), 1)
- path = paths[0]
- pp = table.NewPath(nil, path.Nlri, path.IsWithdraw, path.PathAttrs, time.Now(), false)
- pp.SetIsFromExternal(p.Path.IsFromExternal)
+ path = createPathFromIPRouteMessage(m)
+ pp = table.NewPath(nil, path.GetNlri(), path.IsWithdraw, path.GetPathAttrs(), time.Now(), false)
+ pp.SetIsFromExternal(path.IsFromExternal())
assert.Equal("::", pp.GetNexthop().String())
assert.Equal("2001:db8:0:f101::/64", pp.GetNlri().String())
assert.True(pp.IsFromExternal())