Skip to content
Snippets Groups Projects
Commit fd1ccf16 authored by pberndro's avatar pberndro
Browse files

remove log for performance reasons and add count function for routes in LocRIB

parent 631f24f8
Branches
Tags
No related merge requests found
...@@ -79,7 +79,7 @@ func main() { ...@@ -79,7 +79,7 @@ func main() {
go func() { go func() {
for { for {
fmt.Print(rib.Print()) fmt.Printf("LocRIB count: %d\n", rib.Count())
time.Sleep(time.Second * 10) time.Sleep(time.Second * 10)
} }
}() }()
......
...@@ -82,7 +82,6 @@ func serializeAndSendUpdate(out io.Writer, update serializeAbleUpdate) error { ...@@ -82,7 +82,6 @@ func serializeAndSendUpdate(out io.Writer, update serializeAbleUpdate) error {
return nil return nil
} }
fmt.Printf("Sending Update: %v\n", updateBytes)
_, err = out.Write(updateBytes) _, err = out.Write(updateBytes)
if err != nil { if err != nil {
return fmt.Errorf("Failed sending Update: %v", err) return fmt.Errorf("Failed sending Update: %v", err)
......
...@@ -72,12 +72,10 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error { ...@@ -72,12 +72,10 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error {
a.removePathsFromClients(pfx, oldPaths) a.removePathsFromClients(pfx, oldPaths)
} }
fmt.Printf("Adding path: %s\n", p.Print())
pathID, err := a.pathIDManager.addPath(p) pathID, err := a.pathIDManager.addPath(p)
if err != nil { if err != nil {
return fmt.Errorf("Unable to get path ID: %v", err) return fmt.Errorf("Unable to get path ID: %v", err)
} }
fmt.Printf("New path ID: %d\n", pathID)
p.BGPPath.PathIdentifier = pathID p.BGPPath.PathIdentifier = pathID
a.rt.AddPath(pfx, p) a.rt.AddPath(pfx, p)
......
...@@ -27,6 +27,14 @@ func New() *LocRIB { ...@@ -27,6 +27,14 @@ func New() *LocRIB {
return a return a
} }
//Count routes from the LocRIP
func (a *LocRIB) Count() uint64 {
a.mu.RLock()
defer a.mu.RUnlock()
return uint64(len(a.rt.Dump()))
}
// UpdateNewClient sends current state to a new client // UpdateNewClient sends current state to a new client
func (a *LocRIB) UpdateNewClient(client routingtable.RouteTableClient) error { func (a *LocRIB) UpdateNewClient(client routingtable.RouteTableClient) error {
a.mu.RLock() a.mu.RLock()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment