table/table_manager: Enable to select paths with nexthop

Signed-off-by: IWASE Yusuke <[email protected]>
This commit is contained in:
IWASE Yusuke
2017-03-06 09:12:23 +09:00
parent afcc164d9c
commit bd8424e6d5
+14
View File
@@ -350,6 +350,20 @@ func (manager *TableManager) GetPathList(id string, rfList []bgp.RouteFamily) []
return paths
}
func (manager *TableManager) GetPathListWithNexthop(id string, rfList []bgp.RouteFamily, nexthop net.IP) []*Path {
paths := make([]*Path, 0, manager.getDestinationCount(rfList))
for _, rf := range rfList {
if t, ok := manager.Tables[rf]; ok {
for _, path := range t.GetKnownPathList(id) {
if path.GetNexthop().Equal(nexthop) {
paths = append(paths, path)
}
}
}
}
return paths
}
func (manager *TableManager) GetDestination(path *Path) *Destination {
if path == nil {
return nil