summaryrefslogtreecommitdiffhomepage
path: root/table/table_manager_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/table_manager_test.go')
-rw-r--r--table/table_manager_test.go228
1 files changed, 120 insertions, 108 deletions
diff --git a/table/table_manager_test.go b/table/table_manager_test.go
index fecee20a..5d3ed1b8 100644
--- a/table/table_manager_test.go
+++ b/table/table_manager_test.go
@@ -71,9 +71,9 @@ func TestProcessBGPUpdate_0_select_onlypath_ipv4(t *testing.T) {
bgpMessage := update_fromR1()
peer := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer, bgpMessage)
+ pList, err := tm.ProcessUpdate(peer, bgpMessage)
assert.Equal(t, len(pList), 1)
- assert.Equal(t, len(wList), 0)
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -122,9 +122,9 @@ func TestProcessBGPUpdate_0_select_onlypath_ipv6(t *testing.T) {
bgpMessage := update_fromR1_ipv6()
peer := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer, bgpMessage)
+ pList, err := tm.ProcessUpdate(peer, bgpMessage)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -202,15 +202,15 @@ func TestProcessBGPUpdate_1_select_high_localpref_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -288,15 +288,15 @@ func TestProcessBGPUpdate_1_select_high_localpref_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -374,17 +374,17 @@ func TestProcessBGPUpdate_2_select_local_origin_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
var peer2 *PeerInfo = &PeerInfo{
Address: net.ParseIP("0.0.0.0"),
}
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -462,18 +462,18 @@ func TestProcessBGPUpdate_2_select_local_origin_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
var peer2 *PeerInfo = &PeerInfo{
Address: net.ParseIP("0.0.0.0"),
}
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -524,15 +524,15 @@ func TestProcessBGPUpdate_3_select_aspath_ipv4(t *testing.T) {
bgpMessage1 := update_fromR2viaR1()
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
bgpMessage2 := update_fromR2()
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -581,15 +581,15 @@ func TestProcessBGPUpdate_3_select_aspath_ipv6(t *testing.T) {
bgpMessage1 := update_fromR2viaR1_ipv6()
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
bgpMessage2 := update_fromR2_ipv6()
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -667,15 +667,15 @@ func TestProcessBGPUpdate_4_select_low_origin_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -753,15 +753,15 @@ func TestProcessBGPUpdate_4_select_low_origin_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -839,15 +839,15 @@ func TestProcessBGPUpdate_5_select_low_med_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -925,15 +925,15 @@ func TestProcessBGPUpdate_5_select_low_med_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1013,15 +1013,15 @@ func TestProcessBGPUpdate_6_select_ebgp_path_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1100,15 +1100,15 @@ func TestProcessBGPUpdate_6_select_ebgp_path_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1190,15 +1190,15 @@ func TestProcessBGPUpdate_7_select_low_routerid_path_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer3 := peerR3()
- pList, wList, err = tm.ProcessUpdate(peer3, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer3, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1277,15 +1277,15 @@ func TestProcessBGPUpdate_7_select_low_routerid_path_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer3 := peerR3()
- pList, wList, err = tm.ProcessUpdate(peer3, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer3, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1364,15 +1364,15 @@ func TestProcessBGPUpdate_8_withdraw_path_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1419,9 +1419,9 @@ func TestProcessBGPUpdate_8_withdraw_path_ipv4(t *testing.T) {
w := []bgp.WithdrawnRoute{w1}
bgpMessage3 := bgp.NewBGPUpdateMessage(w, []bgp.PathAttributeInterface{}, []bgp.NLRInfo{})
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage3)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage3)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
path = pList[0]
@@ -1474,15 +1474,15 @@ func TestProcessBGPUpdate_8_mpunreach_path_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
peer2 := peerR2()
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1554,9 +1554,9 @@ func TestProcessBGPUpdate_8_mpunreach_path_ipv6(t *testing.T) {
bgpMessage3 := bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{},
[]bgp.PathAttributeInterface{mp_unreach}, []bgp.NLRInfo{})
- pList, wList, err = tm.ProcessUpdate(peer2, bgpMessage3)
+ pList, err = tm.ProcessUpdate(peer2, bgpMessage3)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
path = pList[0]
@@ -1599,18 +1599,18 @@ func TestProcessBGPUpdate_bestpath_lost_ipv4(t *testing.T) {
bgpMessage1_w := bgp.NewBGPUpdateMessage(w, []bgp.PathAttributeInterface{}, []bgp.NLRInfo{})
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage1_w)
- assert.Equal(t, 0, len(pList))
- assert.Equal(t, 1, len(wList))
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage1_w)
+ assert.Equal(t, 1, len(pList))
+ assert.Equal(t, pList[0].IsWithdraw(), true)
assert.NoError(t, err)
// check old best path
- path := wList[0]
+ path := pList[0]
expectedType := "*table.IPv4Path"
assert.Equal(t, reflect.TypeOf(path).String(), expectedType)
@@ -1668,9 +1668,9 @@ func TestProcessBGPUpdate_bestpath_lost_ipv6(t *testing.T) {
bgpMessage1 := bgp.NewBGPUpdateMessage(withdrawnRoutes1, pathAttributes1, nlri1)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// path1 mpunreach
@@ -1678,13 +1678,13 @@ func TestProcessBGPUpdate_bestpath_lost_ipv6(t *testing.T) {
bgpMessage1_w := bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{},
[]bgp.PathAttributeInterface{mp_unreach}, []bgp.NLRInfo{})
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage1_w)
- assert.Equal(t, 0, len(pList))
- assert.Equal(t, 1, len(wList))
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage1_w)
+ assert.Equal(t, 1, len(pList))
+ assert.Equal(t, pList[0].IsWithdraw(), true)
assert.NoError(t, err)
// check old best path
- path := wList[0]
+ path := pList[0]
expectedType := "*table.IPv6Path"
assert.Equal(t, reflect.TypeOf(path).String(), expectedType)
@@ -1758,14 +1758,14 @@ func TestProcessBGPUpdate_implicit_withdrwal_ipv4(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -1845,14 +1845,14 @@ func TestProcessBGPUpdate_implicit_withdrwal_ipv6(t *testing.T) {
bgpMessage2 := bgp.NewBGPUpdateMessage(withdrawnRoutes2, pathAttributes2, nlri2)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage2)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check type
@@ -2013,9 +2013,11 @@ func TestProcessBGPUpdate_multiple_nlri_ipv4(t *testing.T) {
bgpMessage4 := bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, pathAttributes4, nlri4)
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 5, len(pList))
- assert.Equal(t, 0, len(wList))
+ for _, p := range pList {
+ assert.Equal(t, p.IsWithdraw(), false)
+ }
assert.NoError(t, err)
checkBestPathResult("*table.IPv4Path", "10.10.10.0/24", "192.168.50.1", pList[0], bgpMessage1)
@@ -2024,9 +2026,11 @@ func TestProcessBGPUpdate_multiple_nlri_ipv4(t *testing.T) {
checkBestPathResult("*table.IPv4Path", "40.40.40.0/24", "192.168.50.1", pList[3], bgpMessage1)
checkBestPathResult("*table.IPv4Path", "50.50.50.0/24", "192.168.50.1", pList[4], bgpMessage1)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage2)
assert.Equal(t, 5, len(pList))
- assert.Equal(t, 0, len(wList))
+ for _, p := range pList {
+ assert.Equal(t, p.IsWithdraw(), false)
+ }
assert.NoError(t, err)
checkBestPathResult("*table.IPv4Path", "11.11.11.0/24", "192.168.50.1", pList[0], bgpMessage2)
@@ -2035,14 +2039,16 @@ func TestProcessBGPUpdate_multiple_nlri_ipv4(t *testing.T) {
checkBestPathResult("*table.IPv4Path", "44.44.44.0/24", "192.168.50.1", pList[3], bgpMessage2)
checkBestPathResult("*table.IPv4Path", "55.55.55.0/24", "192.168.50.1", pList[4], bgpMessage2)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage3)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage3)
assert.Equal(t, 2, len(pList))
- assert.Equal(t, 0, len(wList))
+ for _, p := range pList {
+ assert.Equal(t, p.IsWithdraw(), false)
+ }
assert.NoError(t, err)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage4)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage4)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check table
@@ -2154,9 +2160,11 @@ func TestProcessBGPUpdate_multiple_nlri_ipv6(t *testing.T) {
bgpMessage4 := bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, pathAttributes4, []bgp.NLRInfo{})
peer1 := peerR1()
- pList, wList, err := tm.ProcessUpdate(peer1, bgpMessage1)
+ pList, err := tm.ProcessUpdate(peer1, bgpMessage1)
assert.Equal(t, 5, len(pList))
- assert.Equal(t, 0, len(wList))
+ for _, p := range pList {
+ assert.Equal(t, p.IsWithdraw(), false)
+ }
assert.NoError(t, err)
checkBestPathResult("*table.IPv6Path", "2001:123:1210:11::/64", "2001::192:168:50:1", pList[0], bgpMessage1)
@@ -2165,9 +2173,11 @@ func TestProcessBGPUpdate_multiple_nlri_ipv6(t *testing.T) {
checkBestPathResult("*table.IPv6Path", "2001:123:1240:11::/64", "2001::192:168:50:1", pList[3], bgpMessage1)
checkBestPathResult("*table.IPv6Path", "2001:123:1250:11::/64", "2001::192:168:50:1", pList[4], bgpMessage1)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage2)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage2)
assert.Equal(t, 5, len(pList))
- assert.Equal(t, 0, len(wList))
+ for _, p := range pList {
+ assert.Equal(t, p.IsWithdraw(), false)
+ }
assert.NoError(t, err)
checkBestPathResult("*table.IPv6Path", "2001:123:1211:11::/64", "2001::192:168:50:1", pList[0], bgpMessage2)
@@ -2176,14 +2186,16 @@ func TestProcessBGPUpdate_multiple_nlri_ipv6(t *testing.T) {
checkBestPathResult("*table.IPv6Path", "2001:123:1244:11::/64", "2001::192:168:50:1", pList[3], bgpMessage2)
checkBestPathResult("*table.IPv6Path", "2001:123:1255:11::/64", "2001::192:168:50:1", pList[4], bgpMessage2)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage3)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage3)
assert.Equal(t, 2, len(pList))
- assert.Equal(t, 0, len(wList))
+ for _, p := range pList {
+ assert.Equal(t, p.IsWithdraw(), false)
+ }
assert.NoError(t, err)
- pList, wList, err = tm.ProcessUpdate(peer1, bgpMessage4)
+ pList, err = tm.ProcessUpdate(peer1, bgpMessage4)
assert.Equal(t, 1, len(pList))
- assert.Equal(t, 0, len(wList))
+ assert.Equal(t, pList[0].IsWithdraw(), false)
assert.NoError(t, err)
// check table