summaryrefslogtreecommitdiffhomepage
path: root/table/table_manager.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 02:52:33 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 02:52:33 -0800
commit275f20e96e674e3a0b654292f81240744c61665a (patch)
tree8f4a4e6b7b0d6d31cd9e4bea00b2435f67eb8e46 /table/table_manager.go
parentc90dc7bcf1caadb23119e638ef7ed576e1c97187 (diff)
table: send withdraw when peer is down
When a peer becomes down, send withdraw for the best pathes of it. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table_manager.go')
-rw-r--r--table/table_manager.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/table/table_manager.go b/table/table_manager.go
index 9dfae5bf..4a71bf6f 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -234,18 +234,10 @@ func setLogger(loggerInstance *log.Logger) {
logger = loggerInstance
}
-func (manager *TableManager) ProcessPaths(pathList []Path) ([]Path, []Destination, error) {
+func (manager *TableManager) calculate(destinationList []Destination) ([]Path, []Destination, error) {
bestPaths := make([]Path, 0)
lostDest := make([]Destination, 0)
- destinationList := make([]Destination, 0)
- for _, path := range pathList {
- rf := path.getRouteFamily()
- // push Path into table
- destination := insert(manager.Tables[rf], path)
- destinationList = append(destinationList, destination)
- }
-
for _, destination := range destinationList {
// compute best path
logger.Infof("Processing destination: %v", destination.String())
@@ -299,6 +291,22 @@ func (manager *TableManager) ProcessPaths(pathList []Path) ([]Path, []Destinatio
return bestPaths, lostDest, nil
}
+func (manager *TableManager) DeletePathsforPeer(peerInfo *PeerInfo) ([]Path, []Destination, error) {
+ destinationList := manager.Tables[RF_IPv4_UC].DeleteDestByPeer(peerInfo)
+ return manager.calculate(destinationList)
+}
+
+func (manager *TableManager) ProcessPaths(pathList []Path) ([]Path, []Destination, error) {
+ destinationList := make([]Destination, 0)
+ for _, path := range pathList {
+ rf := path.getRouteFamily()
+ // push Path into table
+ destination := insert(manager.Tables[rf], path)
+ destinationList = append(destinationList, destination)
+ }
+ return manager.calculate(destinationList)
+}
+
// process BGPUpdate message
// this function processes only BGPUpdate
func (manager *TableManager) ProcessUpdate(fromPeer *PeerInfo, message *bgp.BGPMessage) ([]Path, []Destination, error) {