Skip to content
Snippets Groups Projects
Commit 4dcf85c9 authored by Daniel Czerwonk's avatar Daniel Czerwonk Committed by takt
Browse files

BGP and VRF metrics (#204)

* first steps to metrics

* next small step

* fixed tests

* added comments

* postponed RouterAccepted and RoutesRejected to next step

* read update counters

* added test

* added missing test file

* Route not used any more

* added metrics for session state and time since establish

* increased test coverage, time since establish impl.

* added prom collector

* added metrics endpoint to BGP example

* added metrics for VRF

* removed commented metrics

* fixed logging inconsistency in example

* Update main.go

* gofmt

* fixed typo
parent 6525c1e9
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,7 @@ func (v *VRF) IPv6UnicastRIB() *locRIB.LocRIB {
return v.ribForAddressFamily(addressFamily{afi: afiIPv6, safi: safiUnicast})
}
// Name is the name of the VRF
func (v *VRF) Name() string {
return v.name
}
......@@ -108,3 +109,13 @@ func (v *VRF) RIBByName(name string) (rib *locRIB.LocRIB, found bool) {
rib, found = v.ribNames[name]
return rib, found
}
func (v *VRF) nameForRIB(rib *locRIB.LocRIB) string {
for name, r := range v.ribNames {
if r == rib {
return name
}
}
return ""
}
......@@ -41,3 +41,17 @@ func (r *vrfRegistry) unregisterVRF(v *VRF) {
delete(r.vrfs, v.name)
}
func (r *vrfRegistry) list() []*VRF {
r.mu.Lock()
defer r.mu.Unlock()
l := make([]*VRF, len(r.vrfs))
i := 0
for _, v := range r.vrfs {
l[i] = v
i++
}
return l
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment