summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/zclient_test.go
diff options
context:
space:
mode:
authorHitoshi Irino <irino@sfc.wide.ad.jp>2018-08-17 19:41:32 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-18 10:41:20 +0900
commitedbedebf7b048034eeed4bc7f442432d15d549d8 (patch)
tree9ace882d6b57e1b458fe208cd7e7ef200853adce /pkg/server/zclient_test.go
parent75254037d47ca8a6cf86604d8371d5db5db8464d (diff)
ZAPI5 (FRRouting version 5) support
Diffstat (limited to 'pkg/server/zclient_test.go')
-rw-r--r--pkg/server/zclient_test.go46
1 files changed, 27 insertions, 19 deletions
diff --git a/pkg/server/zclient_test.go b/pkg/server/zclient_test.go
index c7868c0b..732b6d8b 100644
--- a/pkg/server/zclient_test.go
+++ b/pkg/server/zclient_test.go
@@ -38,23 +38,31 @@ func Test_newPathFromIPRouteMessage(t *testing.T) {
Command: zebra.IPV4_ROUTE_ADD,
}
b := &zebra.IPRouteBody{
- Type: zebra.ROUTE_TYPE(zebra.ROUTE_STATIC),
- Flags: zebra.FLAG(zebra.FLAG_SELECTED),
- Message: zebra.MESSAGE_NEXTHOP | zebra.MESSAGE_DISTANCE | zebra.MESSAGE_METRIC | zebra.MESSAGE_MTU,
- SAFI: zebra.SAFI(zebra.SAFI_UNICAST),
- Prefix: net.ParseIP("192.168.100.0"),
- PrefixLength: uint8(24),
- Nexthops: []net.IP{net.ParseIP("0.0.0.0")},
- Ifindexs: []uint32{1},
- Distance: uint8(0),
- Metric: uint32(100),
- Mtu: uint32(0),
- Api: zebra.API_TYPE(zebra.IPV4_ROUTE_ADD),
+ Type: zebra.ROUTE_TYPE(zebra.ROUTE_STATIC),
+ Flags: zebra.FLAG(zebra.FLAG_SELECTED),
+ Message: zebra.MESSAGE_NEXTHOP | zebra.MESSAGE_DISTANCE | zebra.MESSAGE_METRIC | zebra.MESSAGE_MTU,
+ SAFI: zebra.SAFI(zebra.SAFI_UNICAST),
+ Prefix: zebra.Prefix{
+ Prefix: net.ParseIP("192.168.100.0"),
+ PrefixLen: uint8(24),
+ },
+ Nexthops: []zebra.Nexthop{
+ {
+ Gate: net.ParseIP("0.0.0.0"),
+ },
+ {
+ Ifindex: uint32(1),
+ },
+ },
+ Distance: uint8(0),
+ Metric: uint32(100),
+ Mtu: uint32(0),
+ Api: zebra.API_TYPE(zebra.IPV4_ROUTE_ADD),
}
m.Header = *h
m.Body = b
- path := newPathFromIPRouteMessage(m)
+ path := newPathFromIPRouteMessage(m, 2)
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())
@@ -68,7 +76,7 @@ func Test_newPathFromIPRouteMessage(t *testing.T) {
m.Header = *h
m.Body = b
- path = newPathFromIPRouteMessage(m)
+ path = newPathFromIPRouteMessage(m, 2)
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())
@@ -81,13 +89,13 @@ func Test_newPathFromIPRouteMessage(t *testing.T) {
// IPv6 Route Add
h.Command = zebra.IPV6_ROUTE_ADD
b.Api = zebra.IPV6_ROUTE_ADD
- b.Prefix = net.ParseIP("2001:db8:0:f101::")
- b.PrefixLength = uint8(64)
- b.Nexthops = []net.IP{net.ParseIP("::")}
+ b.Prefix.Prefix = net.ParseIP("2001:db8:0:f101::")
+ b.Prefix.PrefixLen = uint8(64)
+ b.Nexthops = []zebra.Nexthop{{Gate: net.ParseIP("::")}}
m.Header = *h
m.Body = b
- path = newPathFromIPRouteMessage(m)
+ path = newPathFromIPRouteMessage(m, 2)
pp = table.NewPath(nil, path.GetNlri(), path.IsWithdraw, path.GetPathAttrs(), time.Now(), false)
pp.SetIsFromExternal(path.IsFromExternal())
assert.Equal("::", pp.GetNexthop().String())
@@ -103,7 +111,7 @@ func Test_newPathFromIPRouteMessage(t *testing.T) {
m.Header = *h
m.Body = b
- path = newPathFromIPRouteMessage(m)
+ path = newPathFromIPRouteMessage(m, 2)
pp = table.NewPath(nil, path.GetNlri(), path.IsWithdraw, path.GetPathAttrs(), time.Now(), false)
pp.SetIsFromExternal(path.IsFromExternal())
assert.Equal("::", pp.GetNexthop().String())