summaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-10-21 21:39:34 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-10-25 07:50:06 +0900
commita2a72e336c2cb5089620cda602c1cc08a3f08bdc (patch)
tree2e8f9a4557d52231e48decf0f1260fd9133f9e6a /internal
parent70bf80ac3afe8cbc25623c62855d34c6df0c9c72 (diff)
table: remove unnecessary code in UpdateAdjRibOut()
There is no duplication of local id in the rib. Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/pkg/table/adj.go23
-rw-r--r--internal/pkg/table/adj_test.go6
2 files changed, 4 insertions, 25 deletions
diff --git a/internal/pkg/table/adj.go b/internal/pkg/table/adj.go
index 9ae1e156..5dda2a29 100644
--- a/internal/pkg/table/adj.go
+++ b/internal/pkg/table/adj.go
@@ -101,28 +101,7 @@ func (adj *AdjRib) UpdateAdjRibOut(pathList []*Path) {
}
t := adj.table[path.GetRouteFamily()]
d := t.getOrCreateDest(path.GetNlri(), 0)
-
- var old *Path
- idx := -1
- for i, p := range d.knownPathList {
- if p.GetNlri().PathLocalIdentifier() == path.GetNlri().PathLocalIdentifier() {
- idx = i
- break
- }
- }
- if idx != -1 {
- old = d.knownPathList[idx]
- }
-
- // No withdraw use case for adj-out
- if idx != -1 {
- if old.Equal(path) {
- path.setTimestamp(old.GetTimestamp())
- }
- d.knownPathList[idx] = path
- } else {
- d.knownPathList = append(d.knownPathList, path)
- }
+ d.knownPathList = append(d.knownPathList, path)
}
}
diff --git a/internal/pkg/table/adj_test.go b/internal/pkg/table/adj_test.go
index 99aba0ff..bb1f07b9 100644
--- a/internal/pkg/table/adj_test.go
+++ b/internal/pkg/table/adj_test.go
@@ -75,11 +75,11 @@ func TestAddPathAdjOut(t *testing.T) {
p2 := NewPath(pi, nlri2, false, attrs, time.Now(), false)
nlri3 := bgp.NewIPAddrPrefix(24, "20.20.20.0")
nlri3.SetPathIdentifier(2)
- nlri3.SetPathLocalIdentifier(2)
+ nlri3.SetPathLocalIdentifier(3)
p3 := NewPath(pi, nlri3, false, attrs, time.Now(), false)
nlri4 := bgp.NewIPAddrPrefix(24, "20.20.20.0")
nlri4.SetPathIdentifier(3)
- nlri4.SetPathLocalIdentifier(2)
+ nlri4.SetPathLocalIdentifier(4)
p4 := NewPath(pi, nlri4, false, attrs, time.Now(), false)
family := p1.GetRouteFamily()
families := []bgp.RouteFamily{family}
@@ -87,7 +87,7 @@ func TestAddPathAdjOut(t *testing.T) {
adj := NewAdjRib(families)
adj.UpdateAdjRibOut([]*Path{p1, p2, p3, p4})
assert.Equal(t, len(adj.table[family].destinations), 1)
- assert.Equal(t, adj.Count([]bgp.RouteFamily{family}), 2)
+ assert.Equal(t, adj.Count([]bgp.RouteFamily{family}), 4)
}
func TestStale(t *testing.T) {