diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2017-08-07 08:15:16 -0400 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-08-07 22:31:26 +0900 |
commit | 539642d28791789bc52a4d23acc30fac35691fc4 (patch) | |
tree | da5285d19e75af5e140c548ffe4a43d13c16325d /table/message_test.go | |
parent | aa2b1c2405b9f996d8bab02d95fd0f696ddbf953 (diff) |
table: fix handling of update with both mpunreach and mpreach attribute
some implementations send a mpunreach attribute piggy backed on an
update message. Since it is stored in pathattrs of gobgp's path structure,
we need to exclude it before sending out update messages.
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/message_test.go')
-rw-r--r-- | table/message_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/table/message_test.go b/table/message_test.go index 581c6aba..229ff5de 100644 --- a/table/message_test.go +++ b/table/message_test.go @@ -432,3 +432,29 @@ func TestBMP(t *testing.T) { pList := ProcessMessage(msg, peerR1(), time.Now()) CreateUpdateMsgFromPaths(pList) } + +func TestMixedMPReachMPUnreach(t *testing.T) { + aspath1 := []bgp.AsPathParamInterface{ + bgp.NewAs4PathParam(2, []uint32{100}), + } + nlri1 := []bgp.AddrPrefixInterface{bgp.NewIPv6AddrPrefix(32, "2222::")} + nlri2 := []bgp.AddrPrefixInterface{bgp.NewIPv6AddrPrefix(32, "1111::")} + + p := []bgp.PathAttributeInterface{ + bgp.NewPathAttributeOrigin(0), + bgp.NewPathAttributeAsPath(aspath1), + bgp.NewPathAttributeMpReachNLRI("1::1", nlri1), + bgp.NewPathAttributeMpUnreachNLRI(nlri2), + } + msg := bgp.NewBGPUpdateMessage(nil, p, nil) + pList := ProcessMessage(msg, peerR1(), time.Now()) + assert.Equal(t, len(pList), 2) + assert.Equal(t, pList[0].IsWithdraw, false) + assert.Equal(t, pList[1].IsWithdraw, true) + msgs := CreateUpdateMsgFromPaths(pList) + assert.Equal(t, len(msgs), 2) + attrs := msgs[0].Body.(*bgp.BGPUpdate).PathAttributes + assert.Equal(t, len(attrs), 3) + attrs = msgs[1].Body.(*bgp.BGPUpdate).PathAttributes + assert.Equal(t, len(attrs), 1) +} |