summaryrefslogtreecommitdiffhomepage
path: root/table/table_manager.go
diff options
context:
space:
mode:
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) {