summaryrefslogtreecommitdiffhomepage
path: root/packet/validate_test.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-06-19 02:36:04 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-06-20 13:28:45 +0900
commit51f1c2b644e8fac485db45b571520b31a6cb0da0 (patch)
treee16b53e86495d54ebfebcd40ca01012458b5a119 /packet/validate_test.go
parentcaeea100653522090d36ece22e80a945d59742fd (diff)
packet: store path attr flag as type BGPAttrFlag
also add more meaningful debug message to ValidateFlags() Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet/validate_test.go')
-rw-r--r--packet/validate_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/packet/validate_test.go b/packet/validate_test.go
index d7a22465..311ae031 100644
--- a/packet/validate_test.go
+++ b/packet/validate_test.go
@@ -146,7 +146,7 @@ func Test_Validate_duplicate_attribute(t *testing.T) {
assert := assert.New(t)
message := bgpupdate().Body.(*BGPUpdate)
// duplicate origin path attribute
- originBytes := []byte{pathAttrFlags[BGP_ATTR_TYPE_ORIGIN], 1, 1, 1}
+ originBytes := []byte{byte(pathAttrFlags[BGP_ATTR_TYPE_ORIGIN]), 1, 1, 1}
origin := &PathAttributeOrigin{}
origin.DecodeFromBytes(originBytes)
message.PathAttributes = append(message.PathAttributes, origin)
@@ -189,7 +189,7 @@ func Test_Validate_invalid_origin(t *testing.T) {
assert := assert.New(t)
message := bgpupdate().Body.(*BGPUpdate)
// origin needs to be well-known
- originBytes := []byte{pathAttrFlags[BGP_ATTR_TYPE_ORIGIN], 1, 1, 5}
+ originBytes := []byte{byte(pathAttrFlags[BGP_ATTR_TYPE_ORIGIN]), 1, 1, 5}
origin := &PathAttributeOrigin{}
origin.DecodeFromBytes(originBytes)
message.PathAttributes[0] = origin
@@ -209,7 +209,7 @@ func Test_Validate_invalid_nexthop_zero(t *testing.T) {
// invalid nexthop
addr := net.ParseIP("0.0.0.1").To4()
- nexthopBytes := []byte{pathAttrFlags[BGP_ATTR_TYPE_NEXT_HOP], 3, 4}
+ nexthopBytes := []byte{byte(pathAttrFlags[BGP_ATTR_TYPE_NEXT_HOP]), 3, 4}
nexthopBytes = append(nexthopBytes, addr...)
nexthop := &PathAttributeNextHop{}
nexthop.DecodeFromBytes(nexthopBytes)
@@ -230,7 +230,7 @@ func Test_Validate_invalid_nexthop_lo(t *testing.T) {
// invalid nexthop
addr := net.ParseIP("127.0.0.1").To4()
- nexthopBytes := []byte{pathAttrFlags[BGP_ATTR_TYPE_NEXT_HOP], 3, 4}
+ nexthopBytes := []byte{byte(pathAttrFlags[BGP_ATTR_TYPE_NEXT_HOP]), 3, 4}
nexthopBytes = append(nexthopBytes, addr...)
nexthop := &PathAttributeNextHop{}
nexthop.DecodeFromBytes(nexthopBytes)
@@ -251,7 +251,7 @@ func Test_Validate_invalid_nexthop_de(t *testing.T) {
// invalid nexthop
addr := net.ParseIP("224.0.0.1").To4()
- nexthopBytes := []byte{pathAttrFlags[BGP_ATTR_TYPE_NEXT_HOP], 3, 4}
+ nexthopBytes := []byte{byte(pathAttrFlags[BGP_ATTR_TYPE_NEXT_HOP]), 3, 4}
nexthopBytes = append(nexthopBytes, addr...)
nexthop := &PathAttributeNextHop{}
nexthop.DecodeFromBytes(nexthopBytes)