From 80ff3a325cbced352489fa4ea4b570e5f08062ef Mon Sep 17 00:00:00 2001 From: JieJhih Jhang Date: Sat, 23 Mar 2019 21:52:06 +0800 Subject: support BMP sysName and sysDescr configuration --- pkg/server/bmp.go | 7 ++++++- pkg/server/server.go | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/server/bmp.go b/pkg/server/bmp.go index 724101ff..f96143c7 100644 --- a/pkg/server/bmp.go +++ b/pkg/server/bmp.go @@ -154,7 +154,12 @@ func (b *bmpClient) loop() { return err } - if err := write(bmp.NewBMPInitiation([]bmp.BMPInfoTLVInterface{})); err != nil { + tlv := []bmp.BMPInfoTLVInterface{ + bmp.NewBMPInfoTLVString(bmp.BMP_INIT_TLV_TYPE_SYS_NAME, b.c.SysName), + bmp.NewBMPInfoTLVString(bmp.BMP_INIT_TLV_TYPE_SYS_DESCR, b.c.SysDescr), + } + + if err := write(bmp.NewBMPInitiation(tlv)); err != nil { return false } diff --git a/pkg/server/server.go b/pkg/server/server.go index 9871d4ac..249b791c 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -1639,6 +1639,8 @@ func (s *BgpServer) AddBmp(ctx context.Context, r *api.AddBmpRequest) error { return s.bmpManager.addServer(&config.BmpServerConfig{ Address: r.Address, Port: r.Port, + SysName: r.SysName, + SysDescr: r.SysDescr, RouteMonitoringPolicy: config.IntToBmpRouteMonitoringPolicyTypeMap[int(r.Policy)], StatisticsTimeout: uint16(r.StatisticsTimeout), }) -- cgit v1.2.3