bmp: BMP Route Monitoring for Local RIB routes

This patch enable to send BMP Route Monitoring message for Local RIB
routes described in bmp-draft-evens-grow-bmp-local-rib.

Configuration Example: gobgpd.toml
  ...
  [[bmp-servers]]
    [bmp-servers.config]
      address = "127.0.0.1"
      port=11019
      route-monitoring-policy = "local-rib"
  ...

Signed-off-by: IWASE Yusuke <[email protected]>
This commit is contained in:
IWASE Yusuke
2017-04-17 21:57:11 +09:00
committed by FUJITA Tomonori
parent 0f0f13417e
commit 7307b1490e
2 changed files with 15 additions and 2 deletions
+2
View File
@@ -43,12 +43,14 @@ const (
BMP_PEER_TYPE_GLOBAL uint8 = iota
BMP_PEER_TYPE_L3VPN
BMP_PEER_TYPE_LOCAL
BMP_PEER_TYPE_LOCAL_RIB
)
const (
BMP_PEER_FLAG_IPV6 = 1 << 7
BMP_PEER_FLAG_POST_POLICY = 1 << 6
BMP_PEER_FLAG_TWO_AS = 1 << 5
BMP_PEER_FLAG_FILTERED = 1 << 6
)
func (h *BMPHeader) DecodeFromBytes(data []byte) error {
+13 -2
View File
@@ -113,10 +113,12 @@ func (b *bmpClient) loop() {
if func() bool {
ops := []WatchOption{WatchPeerState(true)}
if b.typ != config.BMP_ROUTE_MONITORING_POLICY_TYPE_POST_POLICY {
if b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_PRE_POLICY || b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_BOTH {
ops = append(ops, WatchUpdate(true))
} else if b.typ != config.BMP_ROUTE_MONITORING_POLICY_TYPE_PRE_POLICY {
} else if b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_POST_POLICY || b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_BOTH {
ops = append(ops, WatchPostUpdate(true))
} else if b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_LOCAL_RIB {
ops = append(ops, WatchBestPath(true))
}
w := b.s.Watch(ops...)
defer w.Stop()
@@ -162,6 +164,15 @@ func (b *bmpClient) loop() {
return false
}
}
case *WatchEventBestPath:
for _, p := range msg.PathList {
u := table.CreateUpdateMsgFromPaths([]*table.Path{p})[0]
if payload, err := u.Serialize(); err != nil {
return false
} else if err = write(bmpPeerRoute(bmp.BMP_PEER_TYPE_LOCAL_RIB, false, 0, p.GetSource(), p.GetTimestamp().Unix(), payload)); err != nil {
return false
}
}
case *WatchEventPeerState:
info := &table.PeerInfo{
Address: msg.PeerAddress,