summaryrefslogtreecommitdiffhomepage
path: root/packet/validate_test.go
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-01-14 19:29:31 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-16 18:18:29 +0900
commit63908917a29f27e2edd0ad43fa25decf5164e038 (patch)
treef8ea351a5be48d23f253e40877e842f50d057e77 /packet/validate_test.go
parent2a1460623e90f461fe325fdb7c33cdd77ffe245b (diff)
packet: do mandatory attribute check only when NLRI exists
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet/validate_test.go')
-rw-r--r--packet/validate_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/packet/validate_test.go b/packet/validate_test.go
index 801c3868..90d05548 100644
--- a/packet/validate_test.go
+++ b/packet/validate_test.go
@@ -136,6 +136,17 @@ func Test_Validate_mandatory_missing(t *testing.T) {
assert.Equal(1, missing)
}
+func Test_Validate_mandatory_missing_nocheck(t *testing.T) {
+ assert := assert.New(t)
+ message := bgpupdate().Body.(*BGPUpdate)
+ message.PathAttributes = message.PathAttributes[1:]
+ message.NLRI = nil
+
+ res, err := ValidateUpdateMsg(message)
+ assert.Equal(true, res)
+ assert.NoError(err)
+}
+
func Test_Validate_invalid_origin(t *testing.T) {
assert := assert.New(t)
message := bgpupdate().Body.(*BGPUpdate)