From 51f1c2b644e8fac485db45b571520b31a6cb0da0 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Fri, 19 Jun 2015 02:36:04 +0900 Subject: packet: store path attr flag as type BGPAttrFlag also add more meaningful debug message to ValidateFlags() Signed-off-by: ISHIDA Wataru --- packet/validate_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'packet/validate_test.go') 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) -- cgit v1.2.3