Skip to content

Commit 46e596b

Browse files
committed
Add functions to AdjRIBIn/AdjRIBOut for RIS
The funtions RegisterWithOptions(), LPPM(), Get() and GetLonger() need to be exposed by AdjRIBIn/AdjRIBOut. This makes these RIBs usable in much the same way as LocRIB for the RIS.
1 parent ef48ec2 commit 46e596b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

routingtable/adjRIBIn/adj_rib_in.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ func (a *AdjRIBIn) Register(client routingtable.RouteTableClient) {
254254
a.clientManager.RegisterWithOptions(client, routingtable.ClientOptions{BestOnly: true})
255255
}
256256

257+
// RegisterWithOptions registers a client for updates
258+
func (a *AdjRIBIn) RegisterWithOptions(client routingtable.RouteTableClient, options routingtable.ClientOptions) {
259+
a.clientManager.RegisterWithOptions(client, options)
260+
}
261+
257262
// Unregister unregisters a client
258263
func (a *AdjRIBIn) Unregister(client routingtable.RouteTableClient) {
259264
if !a.clientManager.Unregister(client) {
@@ -271,3 +276,18 @@ func (a *AdjRIBIn) Unregister(client routingtable.RouteTableClient) {
271276
func (a *AdjRIBIn) RefreshRoute(*net.Prefix, []*route.Path) {
272277

273278
}
279+
280+
// LPM performs a longest prefix match on the routing table
281+
func (a *AdjRIBIn) LPM(pfx *net.Prefix) (res []*route.Route) {
282+
return a.rt.LPM(pfx)
283+
}
284+
285+
// Get gets a route
286+
func (a *AdjRIBIn) Get(pfx *net.Prefix) *route.Route {
287+
return a.rt.Get(pfx)
288+
}
289+
290+
// GetLonger gets all more specifics
291+
func (a *AdjRIBIn) GetLonger(pfx *net.Prefix) (res []*route.Route) {
292+
return a.rt.GetLonger(pfx)
293+
}

routingtable/adjRIBOut/adj_rib_out.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ func (a *AdjRIBOut) Register(client routingtable.RouteTableClient) {
275275
a.clientManager.RegisterWithOptions(client, routingtable.ClientOptions{BestOnly: true})
276276
}
277277

278+
// RegisterWithOptions registers a client for updates
279+
func (a *AdjRIBOut) RegisterWithOptions(client routingtable.RouteTableClient, options routingtable.ClientOptions) {
280+
a.clientManager.RegisterWithOptions(client, options)
281+
}
282+
278283
// Unregister unregisters a client
279284
func (a *AdjRIBOut) Unregister(client routingtable.RouteTableClient) {
280285
a.clientManager.Unregister(client)
@@ -330,3 +335,18 @@ func (a *AdjRIBOut) RefreshRoute(pfx *net.Prefix, ribPaths []*route.Path) {
330335

331336
}
332337
}
338+
339+
// LPM performs a longest prefix match on the routing table
340+
func (a *AdjRIBOut) LPM(pfx *net.Prefix) (res []*route.Route) {
341+
return a.rt.LPM(pfx)
342+
}
343+
344+
// Get gets a route
345+
func (a *AdjRIBOut) Get(pfx *net.Prefix) *route.Route {
346+
return a.rt.Get(pfx)
347+
}
348+
349+
// GetLonger gets all more specifics
350+
func (a *AdjRIBOut) GetLonger(pfx *net.Prefix) (res []*route.Route) {
351+
return a.rt.GetLonger(pfx)
352+
}

0 commit comments

Comments
 (0)