summaryrefslogtreecommitdiffhomepage
path: root/table/message_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/message_test.go')
-rw-r--r--table/message_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/table/message_test.go b/table/message_test.go
index 229ff5de..739abadd 100644
--- a/table/message_test.go
+++ b/table/message_test.go
@@ -458,3 +458,30 @@ func TestMixedMPReachMPUnreach(t *testing.T) {
attrs = msgs[1].Body.(*bgp.BGPUpdate).PathAttributes
assert.Equal(t, len(attrs), 1)
}
+
+func TestMixedNLRIAndMPUnreach(t *testing.T) {
+ aspath1 := []bgp.AsPathParamInterface{
+ bgp.NewAs4PathParam(2, []uint32{100}),
+ }
+ nlri1 := []*bgp.IPAddrPrefix{bgp.NewIPAddrPrefix(24, "10.0.0.0")}
+ nlri2 := []bgp.AddrPrefixInterface{bgp.NewIPv6AddrPrefix(32, "1111::")}
+
+ p := []bgp.PathAttributeInterface{
+ bgp.NewPathAttributeOrigin(0),
+ bgp.NewPathAttributeAsPath(aspath1),
+ bgp.NewPathAttributeNextHop("1.1.1.1"),
+ bgp.NewPathAttributeMpUnreachNLRI(nlri2),
+ }
+ msg := bgp.NewBGPUpdateMessage(nil, p, nlri1)
+ 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), 1)
+ attrs = msgs[1].Body.(*bgp.BGPUpdate).PathAttributes
+ assert.Equal(t, len(attrs), 3)
+}