diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-04-05 15:26:42 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-17 21:57:11 +0900 |
commit | 7307b1490ec097921956d032f05e359ef2afdb9c (patch) | |
tree | 199a2d1320ff46f67f37b6e0f1be6c3266d7c0b2 | |
parent | 0f0f13417e4fbfd00ea1a2a75bf5f92fa78454e1 (diff) |
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 <iwase.yusuke0@gmail.com>
-rw-r--r-- | packet/bmp/bmp.go | 2 | ||||
-rw-r--r-- | server/bmp.go | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/packet/bmp/bmp.go b/packet/bmp/bmp.go index 7cf4f5e6..d931643c 100644 --- a/packet/bmp/bmp.go +++ b/packet/bmp/bmp.go @@ -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 { diff --git a/server/bmp.go b/server/bmp.go index 6f1a16ee..85016f47 100644 --- a/server/bmp.go +++ b/server/bmp.go @@ -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, |