diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2017-02-13 06:30:58 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-02-15 00:10:15 +0900 |
commit | 52356c26f821fdebb3fdf943a1b898a2d1b4d0db (patch) | |
tree | 0ebe5f222851168489f9118eeb77f71547d5ccb6 /table/destination.go | |
parent | f276279bf6d90b3f5940bc63780cc3483e9d734e (diff) |
server: add a current option to WatchBestPath()
also, use it for zebra integration
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r-- | table/destination.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/table/destination.go b/table/destination.go index ac3ef0c8..1ded7962 100644 --- a/table/destination.go +++ b/table/destination.go @@ -182,6 +182,24 @@ func (dd *Destination) GetBestPath(id string) *Path { return nil } +func (dd *Destination) GetMultiBestPath(id string) []*Path { + list := make([]*Path, 0, len(dd.knownPathList)) + var best *Path + for _, p := range dd.knownPathList { + if p.Filtered(id) == POLICY_DIRECTION_NONE { + if best == nil { + best = p + list = append(list, p) + } else if best.Compare(p) == 0 { + list = append(list, p) + } else { + return list + } + } + } + return nil +} + func (dd *Destination) AddWithdraw(withdraw *Path) { dd.validatePath(withdraw) dd.withdrawList = append(dd.withdrawList, withdraw) |