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

Implement RIS (#208)

* Make BMP server VRF aware

* Implement RIS service

* Remove binary

* Fix .gitignore

* Implement more RPCs

* Implement RIB Observer

* Fix tests

* Implement RIB Dump

* Add support for translating proto BGP Paths into internal paths

* Cleanup

* Fix peer down

* Implement buffered update receiver. Fix route propagation.

* Add metrics

* Add VRF metrics

* Add router label to VRF metrics

* Add peer metrics

* Fix tests

* Fix test

* Fix test

* Fix build

* Add tests

* Add test for unknown path attributes

* Add tests

* Extend test

* Standardize grpc API

* Fix tests
parent aa5f6e2d
Branches fix/bgpopen
No related tags found
No related merge requests found
Showing
with 2002 additions and 196 deletions
......@@ -24,6 +24,7 @@ examples/bgp
examples/bmp
examples/fib/fib
examples/device/device
cmd/ris/ris
# bazel directories
/bazel-*
......@@ -31,7 +31,7 @@ func main() {
go http.ListenAndServe("localhost:1337", nil)
b := server.NewBgpServer()
v, err := vrf.New("master")
v, err := vrf.New("master", 0)
if err != nil {
log.Fatal(err)
}
......
This diff is collapsed.
syntax = "proto3";
package bio.ris;
import "github.com/bio-routing/bio-rd/net/api/net.proto";
import "github.com/bio-routing/bio-rd/route/api/route.proto";
option go_package = "github.com/bio-routing/bio-rd/cmd/ris/api";
service RoutingInformationService {
rpc LPM(LPMRequest) returns (LPMResponse) {}
rpc Get(GetRequest) returns (GetResponse) {}
rpc GetLonger(GetLongerRequest) returns (GetLongerResponse) {}
rpc ObserveRIB(ObserveRIBRequest) returns (stream RIBUpdate);
rpc DumpRIB(DumpRIBRequest) returns (stream DumpRIBReply);
}
message LPMRequest {
string router = 1;
uint64 vrf_id = 2;
bio.net.Prefix pfx = 3;
}
message LPMResponse {
repeated bio.route.Route routes = 1;
}
message GetRequest {
string router = 1;
uint64 vrf_id = 2;
bio.net.Prefix pfx = 3;
}
message GetResponse {
repeated bio.route.Route routes = 1;
}
message GetLongerRequest {
string router = 1;
uint64 vrf_id = 2;
bio.net.Prefix pfx = 3;
}
message GetLongerResponse {
repeated bio.route.Route routes = 1;
}
message ObserveRIBRequest {
string router = 1;
uint64 vrf_id = 2;
enum AFISAFI {
IPv4Unicast = 0;
IPv6Unicast = 1;
}
AFISAFI afisafi = 3;
}
message RIBUpdate {
bool advertisement = 1;
bio.route.Route route = 2;
}
message DumpRIBRequest {
string router = 1;
uint64 vrf_id = 2;
enum AFISAFI {
IPv4Unicast = 0;
IPv6Unicast = 1;
}
AFISAFI afisafi = 3;
}
message DumpRIBReply {
bio.route.Route route = 1;
}
\ No newline at end of file
package config
import (
"io/ioutil"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
// RISConfig is the config of RIS instance
type RISConfig struct {
BMPServers []BMPServer `yaml:"bmp_servers"`
}
// BMPServer represent a BMP enable Router
type BMPServer struct {
Address string `yaml:"address"`
Port uint16 `yaml:"port"`
}
// LoadConfig loads a RIS config
func LoadConfig(filepath string) (*RISConfig, error) {
f, err := ioutil.ReadFile(filepath)
if err != nil {
return nil, errors.Wrap(err, "Unable to read config file")
}
cfg := &RISConfig{}
err = yaml.Unmarshal(f, cfg)
if err != nil {
return nil, errors.Wrap(err, "Unmarshal failed")
}
return cfg, nil
}
package main
import (
"flag"
"net"
"os"
"google.golang.org/grpc"
"github.com/bio-routing/bio-rd/cmd/ris/config"
"github.com/bio-routing/bio-rd/cmd/ris/risserver"
"github.com/bio-routing/bio-rd/protocols/bgp/server"
"github.com/bio-routing/bio-rd/util/servicewrapper"
"github.com/prometheus/client_golang/prometheus"
pb "github.com/bio-routing/bio-rd/cmd/ris/api"
prom_bmp "github.com/bio-routing/bio-rd/metrics/bmp/adapter/prom"
log "github.com/sirupsen/logrus"
)
var (
grpcPort = flag.Uint("grpc_port", 4321, "gRPC server port")
httpPort = flag.Uint("http_port", 4320, "HTTP server port")
configFilePath = flag.String("config.file", "ris_config.yml", "Configuration file")
)
func main() {
flag.Parse()
cfg, err := config.LoadConfig(*configFilePath)
if err != nil {
log.Errorf("Failed to load config: %v", err)
os.Exit(1)
}
b := server.NewServer()
prometheus.MustRegister(prom_bmp.NewCollector(b))
for _, r := range cfg.BMPServers {
ip := net.ParseIP(r.Address)
if ip == nil {
log.Errorf("Unable to convert %q to net.IP", r.Address)
os.Exit(1)
}
b.AddRouter(ip, r.Port)
}
s := risserver.NewServer(b)
unaryInterceptors := []grpc.UnaryServerInterceptor{}
streamInterceptors := []grpc.StreamServerInterceptor{}
srv, err := servicewrapper.New(
uint16(*grpcPort),
servicewrapper.HTTP(uint16(*httpPort)),
unaryInterceptors,
streamInterceptors,
)
if err != nil {
log.Errorf("failed to listen: %v", err)
os.Exit(1)
}
pb.RegisterRoutingInformationServiceServer(srv.GRPC(), s)
if err := srv.Serve(); err != nil {
log.Fatalf("failed to start server: %v", err)
}
}
bmp_servers:
- address: 10.0.255.1
port: 30119
\ No newline at end of file
package risserver
import (
"context"
"fmt"
"github.com/bio-routing/bio-rd/net"
"github.com/bio-routing/bio-rd/protocols/bgp/server"
"github.com/bio-routing/bio-rd/route"
"github.com/bio-routing/bio-rd/routingtable"
"github.com/bio-routing/bio-rd/routingtable/locRIB"
pb "github.com/bio-routing/bio-rd/cmd/ris/api"
bnet "github.com/bio-routing/bio-rd/net"
netapi "github.com/bio-routing/bio-rd/net/api"
routeapi "github.com/bio-routing/bio-rd/route/api"
)
// Server represents an RoutingInformationService server
type Server struct {
bmp *server.BMPServer
}
// NewServer creates a new server
func NewServer(b *server.BMPServer) *Server {
return &Server{
bmp: b,
}
}
func (s Server) getRIB(rtr string, vrfID uint64, ipVersion netapi.IP_Version) (*locRIB.LocRIB, error) {
r := s.bmp.GetRouter(rtr)
if r == nil {
return nil, fmt.Errorf("Unable to get router %q", rtr)
}
v := r.GetVRF(vrfID)
if v == nil {
return nil, fmt.Errorf("Unable to get VRF %d", vrfID)
}
var rib *locRIB.LocRIB
switch ipVersion {
case netapi.IP_IPv4:
rib = v.IPv4UnicastRIB()
case netapi.IP_IPv6:
rib = v.IPv6UnicastRIB()
default:
return nil, fmt.Errorf("Unknown afi")
}
if rib == nil {
return nil, fmt.Errorf("Unable to get RIB")
}
return rib, nil
}
// LPM provides a longest prefix match service
func (s *Server) LPM(ctx context.Context, req *pb.LPMRequest) (*pb.LPMResponse, error) {
if req.Pfx == nil {
panic("XXX")
}
rib, err := s.getRIB(req.Router, req.VrfId, req.Pfx.Address.Version)
if err != nil {
return nil, err
}
routes := rib.LPM(bnet.NewPrefixFromProtoPrefix(*req.Pfx))
res := &pb.LPMResponse{
Routes: make([]*routeapi.Route, 0, len(routes)),
}
for _, route := range routes {
res.Routes = append(res.Routes, route.ToProto())
}
return res, nil
}
// Get gets a prefix (exact match)
func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error) {
rib, err := s.getRIB(req.Router, req.VrfId, req.Pfx.Address.Version)
if err != nil {
return nil, err
}
route := rib.Get(bnet.NewPrefixFromProtoPrefix(*req.Pfx))
if route == nil {
return &pb.GetResponse{
Routes: make([]*routeapi.Route, 0, 0),
}, nil
}
return &pb.GetResponse{
Routes: []*routeapi.Route{
route.ToProto(),
},
}, nil
}
// GetLonger gets all more specifics of a prefix
func (s *Server) GetLonger(ctx context.Context, req *pb.GetLongerRequest) (*pb.GetLongerResponse, error) {
rib, err := s.getRIB(req.Router, req.VrfId, req.Pfx.Address.Version)
if err != nil {
return nil, err
}
routes := rib.GetLonger(bnet.NewPrefixFromProtoPrefix(*req.Pfx))
res := &pb.GetLongerResponse{
Routes: make([]*routeapi.Route, 0, len(routes)),
}
for _, route := range routes {
res.Routes = append(res.Routes, route.ToProto())
}
return res, nil
}
func (s *Server) ObserveRIB(req *pb.ObserveRIBRequest, stream pb.RoutingInformationService_ObserveRIBServer) error {
ipVersion := netapi.IP_IPv4
switch req.Afisafi {
case pb.ObserveRIBRequest_IPv4Unicast:
ipVersion = netapi.IP_IPv4
case pb.ObserveRIBRequest_IPv6Unicast:
ipVersion = netapi.IP_IPv6
default:
return fmt.Errorf("Unknown AFI/SAFI")
}
rib, err := s.getRIB(req.Router, req.VrfId, ipVersion)
if err != nil {
return err
}
fifo := newUpdateFIFO()
rc := newRIBClient(fifo)
ret := make(chan error)
go func(fifo *updateFIFO) {
var err error
for {
for _, toSend := range fifo.dequeue() {
err = stream.Send(toSend)
if err != nil {
ret <- err
return
}
}
}
}(fifo)
rib.RegisterWithOptions(rc, routingtable.ClientOptions{
MaxPaths: 100,
})
defer rib.Unregister(rc)
err = <-ret
if err != nil {
return fmt.Errorf("Stream ended: %v", err)
}
return nil
}
func (s *Server) DumpRIB(req *pb.DumpRIBRequest, stream pb.RoutingInformationService_DumpRIBServer) error {
ipVersion := netapi.IP_IPv4
switch req.Afisafi {
case pb.DumpRIBRequest_IPv4Unicast:
ipVersion = netapi.IP_IPv4
case pb.DumpRIBRequest_IPv6Unicast:
ipVersion = netapi.IP_IPv6
default:
return fmt.Errorf("Unknown AFI/SAFI")
}
rib, err := s.getRIB(req.Router, req.VrfId, ipVersion)
if err != nil {
return err
}
toSend := &pb.DumpRIBReply{
Route: &routeapi.Route{
Paths: make([]*routeapi.Path, 1),
},
}
routes := rib.Dump()
for i := range routes {
toSend.Route = routes[i].ToProto()
err = stream.Send(toSend)
if err != nil {
return err
}
}
return nil
}
type update struct {
advertisement bool
prefix net.Prefix
path *route.Path
}
type ribClient struct {
fifo *updateFIFO
}
func newRIBClient(fifo *updateFIFO) *ribClient {
return &ribClient{
fifo: fifo,
}
}
func (r *ribClient) AddPath(pfx net.Prefix, path *route.Path) error {
r.fifo.queue(&pb.RIBUpdate{
Advertisement: true,
Route: &routeapi.Route{
Pfx: pfx.ToProto(),
Paths: []*routeapi.Path{
path.ToProto(),
},
},
})
return nil
}
func (r *ribClient) RemovePath(pfx net.Prefix, path *route.Path) bool {
r.fifo.queue(&pb.RIBUpdate{
Advertisement: false,
Route: &routeapi.Route{
Pfx: pfx.ToProto(),
Paths: []*routeapi.Path{
path.ToProto(),
},
},
})
return false
}
func (r *ribClient) UpdateNewClient(routingtable.RouteTableClient) error {
return nil
}
func (r *ribClient) Register(routingtable.RouteTableClient) {
}
func (r *ribClient) RegisterWithOptions(routingtable.RouteTableClient, routingtable.ClientOptions) {
}
func (r *ribClient) Unregister(routingtable.RouteTableClient) {
}
func (r *ribClient) RouteCount() int64 {
return -1
}
func (r *ribClient) ClientCount() uint64 {
return 0
}
func (r *ribClient) Dump() []*route.Route {
return nil
}
package risserver
import (
"sync"
pb "github.com/bio-routing/bio-rd/cmd/ris/api"
)
type updateFIFO struct {
dataArrived chan struct{}
data []*pb.RIBUpdate
mu sync.Mutex
}
func newUpdateFIFO() *updateFIFO {
return &updateFIFO{
dataArrived: make(chan struct{}, 1),
data: make([]*pb.RIBUpdate, 0),
}
}
func (uf *updateFIFO) queue(r *pb.RIBUpdate) {
uf.mu.Lock()
uf.data = append(uf.data, r)
select {
case uf.dataArrived <- struct{}{}:
default:
}
uf.mu.Unlock()
}
func (uf *updateFIFO) empty() bool {
return len(uf.data) == 0
}
// dequeue get's all elements in the queue unless the queue is empty. Then it blocks until it is not empty.
func (uf *updateFIFO) dequeue() []*pb.RIBUpdate {
<-uf.dataArrived
uf.mu.Lock()
data := uf.data
uf.data = make([]*pb.RIBUpdate, 0, 128)
uf.mu.Unlock()
return data
}
......@@ -24,7 +24,7 @@ func main() {
logrus.Printf("This is a BGP speaker\n")
b := server.NewBgpServer()
v, err := vrf.New("master")
v, err := vrf.New("master", 0)
if err != nil {
log.Fatal(err)
}
......@@ -38,7 +38,7 @@ func main() {
func startMetricsEndpoint(server server.BGPServer) {
prometheus.MustRegister(prom_bgp.NewCollector(server))
prometheus.MustRegister(prom_vrf.NewCollector())
prometheus.MustRegister(prom_vrf.NewCollector(vrf.GetGlobalRegistry()))
http.Handle("/metrics", promhttp.Handler())
......
......@@ -6,21 +6,61 @@ import (
"time"
"github.com/bio-routing/bio-rd/protocols/bgp/server"
"github.com/bio-routing/bio-rd/routingtable/locRIB"
"github.com/sirupsen/logrus"
bnet "github.com/bio-routing/bio-rd/net"
)
func main() {
logrus.Printf("This is a BMP speaker\n")
rib4 := locRIB.New("inet.0")
rib6 := locRIB.New("inet6.0")
b := server.NewServer()
b.AddRouter(net.IP{10, 0, 255, 0}, 30119, rib4, rib6)
b.AddRouter(net.IP{10, 0, 255, 1}, 30119)
go func() {
for {
fmt.Printf("LocRIB4 count: %d\n", rib4.Count())
for _, r := range b.GetRouters() {
for _, v := range r.GetVRFs() {
rib4 := v.IPv4UnicastRIB()
c := rib4.Count()
fmt.Printf("Router: %s VRF: %s IPv4 route count: %d\n", r.Name(), v.Name(), c)
if v.RD() == 220434901565105 {
for _, route := range rib4.Dump() {
fmt.Printf("Pfx: %s\n", route.Prefix().String())
for _, p := range route.Paths() {
fmt.Printf(" %s\n", p.String())
}
}
fmt.Printf("looking up 185.65.240.100\n")
for _, r := range rib4.LPM(bnet.NewPfx(bnet.IPv4FromOctets(185, 65, 240, 100), 32)) {
fmt.Printf("Pfx: %s\n", r.Prefix().String())
for _, p := range r.Paths() {
fmt.Printf(" %s\n", p.String())
}
}
fmt.Printf("is 8.8.8.8 in closednet?\n")
x := rib4.LPM(bnet.NewPfx(bnet.IPv4FromOctets(8, 8, 8, 8), 32))
if len(x) == 0 {
fmt.Printf("Nope\n")
} else {
fmt.Printf("Yep\n")
}
fmt.Printf("is 185.65.240.100 in closednet?\n")
x = rib4.LPM(bnet.NewPfx(bnet.IPv4FromOctets(185, 65, 240, 0), 32))
if len(x) == 0 {
fmt.Printf("Nope\n")
} else {
fmt.Printf("Yep\n")
}
}
}
}
time.Sleep(time.Second * 10)
}
}()
......
......@@ -12,7 +12,7 @@ import (
)
func main() {
vrf, err := vrf.New("inet.0")
vrf, err := vrf.New("inet.0", 0)
if err != nil {
log.Errorf("Unable to create VRF: %v", err)
os.Exit(1)
......
......@@ -16,15 +16,24 @@ const (
)
var (
upDesc *prometheus.Desc
stateDesc *prometheus.Desc
uptimeDesc *prometheus.Desc
updatesReceivedDesc *prometheus.Desc
updatesSentDesc *prometheus.Desc
routesReceivedDesc *prometheus.Desc
routesSentDesc *prometheus.Desc
routesRejectedDesc *prometheus.Desc
routesAcceptedDesc *prometheus.Desc
upDesc *prometheus.Desc
stateDesc *prometheus.Desc
uptimeDesc *prometheus.Desc
updatesReceivedDesc *prometheus.Desc
updatesSentDesc *prometheus.Desc
upDescRouter *prometheus.Desc
stateDescRouter *prometheus.Desc
uptimeDescRouter *prometheus.Desc
updatesReceivedDescRouter *prometheus.Desc
updatesSentDescRouter *prometheus.Desc
routesReceivedDesc *prometheus.Desc
routesSentDesc *prometheus.Desc
routesRejectedDesc *prometheus.Desc
routesAcceptedDesc *prometheus.Desc
routesReceivedDescRouter *prometheus.Desc
routesSentDescRouter *prometheus.Desc
routesRejectedDescRouter *prometheus.Desc
routesAcceptedDescRouter *prometheus.Desc
)
func init() {
......@@ -35,11 +44,24 @@ func init() {
updatesReceivedDesc = prometheus.NewDesc(prefix+"update_received_count", "Number of updates received", labels, nil)
updatesSentDesc = prometheus.NewDesc(prefix+"update_sent_count", "Number of updates sent", labels, nil)
labelsRouter := append(labels, "router")
upDescRouter = prometheus.NewDesc(prefix+"up", "Returns if the session is up", labelsRouter, nil)
stateDescRouter = prometheus.NewDesc(prefix+"state", "State of the BGP session (Down = 0, Idle = 1, Connect = 2, Active = 3, OpenSent = 4, OpenConfirm = 5, Established = 6)", labelsRouter, nil)
uptimeDescRouter = prometheus.NewDesc(prefix+"uptime_second", "Time since the session was established in seconds", labelsRouter, nil)
updatesReceivedDescRouter = prometheus.NewDesc(prefix+"update_received_count", "Number of updates received", labelsRouter, nil)
updatesSentDescRouter = prometheus.NewDesc(prefix+"update_sent_count", "Number of updates sent", labelsRouter, nil)
labels = append(labels, "afi", "safi")
routesReceivedDesc = prometheus.NewDesc(prefix+"route_received_count", "Number of routes received", labels, nil)
routesSentDesc = prometheus.NewDesc(prefix+"route_sent_count", "Number of routes sent", labels, nil)
routesRejectedDesc = prometheus.NewDesc(prefix+"route_rejected_count", "Number of routes rejected", labels, nil)
routesAcceptedDesc = prometheus.NewDesc(prefix+"route_accepted_count", "Number of routes accepted", labels, nil)
labelsRouter = append(labelsRouter, "afi", "safi")
routesReceivedDescRouter = prometheus.NewDesc(prefix+"route_received_count", "Number of routes received", labelsRouter, nil)
routesSentDescRouter = prometheus.NewDesc(prefix+"route_sent_count", "Number of routes sent", labelsRouter, nil)
routesRejectedDescRouter = prometheus.NewDesc(prefix+"route_rejected_count", "Number of routes rejected", labelsRouter, nil)
routesAcceptedDescRouter = prometheus.NewDesc(prefix+"route_accepted_count", "Number of routes accepted", labelsRouter, nil)
}
// NewCollector creates a new collector instance for the given BGP server
......@@ -65,6 +87,18 @@ func (c *bgpCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- routesAcceptedDesc
}
func DescribeRouter(ch chan<- *prometheus.Desc) {
ch <- upDescRouter
ch <- stateDescRouter
ch <- uptimeDescRouter
ch <- updatesReceivedDescRouter
ch <- updatesSentDescRouter
ch <- routesReceivedDescRouter
ch <- routesSentDescRouter
ch <- routesRejectedDescRouter
ch <- routesAcceptedDescRouter
}
// Collect conforms to the prometheus collector interface
func (c *bgpCollector) Collect(ch chan<- prometheus.Metric) {
m, err := c.server.Metrics()
......@@ -74,16 +108,17 @@ func (c *bgpCollector) Collect(ch chan<- prometheus.Metric) {
}
for _, peer := range m.Peers {
c.collectForPeer(ch, peer)
collectForPeer(ch, peer)
}
}
func (c *bgpCollector) collectForPeer(ch chan<- prometheus.Metric, peer *metrics.BGPPeerMetrics) {
func collectForPeer(ch chan<- prometheus.Metric, peer *metrics.BGPPeerMetrics) {
l := []string{
peer.IP.String(),
strconv.Itoa(int(peer.LocalASN)),
strconv.Itoa(int(peer.ASN)),
peer.VRF}
peer.VRF,
}
var up float64
var uptime float64
......@@ -99,13 +134,47 @@ func (c *bgpCollector) collectForPeer(ch chan<- prometheus.Metric, peer *metrics
ch <- prometheus.MustNewConstMetric(updatesSentDesc, prometheus.CounterValue, float64(peer.UpdatesSent), l...)
for _, family := range peer.AddressFamilies {
c.collectForFamily(ch, family, l)
collectForFamily(ch, family, l)
}
}
func (c *bgpCollector) collectForFamily(ch chan<- prometheus.Metric, family *metrics.BGPAddressFamilyMetrics, l []string) {
func CollectForPeerRouter(ch chan<- prometheus.Metric, rtr string, peer *metrics.BGPPeerMetrics) {
l := []string{
peer.IP.String(),
strconv.Itoa(int(peer.LocalASN)),
strconv.Itoa(int(peer.ASN)),
peer.VRF,
rtr,
}
var up float64
var uptime float64
if peer.Up {
up = 1
uptime = float64(time.Since(peer.Since) * time.Second)
}
ch <- prometheus.MustNewConstMetric(upDescRouter, prometheus.GaugeValue, up, l...)
ch <- prometheus.MustNewConstMetric(uptimeDescRouter, prometheus.GaugeValue, uptime, l...)
ch <- prometheus.MustNewConstMetric(stateDescRouter, prometheus.GaugeValue, float64(peer.State), l...)
ch <- prometheus.MustNewConstMetric(updatesReceivedDescRouter, prometheus.CounterValue, float64(peer.UpdatesReceived), l...)
ch <- prometheus.MustNewConstMetric(updatesSentDescRouter, prometheus.CounterValue, float64(peer.UpdatesSent), l...)
for _, family := range peer.AddressFamilies {
collectForFamilyRouter(ch, family, l)
}
}
func collectForFamily(ch chan<- prometheus.Metric, family *metrics.BGPAddressFamilyMetrics, l []string) {
l = append(l, strconv.Itoa(int(family.AFI)), strconv.Itoa(int(family.SAFI)))
ch <- prometheus.MustNewConstMetric(routesReceivedDesc, prometheus.CounterValue, float64(family.RoutesReceived), l...)
ch <- prometheus.MustNewConstMetric(routesSentDesc, prometheus.CounterValue, float64(family.RoutesSent), l...)
}
func collectForFamilyRouter(ch chan<- prometheus.Metric, family *metrics.BGPAddressFamilyMetrics, l []string) {
l = append(l, strconv.Itoa(int(family.AFI)), strconv.Itoa(int(family.SAFI)))
ch <- prometheus.MustNewConstMetric(routesReceivedDescRouter, prometheus.CounterValue, float64(family.RoutesReceived), l...)
ch <- prometheus.MustNewConstMetric(routesSentDescRouter, prometheus.CounterValue, float64(family.RoutesSent), l...)
}
package prom
import (
"github.com/bio-routing/bio-rd/protocols/bgp/metrics"
"github.com/bio-routing/bio-rd/protocols/bgp/server"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
bgp_prom "github.com/bio-routing/bio-rd/metrics/bgp/adapter/prom"
vrf_prom "github.com/bio-routing/bio-rd/metrics/vrf/adapter/prom"
log "github.com/sirupsen/logrus"
)
const (
prefix = "bio_bmp_"
)
var (
routeMonitoringMessagesDesc *prometheus.Desc
statisticsReportMessages *prometheus.Desc
peerDownNotificationMessages *prometheus.Desc
peerUpNotificationMessages *prometheus.Desc
initiationMessages *prometheus.Desc
terminationMessages *prometheus.Desc
routeMirroringMessages *prometheus.Desc
)
func init() {
labels := []string{"router"}
routeMonitoringMessagesDesc = prometheus.NewDesc(prefix+"route_monitoring_messages", "Returns number of received route monitoring messages", labels, nil)
statisticsReportMessages = prometheus.NewDesc(prefix+"statistics_report_messages", "Returns number of received statistics report messages", labels, nil)
peerDownNotificationMessages = prometheus.NewDesc(prefix+"peer_down_messages", "Returns number of received peer down notification messages", labels, nil)
peerUpNotificationMessages = prometheus.NewDesc(prefix+"peer_up_messages", "Returns number of received peer up notification messages", labels, nil)
initiationMessages = prometheus.NewDesc(prefix+"initiation_messages", "Returns number of received initiation messages", labels, nil)
terminationMessages = prometheus.NewDesc(prefix+"termination_messages", "Returns number of received termination messages", labels, nil)
routeMirroringMessages = prometheus.NewDesc(prefix+"route_mirroring_messages", "Returns number of received route mirroring messages", labels, nil)
}
// NewCollector creates a new collector instance for the given BMP server
func NewCollector(server *server.BMPServer) prometheus.Collector {
return &bmpCollector{server}
}
// bmpCollector provides a collector for BGP metrics of BIO to use with Prometheus
type bmpCollector struct {
server *server.BMPServer
}
// Describe conforms to the prometheus collector interface
func (c *bmpCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- routeMonitoringMessagesDesc
ch <- statisticsReportMessages
ch <- peerDownNotificationMessages
ch <- peerUpNotificationMessages
ch <- initiationMessages
ch <- terminationMessages
ch <- routeMirroringMessages
vrf_prom.DescribeRouter(ch)
bgp_prom.DescribeRouter(ch)
}
// Collect conforms to the prometheus collector interface
func (c *bmpCollector) Collect(ch chan<- prometheus.Metric) {
m, err := c.server.Metrics()
if err != nil {
log.Error(errors.Wrap(err, "Could not retrieve metrics from BMP server"))
return
}
for _, rtr := range m.Routers {
c.collectForRouter(ch, rtr)
}
}
func (c *bmpCollector) collectForRouter(ch chan<- prometheus.Metric, rtr *metrics.BMPRouterMetrics) {
l := []string{rtr.Name}
ch <- prometheus.MustNewConstMetric(routeMonitoringMessagesDesc, prometheus.CounterValue, float64(rtr.RouteMonitoringMessages), l...)
ch <- prometheus.MustNewConstMetric(statisticsReportMessages, prometheus.CounterValue, float64(rtr.StatisticsReportMessages), l...)
ch <- prometheus.MustNewConstMetric(peerDownNotificationMessages, prometheus.CounterValue, float64(rtr.PeerDownNotificationMessages), l...)
ch <- prometheus.MustNewConstMetric(peerUpNotificationMessages, prometheus.CounterValue, float64(rtr.PeerUpNotificationMessages), l...)
ch <- prometheus.MustNewConstMetric(initiationMessages, prometheus.CounterValue, float64(rtr.InitiationMessages), l...)
ch <- prometheus.MustNewConstMetric(terminationMessages, prometheus.CounterValue, float64(rtr.TerminationMessages), l...)
ch <- prometheus.MustNewConstMetric(routeMirroringMessages, prometheus.CounterValue, float64(rtr.RouteMirroringMessages), l...)
for _, vrfMetric := range rtr.VRFMetrics {
vrf_prom.CollectForVRFRouter(ch, rtr.Name, vrfMetric)
}
for _, peerMetric := range rtr.PeerMetrics {
bgp_prom.CollectForPeerRouter(ch, rtr.Name, peerMetric)
}
}
......@@ -3,7 +3,6 @@ package prom
import (
"strconv"
"github.com/bio-routing/bio-rd/protocols/bgp/server"
"github.com/bio-routing/bio-rd/routingtable/vrf"
"github.com/bio-routing/bio-rd/routingtable/vrf/metrics"
"github.com/prometheus/client_golang/prometheus"
......@@ -14,22 +13,26 @@ const (
)
var (
routeCountDesc *prometheus.Desc
routeCountDesc *prometheus.Desc
routeCountDescRouter *prometheus.Desc
)
func init() {
labels := []string{"vrf", "rib", "afi", "safi"}
routeCountDesc = prometheus.NewDesc(prefix+"route_count", "Number of routes in the RIB", labels, nil)
routeCountDescRouter = prometheus.NewDesc(prefix+"route_count", "Number of routes in the RIB", append([]string{"router"}, labels...), nil)
}
// NewCollector creates a new collector instance for the given BGP server
func NewCollector() prometheus.Collector {
return &vrfCollector{}
func NewCollector(r *vrf.VRFRegistry) prometheus.Collector {
return &vrfCollector{
registry: r,
}
}
// BGPCollector provides a collector for BGP metrics of BIO to use with Prometheus
// vrfCollector provides a collector for VRF metrics of BIO to use with Prometheus
type vrfCollector struct {
server server.BGPServer
registry *vrf.VRFRegistry
}
// Describe conforms to the prometheus collector interface
......@@ -37,9 +40,14 @@ func (c *vrfCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- routeCountDesc
}
// DescribeRouter conforms to the prometheus collector interface (used by BMP Server)
func DescribeRouter(ch chan<- *prometheus.Desc) {
ch <- routeCountDescRouter
}
// Collect conforms to the prometheus collector interface
func (c *vrfCollector) Collect(ch chan<- prometheus.Metric) {
for _, v := range vrf.Metrics() {
for _, v := range vrf.Metrics(c.registry) {
c.collectForVRF(ch, v)
}
}
......@@ -50,3 +58,11 @@ func (c *vrfCollector) collectForVRF(ch chan<- prometheus.Metric, v *metrics.VRF
v.Name, rib.Name, strconv.Itoa(int(rib.AFI)), strconv.Itoa(int(rib.SAFI)))
}
}
// CollectForVRFRouter collects metrics for a certain router (used by BMP Server)
func CollectForVRFRouter(ch chan<- prometheus.Metric, rtr string, v *metrics.VRFMetrics) {
for _, rib := range v.RIBs {
ch <- prometheus.MustNewConstMetric(routeCountDescRouter, prometheus.GaugeValue, float64(rib.RouteCount),
rtr, v.Name, rib.Name, strconv.Itoa(int(rib.AFI)), strconv.Itoa(int(rib.SAFI)))
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: github.com/bio-routing/bio-rd/net/api/net.proto
/*
Package api is a generated protocol buffer package.
It is generated from these files:
github.com/bio-routing/bio-rd/net/api/net.proto
It has these top-level messages:
Prefix
IP
*/
package api
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
......@@ -26,7 +18,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type IP_Version int32
......@@ -39,6 +31,7 @@ var IP_Version_name = map[int32]string{
0: "IPv4",
1: "IPv6",
}
var IP_Version_value = map[string]int32{
"IPv4": 0,
"IPv6": 1,
......@@ -47,17 +40,43 @@ var IP_Version_value = map[string]int32{
func (x IP_Version) String() string {
return proto.EnumName(IP_Version_name, int32(x))
}
func (IP_Version) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} }
func (IP_Version) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_e879b68d7a71dcc0, []int{1, 0}
}
type Prefix struct {
Address *IP `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
Pfxlen uint32 `protobuf:"varint,2,opt,name=pfxlen" json:"pfxlen,omitempty"`
Address *IP `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
Pfxlen uint32 `protobuf:"varint,2,opt,name=pfxlen,proto3" json:"pfxlen,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Prefix) Reset() { *m = Prefix{} }
func (m *Prefix) String() string { return proto.CompactTextString(m) }
func (*Prefix) ProtoMessage() {}
func (*Prefix) Descriptor() ([]byte, []int) {
return fileDescriptor_e879b68d7a71dcc0, []int{0}
}
func (m *Prefix) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Prefix.Unmarshal(m, b)
}
func (m *Prefix) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Prefix.Marshal(b, m, deterministic)
}
func (m *Prefix) XXX_Merge(src proto.Message) {
xxx_messageInfo_Prefix.Merge(m, src)
}
func (m *Prefix) XXX_Size() int {
return xxx_messageInfo_Prefix.Size(m)
}
func (m *Prefix) XXX_DiscardUnknown() {
xxx_messageInfo_Prefix.DiscardUnknown(m)
}
func (m *Prefix) Reset() { *m = Prefix{} }
func (m *Prefix) String() string { return proto.CompactTextString(m) }
func (*Prefix) ProtoMessage() {}
func (*Prefix) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
var xxx_messageInfo_Prefix proto.InternalMessageInfo
func (m *Prefix) GetAddress() *IP {
if m != nil {
......@@ -74,15 +93,38 @@ func (m *Prefix) GetPfxlen() uint32 {
}
type IP struct {
Higher uint64 `protobuf:"varint,1,opt,name=higher" json:"higher,omitempty"`
Lower uint64 `protobuf:"varint,2,opt,name=lower" json:"lower,omitempty"`
Version IP_Version `protobuf:"varint,3,opt,name=version,enum=bio.net.IP_Version" json:"version,omitempty"`
Higher uint64 `protobuf:"varint,1,opt,name=higher,proto3" json:"higher,omitempty"`
Lower uint64 `protobuf:"varint,2,opt,name=lower,proto3" json:"lower,omitempty"`
Version IP_Version `protobuf:"varint,3,opt,name=version,proto3,enum=bio.net.IP_Version" json:"version,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *IP) Reset() { *m = IP{} }
func (m *IP) String() string { return proto.CompactTextString(m) }
func (*IP) ProtoMessage() {}
func (*IP) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *IP) Reset() { *m = IP{} }
func (m *IP) String() string { return proto.CompactTextString(m) }
func (*IP) ProtoMessage() {}
func (*IP) Descriptor() ([]byte, []int) {
return fileDescriptor_e879b68d7a71dcc0, []int{1}
}
func (m *IP) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IP.Unmarshal(m, b)
}
func (m *IP) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_IP.Marshal(b, m, deterministic)
}
func (m *IP) XXX_Merge(src proto.Message) {
xxx_messageInfo_IP.Merge(m, src)
}
func (m *IP) XXX_Size() int {
return xxx_messageInfo_IP.Size(m)
}
func (m *IP) XXX_DiscardUnknown() {
xxx_messageInfo_IP.DiscardUnknown(m)
}
var xxx_messageInfo_IP proto.InternalMessageInfo
func (m *IP) GetHigher() uint64 {
if m != nil {
......@@ -106,14 +148,16 @@ func (m *IP) GetVersion() IP_Version {
}
func init() {
proto.RegisterEnum("bio.net.IP_Version", IP_Version_name, IP_Version_value)
proto.RegisterType((*Prefix)(nil), "bio.net.Prefix")
proto.RegisterType((*IP)(nil), "bio.net.IP")
proto.RegisterEnum("bio.net.IP_Version", IP_Version_name, IP_Version_value)
}
func init() { proto.RegisterFile("github.com/bio-routing/bio-rd/net/api/net.proto", fileDescriptor0) }
func init() {
proto.RegisterFile("github.com/bio-routing/bio-rd/net/api/net.proto", fileDescriptor_e879b68d7a71dcc0)
}
var fileDescriptor0 = []byte{
var fileDescriptor_e879b68d7a71dcc0 = []byte{
// 228 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xca, 0xcc, 0xd7, 0x2d, 0xca, 0x2f, 0x2d, 0xc9,
......
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: github.com/bio-routing/bio-rd/protocols/bgp/api/bgp.proto
/*
Package api is a generated protocol buffer package.
It is generated from these files:
github.com/bio-routing/bio-rd/protocols/bgp/api/bgp.proto
github.com/bio-routing/bio-rd/protocols/bgp/api/session.proto
It has these top-level messages:
ListSessionsRequest
SessionFilter
ListSessionsResponse
DumpRIBRequest
Session
SessionStats
*/
package api
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import bio_net "github.com/bio-routing/bio-rd/net/api"
import bio_route "github.com/bio-routing/bio-rd/route/api"
import (
context "golang.org/x/net/context"
context "context"
fmt "fmt"
api "github.com/bio-routing/bio-rd/net/api"
api1 "github.com/bio-routing/bio-rd/route/api"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
......@@ -38,16 +22,39 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type ListSessionsRequest struct {
Filter *SessionFilter `protobuf:"bytes,1,opt,name=filter" json:"filter,omitempty"`
Filter *SessionFilter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListSessionsRequest) Reset() { *m = ListSessionsRequest{} }
func (m *ListSessionsRequest) String() string { return proto.CompactTextString(m) }
func (*ListSessionsRequest) ProtoMessage() {}
func (*ListSessionsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2d4ce551e16bb738, []int{0}
}
func (m *ListSessionsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListSessionsRequest.Unmarshal(m, b)
}
func (m *ListSessionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListSessionsRequest.Marshal(b, m, deterministic)
}
func (m *ListSessionsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListSessionsRequest.Merge(m, src)
}
func (m *ListSessionsRequest) XXX_Size() int {
return xxx_messageInfo_ListSessionsRequest.Size(m)
}
func (m *ListSessionsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListSessionsRequest.DiscardUnknown(m)
}
func (m *ListSessionsRequest) Reset() { *m = ListSessionsRequest{} }
func (m *ListSessionsRequest) String() string { return proto.CompactTextString(m) }
func (*ListSessionsRequest) ProtoMessage() {}
func (*ListSessionsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
var xxx_messageInfo_ListSessionsRequest proto.InternalMessageInfo
func (m *ListSessionsRequest) GetFilter() *SessionFilter {
if m != nil {
......@@ -57,16 +64,39 @@ func (m *ListSessionsRequest) GetFilter() *SessionFilter {
}
type SessionFilter struct {
NeighborIp *bio_net.IP `protobuf:"bytes,1,opt,name=neighbor_ip,json=neighborIp" json:"neighbor_ip,omitempty"`
VrfName string `protobuf:"bytes,2,opt,name=vrf_name,json=vrfName" json:"vrf_name,omitempty"`
NeighborIp *api.IP `protobuf:"bytes,1,opt,name=neighbor_ip,json=neighborIp,proto3" json:"neighbor_ip,omitempty"`
VrfName string `protobuf:"bytes,2,opt,name=vrf_name,json=vrfName,proto3" json:"vrf_name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SessionFilter) Reset() { *m = SessionFilter{} }
func (m *SessionFilter) String() string { return proto.CompactTextString(m) }
func (*SessionFilter) ProtoMessage() {}
func (*SessionFilter) Descriptor() ([]byte, []int) {
return fileDescriptor_2d4ce551e16bb738, []int{1}
}
func (m *SessionFilter) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SessionFilter.Unmarshal(m, b)
}
func (m *SessionFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SessionFilter.Marshal(b, m, deterministic)
}
func (m *SessionFilter) XXX_Merge(src proto.Message) {
xxx_messageInfo_SessionFilter.Merge(m, src)
}
func (m *SessionFilter) XXX_Size() int {
return xxx_messageInfo_SessionFilter.Size(m)
}
func (m *SessionFilter) XXX_DiscardUnknown() {
xxx_messageInfo_SessionFilter.DiscardUnknown(m)
}
func (m *SessionFilter) Reset() { *m = SessionFilter{} }
func (m *SessionFilter) String() string { return proto.CompactTextString(m) }
func (*SessionFilter) ProtoMessage() {}
func (*SessionFilter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
var xxx_messageInfo_SessionFilter proto.InternalMessageInfo
func (m *SessionFilter) GetNeighborIp() *bio_net.IP {
func (m *SessionFilter) GetNeighborIp() *api.IP {
if m != nil {
return m.NeighborIp
}
......@@ -81,13 +111,36 @@ func (m *SessionFilter) GetVrfName() string {
}
type ListSessionsResponse struct {
Sessions []*Session `protobuf:"bytes,1,rep,name=sessions" json:"sessions,omitempty"`
Sessions []*Session `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListSessionsResponse) Reset() { *m = ListSessionsResponse{} }
func (m *ListSessionsResponse) String() string { return proto.CompactTextString(m) }
func (*ListSessionsResponse) ProtoMessage() {}
func (*ListSessionsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2d4ce551e16bb738, []int{2}
}
func (m *ListSessionsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListSessionsResponse.Unmarshal(m, b)
}
func (m *ListSessionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListSessionsResponse.Marshal(b, m, deterministic)
}
func (m *ListSessionsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListSessionsResponse.Merge(m, src)
}
func (m *ListSessionsResponse) XXX_Size() int {
return xxx_messageInfo_ListSessionsResponse.Size(m)
}
func (m *ListSessionsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListSessionsResponse.DiscardUnknown(m)
}
func (m *ListSessionsResponse) Reset() { *m = ListSessionsResponse{} }
func (m *ListSessionsResponse) String() string { return proto.CompactTextString(m) }
func (*ListSessionsResponse) ProtoMessage() {}
func (*ListSessionsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
var xxx_messageInfo_ListSessionsResponse proto.InternalMessageInfo
func (m *ListSessionsResponse) GetSessions() []*Session {
if m != nil {
......@@ -97,17 +150,40 @@ func (m *ListSessionsResponse) GetSessions() []*Session {
}
type DumpRIBRequest struct {
Peer *bio_net.IP `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"`
Afi uint32 `protobuf:"varint,2,opt,name=afi" json:"afi,omitempty"`
Safi uint32 `protobuf:"varint,3,opt,name=safi" json:"safi,omitempty"`
Peer *api.IP `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"`
Afi uint32 `protobuf:"varint,2,opt,name=afi,proto3" json:"afi,omitempty"`
Safi uint32 `protobuf:"varint,3,opt,name=safi,proto3" json:"safi,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DumpRIBRequest) Reset() { *m = DumpRIBRequest{} }
func (m *DumpRIBRequest) String() string { return proto.CompactTextString(m) }
func (*DumpRIBRequest) ProtoMessage() {}
func (*DumpRIBRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2d4ce551e16bb738, []int{3}
}
func (m *DumpRIBRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DumpRIBRequest.Unmarshal(m, b)
}
func (m *DumpRIBRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DumpRIBRequest.Marshal(b, m, deterministic)
}
func (m *DumpRIBRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DumpRIBRequest.Merge(m, src)
}
func (m *DumpRIBRequest) XXX_Size() int {
return xxx_messageInfo_DumpRIBRequest.Size(m)
}
func (m *DumpRIBRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DumpRIBRequest.DiscardUnknown(m)
}
func (m *DumpRIBRequest) Reset() { *m = DumpRIBRequest{} }
func (m *DumpRIBRequest) String() string { return proto.CompactTextString(m) }
func (*DumpRIBRequest) ProtoMessage() {}
func (*DumpRIBRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
var xxx_messageInfo_DumpRIBRequest proto.InternalMessageInfo
func (m *DumpRIBRequest) GetPeer() *bio_net.IP {
func (m *DumpRIBRequest) GetPeer() *api.IP {
if m != nil {
return m.Peer
}
......@@ -135,6 +211,38 @@ func init() {
proto.RegisterType((*DumpRIBRequest)(nil), "bio.bgp.DumpRIBRequest")
}
func init() {
proto.RegisterFile("github.com/bio-routing/bio-rd/protocols/bgp/api/bgp.proto", fileDescriptor_2d4ce551e16bb738)
}
var fileDescriptor_2d4ce551e16bb738 = []byte{
// 382 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xcb, 0x6a, 0xdb, 0x40,
0x14, 0xb5, 0x6a, 0xe3, 0xc7, 0x55, 0x5d, 0xcc, 0xb4, 0xb4, 0xae, 0x68, 0xa9, 0xd1, 0xca, 0x0b,
0x57, 0x6a, 0xed, 0x55, 0x1b, 0xb2, 0x31, 0x4e, 0x40, 0x90, 0x17, 0xe3, 0x45, 0x42, 0x36, 0x46,
0x72, 0x46, 0xf2, 0x80, 0x35, 0x33, 0xd1, 0x8c, 0xfc, 0xa5, 0xf9, 0xa0, 0xa0, 0xd1, 0x58, 0x44,
0x21, 0x31, 0x78, 0x23, 0x5d, 0x9d, 0xc7, 0xe5, 0x1c, 0x71, 0xe1, 0x5f, 0x42, 0xd5, 0x26, 0x8f,
0xbc, 0x35, 0x4f, 0xfd, 0x88, 0xf2, 0xdf, 0x19, 0xcf, 0x15, 0x65, 0x49, 0x39, 0x3f, 0xf8, 0x22,
0xe3, 0x8a, 0xaf, 0xf9, 0x56, 0xfa, 0x51, 0x22, 0xfc, 0x50, 0xd0, 0xe2, 0xed, 0x69, 0x14, 0x75,
0x22, 0xca, 0xbd, 0x28, 0x11, 0x8e, 0x7f, 0x78, 0x07, 0x23, 0x4a, 0x3b, 0x19, 0x51, 0xa5, 0xd3,
0x99, 0x1d, 0x36, 0x14, 0x9f, 0x44, 0x5b, 0xf4, 0x64, 0x4c, 0xa7, 0xc7, 0x26, 0x95, 0x44, 0x4a,
0xca, 0x59, 0x69, 0x77, 0xcf, 0xe0, 0xf3, 0x05, 0x95, 0x6a, 0x59, 0x82, 0x12, 0x93, 0xc7, 0x9c,
0x48, 0x85, 0x3c, 0x68, 0xc7, 0x74, 0xab, 0x48, 0x36, 0xb4, 0x46, 0xd6, 0xd8, 0x9e, 0x7e, 0xf5,
0x4c, 0x2b, 0xcf, 0x28, 0xcf, 0x35, 0x8b, 0x8d, 0xca, 0xbd, 0x83, 0x7e, 0x8d, 0x40, 0x13, 0xb0,
0x19, 0xa1, 0xc9, 0x26, 0xe2, 0xd9, 0x8a, 0x0a, 0xb3, 0xc5, 0xd6, 0x5b, 0x8a, 0xc2, 0xc1, 0x0d,
0x86, 0x3d, 0x1f, 0x08, 0xf4, 0x1d, 0xba, 0xbb, 0x2c, 0x5e, 0xb1, 0x30, 0x25, 0xc3, 0x0f, 0x23,
0x6b, 0xdc, 0xc3, 0x9d, 0x5d, 0x16, 0x5f, 0x85, 0x29, 0x71, 0x17, 0xf0, 0xa5, 0x1e, 0x50, 0x0a,
0xce, 0x24, 0x41, 0x13, 0xe8, 0x9a, 0x26, 0x72, 0x68, 0x8d, 0x9a, 0x63, 0x7b, 0x3a, 0x78, 0x9d,
0x11, 0x57, 0x0a, 0xf7, 0x16, 0x3e, 0x2d, 0xf2, 0x54, 0xe0, 0x60, 0xbe, 0x6f, 0xf8, 0x0b, 0x5a,
0x82, 0x54, 0xfd, 0x6a, 0xc9, 0x34, 0x81, 0x06, 0xd0, 0x0c, 0x63, 0xaa, 0xe3, 0xf4, 0x71, 0x31,
0x22, 0x04, 0x2d, 0x59, 0x40, 0x4d, 0x0d, 0xe9, 0x79, 0xfa, 0x64, 0x01, 0xcc, 0x13, 0xb1, 0x24,
0xd9, 0x8e, 0xae, 0x09, 0xba, 0x84, 0x8f, 0x2f, 0xd3, 0xa2, 0x1f, 0x55, 0xa6, 0x37, 0xfe, 0xb2,
0xf3, 0xf3, 0x1d, 0xb6, 0xac, 0xe8, 0x36, 0xd0, 0x7f, 0xe8, 0x99, 0xd8, 0x01, 0x43, 0xdf, 0x2a,
0x75, 0xbd, 0x8a, 0x53, 0x16, 0x2f, 0x8f, 0x02, 0x17, 0x4f, 0xb7, 0xf1, 0xc7, 0x42, 0x27, 0x00,
0x46, 0x77, 0x9d, 0xab, 0x23, 0xcd, 0xf3, 0xbf, 0xf7, 0xfe, 0x91, 0x77, 0x15, 0xb5, 0x35, 0x34,
0x7b, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x47, 0x78, 0x29, 0x1d, 0x3b, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
......@@ -143,8 +251,9 @@ var _ grpc.ClientConn
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for BgpService service
// BgpServiceClient is the client API for BgpService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type BgpServiceClient interface {
ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error)
DumpRIBIn(ctx context.Context, in *DumpRIBRequest, opts ...grpc.CallOption) (BgpService_DumpRIBInClient, error)
......@@ -161,7 +270,7 @@ func NewBgpServiceClient(cc *grpc.ClientConn) BgpServiceClient {
func (c *bgpServiceClient) ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error) {
out := new(ListSessionsResponse)
err := grpc.Invoke(ctx, "/bio.bgp.BgpService/ListSessions", in, out, c.cc, opts...)
err := c.cc.Invoke(ctx, "/bio.bgp.BgpService/ListSessions", in, out, opts...)
if err != nil {
return nil, err
}
......@@ -169,7 +278,7 @@ func (c *bgpServiceClient) ListSessions(ctx context.Context, in *ListSessionsReq
}
func (c *bgpServiceClient) DumpRIBIn(ctx context.Context, in *DumpRIBRequest, opts ...grpc.CallOption) (BgpService_DumpRIBInClient, error) {
stream, err := grpc.NewClientStream(ctx, &_BgpService_serviceDesc.Streams[0], c.cc, "/bio.bgp.BgpService/DumpRIBIn", opts...)
stream, err := c.cc.NewStream(ctx, &_BgpService_serviceDesc.Streams[0], "/bio.bgp.BgpService/DumpRIBIn", opts...)
if err != nil {
return nil, err
}
......@@ -184,7 +293,7 @@ func (c *bgpServiceClient) DumpRIBIn(ctx context.Context, in *DumpRIBRequest, op
}
type BgpService_DumpRIBInClient interface {
Recv() (*bio_route.Route, error)
Recv() (*api1.Route, error)
grpc.ClientStream
}
......@@ -192,8 +301,8 @@ type bgpServiceDumpRIBInClient struct {
grpc.ClientStream
}
func (x *bgpServiceDumpRIBInClient) Recv() (*bio_route.Route, error) {
m := new(bio_route.Route)
func (x *bgpServiceDumpRIBInClient) Recv() (*api1.Route, error) {
m := new(api1.Route)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
......@@ -201,7 +310,7 @@ func (x *bgpServiceDumpRIBInClient) Recv() (*bio_route.Route, error) {
}
func (c *bgpServiceClient) DumpRIBOut(ctx context.Context, in *DumpRIBRequest, opts ...grpc.CallOption) (BgpService_DumpRIBOutClient, error) {
stream, err := grpc.NewClientStream(ctx, &_BgpService_serviceDesc.Streams[1], c.cc, "/bio.bgp.BgpService/DumpRIBOut", opts...)
stream, err := c.cc.NewStream(ctx, &_BgpService_serviceDesc.Streams[1], "/bio.bgp.BgpService/DumpRIBOut", opts...)
if err != nil {
return nil, err
}
......@@ -216,7 +325,7 @@ func (c *bgpServiceClient) DumpRIBOut(ctx context.Context, in *DumpRIBRequest, o
}
type BgpService_DumpRIBOutClient interface {
Recv() (*bio_route.Route, error)
Recv() (*api1.Route, error)
grpc.ClientStream
}
......@@ -224,16 +333,15 @@ type bgpServiceDumpRIBOutClient struct {
grpc.ClientStream
}
func (x *bgpServiceDumpRIBOutClient) Recv() (*bio_route.Route, error) {
m := new(bio_route.Route)
func (x *bgpServiceDumpRIBOutClient) Recv() (*api1.Route, error) {
m := new(api1.Route)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for BgpService service
// BgpServiceServer is the server API for BgpService service.
type BgpServiceServer interface {
ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
DumpRIBIn(*DumpRIBRequest, BgpService_DumpRIBInServer) error
......@@ -271,7 +379,7 @@ func _BgpService_DumpRIBIn_Handler(srv interface{}, stream grpc.ServerStream) er
}
type BgpService_DumpRIBInServer interface {
Send(*bio_route.Route) error
Send(*api1.Route) error
grpc.ServerStream
}
......@@ -279,7 +387,7 @@ type bgpServiceDumpRIBInServer struct {
grpc.ServerStream
}
func (x *bgpServiceDumpRIBInServer) Send(m *bio_route.Route) error {
func (x *bgpServiceDumpRIBInServer) Send(m *api1.Route) error {
return x.ServerStream.SendMsg(m)
}
......@@ -292,7 +400,7 @@ func _BgpService_DumpRIBOut_Handler(srv interface{}, stream grpc.ServerStream) e
}
type BgpService_DumpRIBOutServer interface {
Send(*bio_route.Route) error
Send(*api1.Route) error
grpc.ServerStream
}
......@@ -300,7 +408,7 @@ type bgpServiceDumpRIBOutServer struct {
grpc.ServerStream
}
func (x *bgpServiceDumpRIBOutServer) Send(m *bio_route.Route) error {
func (x *bgpServiceDumpRIBOutServer) Send(m *api1.Route) error {
return x.ServerStream.SendMsg(m)
}
......@@ -327,35 +435,3 @@ var _BgpService_serviceDesc = grpc.ServiceDesc{
},
Metadata: "github.com/bio-routing/bio-rd/protocols/bgp/api/bgp.proto",
}
func init() {
proto.RegisterFile("github.com/bio-routing/bio-rd/protocols/bgp/api/bgp.proto", fileDescriptor0)
}
var fileDescriptor0 = []byte{
// 382 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xcb, 0x6a, 0xdb, 0x40,
0x14, 0xb5, 0x6a, 0xe3, 0xc7, 0x55, 0x5d, 0xcc, 0xb4, 0xb4, 0xae, 0x68, 0xa9, 0xd1, 0xca, 0x0b,
0x57, 0x6a, 0xed, 0x55, 0x1b, 0xb2, 0x31, 0x4e, 0x40, 0x90, 0x17, 0xe3, 0x45, 0x42, 0x36, 0x46,
0x72, 0x46, 0xf2, 0x80, 0x35, 0x33, 0xd1, 0x8c, 0xfc, 0xa5, 0xf9, 0xa0, 0xa0, 0xd1, 0x58, 0x44,
0x21, 0x31, 0x78, 0x23, 0x5d, 0x9d, 0xc7, 0xe5, 0x1c, 0x71, 0xe1, 0x5f, 0x42, 0xd5, 0x26, 0x8f,
0xbc, 0x35, 0x4f, 0xfd, 0x88, 0xf2, 0xdf, 0x19, 0xcf, 0x15, 0x65, 0x49, 0x39, 0x3f, 0xf8, 0x22,
0xe3, 0x8a, 0xaf, 0xf9, 0x56, 0xfa, 0x51, 0x22, 0xfc, 0x50, 0xd0, 0xe2, 0xed, 0x69, 0x14, 0x75,
0x22, 0xca, 0xbd, 0x28, 0x11, 0x8e, 0x7f, 0x78, 0x07, 0x23, 0x4a, 0x3b, 0x19, 0x51, 0xa5, 0xd3,
0x99, 0x1d, 0x36, 0x14, 0x9f, 0x44, 0x5b, 0xf4, 0x64, 0x4c, 0xa7, 0xc7, 0x26, 0x95, 0x44, 0x4a,
0xca, 0x59, 0x69, 0x77, 0xcf, 0xe0, 0xf3, 0x05, 0x95, 0x6a, 0x59, 0x82, 0x12, 0x93, 0xc7, 0x9c,
0x48, 0x85, 0x3c, 0x68, 0xc7, 0x74, 0xab, 0x48, 0x36, 0xb4, 0x46, 0xd6, 0xd8, 0x9e, 0x7e, 0xf5,
0x4c, 0x2b, 0xcf, 0x28, 0xcf, 0x35, 0x8b, 0x8d, 0xca, 0xbd, 0x83, 0x7e, 0x8d, 0x40, 0x13, 0xb0,
0x19, 0xa1, 0xc9, 0x26, 0xe2, 0xd9, 0x8a, 0x0a, 0xb3, 0xc5, 0xd6, 0x5b, 0x8a, 0xc2, 0xc1, 0x0d,
0x86, 0x3d, 0x1f, 0x08, 0xf4, 0x1d, 0xba, 0xbb, 0x2c, 0x5e, 0xb1, 0x30, 0x25, 0xc3, 0x0f, 0x23,
0x6b, 0xdc, 0xc3, 0x9d, 0x5d, 0x16, 0x5f, 0x85, 0x29, 0x71, 0x17, 0xf0, 0xa5, 0x1e, 0x50, 0x0a,
0xce, 0x24, 0x41, 0x13, 0xe8, 0x9a, 0x26, 0x72, 0x68, 0x8d, 0x9a, 0x63, 0x7b, 0x3a, 0x78, 0x9d,
0x11, 0x57, 0x0a, 0xf7, 0x16, 0x3e, 0x2d, 0xf2, 0x54, 0xe0, 0x60, 0xbe, 0x6f, 0xf8, 0x0b, 0x5a,
0x82, 0x54, 0xfd, 0x6a, 0xc9, 0x34, 0x81, 0x06, 0xd0, 0x0c, 0x63, 0xaa, 0xe3, 0xf4, 0x71, 0x31,
0x22, 0x04, 0x2d, 0x59, 0x40, 0x4d, 0x0d, 0xe9, 0x79, 0xfa, 0x64, 0x01, 0xcc, 0x13, 0xb1, 0x24,
0xd9, 0x8e, 0xae, 0x09, 0xba, 0x84, 0x8f, 0x2f, 0xd3, 0xa2, 0x1f, 0x55, 0xa6, 0x37, 0xfe, 0xb2,
0xf3, 0xf3, 0x1d, 0xb6, 0xac, 0xe8, 0x36, 0xd0, 0x7f, 0xe8, 0x99, 0xd8, 0x01, 0x43, 0xdf, 0x2a,
0x75, 0xbd, 0x8a, 0x53, 0x16, 0x2f, 0x8f, 0x02, 0x17, 0x4f, 0xb7, 0xf1, 0xc7, 0x42, 0x27, 0x00,
0x46, 0x77, 0x9d, 0xab, 0x23, 0xcd, 0xf3, 0xbf, 0xf7, 0xfe, 0x91, 0x77, 0x15, 0xb5, 0x35, 0x34,
0x7b, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x47, 0x78, 0x29, 0x1d, 0x3b, 0x03, 0x00, 0x00,
}
......@@ -3,16 +3,24 @@
package api
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import bio_net "github.com/bio-routing/bio-rd/net/api"
import (
fmt "fmt"
api "github.com/bio-routing/bio-rd/net/api"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Session_State int32
const (
......@@ -34,6 +42,7 @@ var Session_State_name = map[int32]string{
5: "OpenConfirmed",
6: "Established",
}
var Session_State_value = map[string]int32{
"Disabled": 0,
"Idle": 1,
......@@ -47,31 +56,57 @@ var Session_State_value = map[string]int32{
func (x Session_State) String() string {
return proto.EnumName(Session_State_name, int32(x))
}
func (Session_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} }
func (Session_State) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_5b53032c0bb76d75, []int{0, 0}
}
type Session struct {
LocalAddress *bio_net.IP `protobuf:"bytes,1,opt,name=local_address,json=localAddress" json:"local_address,omitempty"`
NeighborAddress *bio_net.IP `protobuf:"bytes,2,opt,name=neighbor_address,json=neighborAddress" json:"neighbor_address,omitempty"`
LocalAsn uint32 `protobuf:"varint,3,opt,name=local_asn,json=localAsn" json:"local_asn,omitempty"`
PeerAsn uint32 `protobuf:"varint,4,opt,name=peer_asn,json=peerAsn" json:"peer_asn,omitempty"`
Status Session_State `protobuf:"varint,5,opt,name=status,enum=bio.bgp.Session_State" json:"status,omitempty"`
Stats *SessionStats `protobuf:"bytes,6,opt,name=stats" json:"stats,omitempty"`
EstablishedSince uint64 `protobuf:"varint,7,opt,name=established_since,json=establishedSince" json:"established_since,omitempty"`
LocalAddress *api.IP `protobuf:"bytes,1,opt,name=local_address,json=localAddress,proto3" json:"local_address,omitempty"`
NeighborAddress *api.IP `protobuf:"bytes,2,opt,name=neighbor_address,json=neighborAddress,proto3" json:"neighbor_address,omitempty"`
LocalAsn uint32 `protobuf:"varint,3,opt,name=local_asn,json=localAsn,proto3" json:"local_asn,omitempty"`
PeerAsn uint32 `protobuf:"varint,4,opt,name=peer_asn,json=peerAsn,proto3" json:"peer_asn,omitempty"`
Status Session_State `protobuf:"varint,5,opt,name=status,proto3,enum=bio.bgp.Session_State" json:"status,omitempty"`
Stats *SessionStats `protobuf:"bytes,6,opt,name=stats,proto3" json:"stats,omitempty"`
EstablishedSince uint64 `protobuf:"varint,7,opt,name=established_since,json=establishedSince,proto3" json:"established_since,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Session) Reset() { *m = Session{} }
func (m *Session) String() string { return proto.CompactTextString(m) }
func (*Session) ProtoMessage() {}
func (*Session) Descriptor() ([]byte, []int) {
return fileDescriptor_5b53032c0bb76d75, []int{0}
}
func (m *Session) Reset() { *m = Session{} }
func (m *Session) String() string { return proto.CompactTextString(m) }
func (*Session) ProtoMessage() {}
func (*Session) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
func (m *Session) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Session.Unmarshal(m, b)
}
func (m *Session) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Session.Marshal(b, m, deterministic)
}
func (m *Session) XXX_Merge(src proto.Message) {
xxx_messageInfo_Session.Merge(m, src)
}
func (m *Session) XXX_Size() int {
return xxx_messageInfo_Session.Size(m)
}
func (m *Session) XXX_DiscardUnknown() {
xxx_messageInfo_Session.DiscardUnknown(m)
}
func (m *Session) GetLocalAddress() *bio_net.IP {
var xxx_messageInfo_Session proto.InternalMessageInfo
func (m *Session) GetLocalAddress() *api.IP {
if m != nil {
return m.LocalAddress
}
return nil
}
func (m *Session) GetNeighborAddress() *bio_net.IP {
func (m *Session) GetNeighborAddress() *api.IP {
if m != nil {
return m.NeighborAddress
}
......@@ -114,18 +149,41 @@ func (m *Session) GetEstablishedSince() uint64 {
}
type SessionStats struct {
MessagesIn uint64 `protobuf:"varint,1,opt,name=messages_in,json=messagesIn" json:"messages_in,omitempty"`
MessagesOut uint64 `protobuf:"varint,2,opt,name=messages_out,json=messagesOut" json:"messages_out,omitempty"`
Flaps uint64 `protobuf:"varint,3,opt,name=flaps" json:"flaps,omitempty"`
RoutesReceived uint64 `protobuf:"varint,4,opt,name=routes_received,json=routesReceived" json:"routes_received,omitempty"`
RoutesImported uint64 `protobuf:"varint,5,opt,name=routes_imported,json=routesImported" json:"routes_imported,omitempty"`
RoutesExported uint64 `protobuf:"varint,6,opt,name=routes_exported,json=routesExported" json:"routes_exported,omitempty"`
MessagesIn uint64 `protobuf:"varint,1,opt,name=messages_in,json=messagesIn,proto3" json:"messages_in,omitempty"`
MessagesOut uint64 `protobuf:"varint,2,opt,name=messages_out,json=messagesOut,proto3" json:"messages_out,omitempty"`
Flaps uint64 `protobuf:"varint,3,opt,name=flaps,proto3" json:"flaps,omitempty"`
RoutesReceived uint64 `protobuf:"varint,4,opt,name=routes_received,json=routesReceived,proto3" json:"routes_received,omitempty"`
RoutesImported uint64 `protobuf:"varint,5,opt,name=routes_imported,json=routesImported,proto3" json:"routes_imported,omitempty"`
RoutesExported uint64 `protobuf:"varint,6,opt,name=routes_exported,json=routesExported,proto3" json:"routes_exported,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SessionStats) Reset() { *m = SessionStats{} }
func (m *SessionStats) String() string { return proto.CompactTextString(m) }
func (*SessionStats) ProtoMessage() {}
func (*SessionStats) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
func (m *SessionStats) Reset() { *m = SessionStats{} }
func (m *SessionStats) String() string { return proto.CompactTextString(m) }
func (*SessionStats) ProtoMessage() {}
func (*SessionStats) Descriptor() ([]byte, []int) {
return fileDescriptor_5b53032c0bb76d75, []int{1}
}
func (m *SessionStats) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SessionStats.Unmarshal(m, b)
}
func (m *SessionStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SessionStats.Marshal(b, m, deterministic)
}
func (m *SessionStats) XXX_Merge(src proto.Message) {
xxx_messageInfo_SessionStats.Merge(m, src)
}
func (m *SessionStats) XXX_Size() int {
return xxx_messageInfo_SessionStats.Size(m)
}
func (m *SessionStats) XXX_DiscardUnknown() {
xxx_messageInfo_SessionStats.DiscardUnknown(m)
}
var xxx_messageInfo_SessionStats proto.InternalMessageInfo
func (m *SessionStats) GetMessagesIn() uint64 {
if m != nil {
......@@ -170,16 +228,16 @@ func (m *SessionStats) GetRoutesExported() uint64 {
}
func init() {
proto.RegisterEnum("bio.bgp.Session_State", Session_State_name, Session_State_value)
proto.RegisterType((*Session)(nil), "bio.bgp.Session")
proto.RegisterType((*SessionStats)(nil), "bio.bgp.SessionStats")
proto.RegisterEnum("bio.bgp.Session_State", Session_State_name, Session_State_value)
}
func init() {
proto.RegisterFile("github.com/bio-routing/bio-rd/protocols/bgp/api/session.proto", fileDescriptor1)
proto.RegisterFile("github.com/bio-routing/bio-rd/protocols/bgp/api/session.proto", fileDescriptor_5b53032c0bb76d75)
}
var fileDescriptor1 = []byte{
var fileDescriptor_5b53032c0bb76d75 = []byte{
// 469 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4d, 0x6f, 0xd3, 0x4e,
0x10, 0xc6, 0xff, 0x6e, 0xfc, 0x92, 0xff, 0x38, 0x69, 0xdc, 0x15, 0x20, 0x03, 0x07, 0x42, 0x2e,
......
package metrics
import (
vrf_metrics "github.com/bio-routing/bio-rd/routingtable/vrf/metrics"
)
// BMPMetrics contains per router BMP metrics
type BMPMetrics struct {
Routers []*BMPRouterMetrics
}
// BMPRouterMetrics contains a routers BMP metrics
type BMPRouterMetrics struct {
// Name of the monitored routers
Name string
// Count of received RouteMonitoringMessages
RouteMonitoringMessages uint64
// Count of received StatisticsReportMessages
StatisticsReportMessages uint64
// Count of received PeerDownNotificationMessages
PeerDownNotificationMessages uint64
// Count of received PeerUpNotificationMessages
PeerUpNotificationMessages uint64
// Count of received InitiationMessages
InitiationMessages uint64
// Count of received TerminationMessages
TerminationMessages uint64
// Count of received RouteMirroringMessages
RouteMirroringMessages uint64
// VRFMetrics represent per VRF metrics
VRFMetrics []*vrf_metrics.VRFMetrics
// PeerMetrics contains BGP per peer metrics
PeerMetrics []*BGPPeerMetrics
}
......@@ -120,11 +120,11 @@ func TestDumpRIBInOut(t *testing.T) {
Paths: []*routeapi.Path{
{
Type: routeapi.Path_BGP,
BGPPath: &routeapi.BGPPath{
BgpPath: &routeapi.BGPPath{
OriginatorId: 1,
NextHop: bnet.IPv4FromOctets(100, 100, 100, 100).ToProto(),
Source: bnet.IPv4FromOctets(100, 100, 100, 100).ToProto(),
ASPath: nil,
AsPath: nil,
Communities: nil,
LargeCommunities: nil,
UnknownAttributes: nil,
......@@ -203,16 +203,16 @@ func TestDumpRIBInOut(t *testing.T) {
Paths: []*routeapi.Path{
{
Type: routeapi.Path_BGP,
BGPPath: &routeapi.BGPPath{
BgpPath: &routeapi.BGPPath{
OriginatorId: 1,
LocalPref: 1000,
MED: 2000,
Med: 2000,
NextHop: bnet.IPv4FromOctets(100, 100, 100, 100).ToProto(),
Source: bnet.IPv4FromOctets(100, 100, 100, 100).ToProto(),
ASPath: []*routeapi.ASPathSegment{
AsPath: []*routeapi.ASPathSegment{
{
ASSequence: true,
ASNs: []uint32{15169, 3320},
AsSequence: true,
Asns: []uint32{15169, 3320},
},
},
Communities: []uint32{100, 200, 300},
......
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