summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-21 21:27:26 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-21 21:27:26 -0800
commitc90dc7bcf1caadb23119e638ef7ed576e1c97187 (patch)
treeca9fb0cfae17045b503b2a0940367e609e567228 /table
parentd84250491a53d3aefc00fe643d5bb45aea83b757 (diff)
table: sends updates from AdjRibOut when FSM_ESTABLISHED
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r--table/path.go8
-rw-r--r--table/path_test.go4
-rw-r--r--table/table.go2
-rw-r--r--table/table_manager.go19
4 files changed, 25 insertions, 8 deletions
diff --git a/table/path.go b/table/path.go
index 4ef9c070..269f6129 100644
--- a/table/path.go
+++ b/table/path.go
@@ -34,7 +34,7 @@ type Path interface {
setSourceVerNum(sourceVerNum int)
getSourceVerNum() int
setWithdraw(withdraw bool)
- isWithdraw() bool
+ IsWithdraw() bool
GetNlri() bgp.AddrPrefixInterface
getPrefix() net.IP
setMedSetByTargetNeighbor(medSetByTargetNeighbor bool)
@@ -119,7 +119,7 @@ func (pd *PathDefault) setWithdraw(withdraw bool) {
pd.withdraw = withdraw
}
-func (pd *PathDefault) isWithdraw() bool {
+func (pd *PathDefault) IsWithdraw() bool {
return pd.withdraw
}
@@ -171,7 +171,7 @@ func (pi *PathDefault) String() string {
str := fmt.Sprintf("IPv4Path Source: %d, ", pi.getSourceVerNum())
str = str + fmt.Sprintf(" NLRI: %s, ", pi.getPrefix().String())
str = str + fmt.Sprintf(" nexthop: %s, ", pi.getNexthop().String())
- str = str + fmt.Sprintf(" withdraw: %s, ", pi.isWithdraw())
+ str = str + fmt.Sprintf(" withdraw: %s, ", pi.IsWithdraw())
//str = str + fmt.Sprintf(" path attributes: %s, ", pi.getPathAttributeMap())
return str
}
@@ -266,7 +266,7 @@ func (ipv6p *IPv6Path) String() string {
str := fmt.Sprintf("IPv6Path Source: %d, ", ipv6p.getSourceVerNum())
str = str + fmt.Sprintf(" NLRI: %s, ", ipv6p.getPrefix().String())
str = str + fmt.Sprintf(" nexthop: %s, ", ipv6p.getNexthop().String())
- str = str + fmt.Sprintf(" withdraw: %s, ", ipv6p.isWithdraw())
+ str = str + fmt.Sprintf(" withdraw: %s, ", ipv6p.IsWithdraw())
//str = str + fmt.Sprintf(" path attributes: %s, ", ipv6p.getPathAttributeMap())
return str
}
diff --git a/table/path_test.go b/table/path_test.go
index 3cd32d89..b779c84b 100644
--- a/table/path_test.go
+++ b/table/path_test.go
@@ -114,7 +114,7 @@ func TestPathSetWithdraw(t *testing.T) {
pd := &PathDefault{}
wd := true
pd.setWithdraw(wd)
- r_wd := pd.isWithdraw()
+ r_wd := pd.IsWithdraw()
assert.Equal(t, r_wd, wd)
}
@@ -122,7 +122,7 @@ func TestPathGetWithdaw(t *testing.T) {
pd := &PathDefault{}
wd := false
pd.setWithdraw(wd)
- r_wd := pd.isWithdraw()
+ r_wd := pd.IsWithdraw()
assert.Equal(t, r_wd, wd)
}
diff --git a/table/table.go b/table/table.go
index 85110f7b..f60c2dfb 100644
--- a/table/table.go
+++ b/table/table.go
@@ -65,7 +65,7 @@ func insert(table Table, path Path) Destination {
table.validateNlri(path.GetNlri())
dest = getOrCreateDest(table, path.GetNlri())
- if path.isWithdraw() {
+ if path.IsWithdraw() {
// withdraw insert
dest.addWithdraw(path)
} else {
diff --git a/table/table_manager.go b/table/table_manager.go
index 0967f5d1..9dfae5bf 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -340,7 +340,7 @@ func (adj *AdjRib) update(rib map[RouteFamily]map[string]*ReceivedRoute, pathLis
for _, path := range pathList {
rf := path.getRouteFamily()
key := path.getPrefix().String()
- if path.isWithdraw() {
+ if path.IsWithdraw() {
_, found := rib[rf][key]
if found {
delete(rib[rf], key)
@@ -359,6 +359,23 @@ func (adj *AdjRib) UpdateOut(pathList []Path) {
adj.update(adj.adjRibOut, pathList)
}
+func (adj *AdjRib) getPathList(rib map[string]*ReceivedRoute) []Path {
+ pathList := []Path{}
+
+ for _, rr := range rib {
+ pathList = append(pathList, rr.path)
+ }
+ return pathList
+}
+
+func (adj *AdjRib) GetInPathList(rf RouteFamily) []Path {
+ return adj.getPathList(adj.adjRibIn[rf])
+}
+
+func (adj *AdjRib) GetOutPathList(rf RouteFamily) []Path {
+ return adj.getPathList(adj.adjRibOut[rf])
+}
+
type ReceivedRoute struct {
path Path
filtered bool