mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
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:
committed by
FUJITA Tomonori
parent
0f0f13417e
commit
7307b1490e
@@ -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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user