Skip to content

Commit

Permalink
Merge pull request #263 from sebageek/extend-routetableclient-interface
Browse files Browse the repository at this point in the history
Add functions to AdjRIBIn/AdjRIBOut for RIS
  • Loading branch information
hikhvar authored May 12, 2020
2 parents ef48ec2 + 46e596b commit bfe8627
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions routingtable/adjRIBIn/adj_rib_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ func (a *AdjRIBIn) Register(client routingtable.RouteTableClient) {
a.clientManager.RegisterWithOptions(client, routingtable.ClientOptions{BestOnly: true})
}

// RegisterWithOptions registers a client for updates
func (a *AdjRIBIn) RegisterWithOptions(client routingtable.RouteTableClient, options routingtable.ClientOptions) {
a.clientManager.RegisterWithOptions(client, options)
}

// Unregister unregisters a client
func (a *AdjRIBIn) Unregister(client routingtable.RouteTableClient) {
if !a.clientManager.Unregister(client) {
Expand All @@ -271,3 +276,18 @@ func (a *AdjRIBIn) Unregister(client routingtable.RouteTableClient) {
func (a *AdjRIBIn) RefreshRoute(*net.Prefix, []*route.Path) {

}

// LPM performs a longest prefix match on the routing table
func (a *AdjRIBIn) LPM(pfx *net.Prefix) (res []*route.Route) {
return a.rt.LPM(pfx)
}

// Get gets a route
func (a *AdjRIBIn) Get(pfx *net.Prefix) *route.Route {
return a.rt.Get(pfx)
}

// GetLonger gets all more specifics
func (a *AdjRIBIn) GetLonger(pfx *net.Prefix) (res []*route.Route) {
return a.rt.GetLonger(pfx)
}
20 changes: 20 additions & 0 deletions routingtable/adjRIBOut/adj_rib_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ func (a *AdjRIBOut) Register(client routingtable.RouteTableClient) {
a.clientManager.RegisterWithOptions(client, routingtable.ClientOptions{BestOnly: true})
}

// RegisterWithOptions registers a client for updates
func (a *AdjRIBOut) RegisterWithOptions(client routingtable.RouteTableClient, options routingtable.ClientOptions) {
a.clientManager.RegisterWithOptions(client, options)
}

// Unregister unregisters a client
func (a *AdjRIBOut) Unregister(client routingtable.RouteTableClient) {
a.clientManager.Unregister(client)
Expand Down Expand Up @@ -330,3 +335,18 @@ func (a *AdjRIBOut) RefreshRoute(pfx *net.Prefix, ribPaths []*route.Path) {

}
}

// LPM performs a longest prefix match on the routing table
func (a *AdjRIBOut) LPM(pfx *net.Prefix) (res []*route.Route) {
return a.rt.LPM(pfx)
}

// Get gets a route
func (a *AdjRIBOut) Get(pfx *net.Prefix) *route.Route {
return a.rt.Get(pfx)
}

// GetLonger gets all more specifics
func (a *AdjRIBOut) GetLonger(pfx *net.Prefix) (res []*route.Route) {
return a.rt.GetLonger(pfx)
}

0 comments on commit bfe8627

Please sign in to comment.