summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--api/gobgp.pb.go2
-rw-r--r--api/gobgp.proto2
-rw-r--r--cmd/gobgpd/main.go2
-rw-r--r--internal/pkg/config/bgp_configs.go18
-rw-r--r--internal/pkg/config/default.go7
-rw-r--r--pkg/server/bmp.go7
-rw-r--r--pkg/server/server.go2
-rw-r--r--tools/pyang_plugins/README.rst2
-rw-r--r--tools/pyang_plugins/gobgp.yang12
9 files changed, 52 insertions, 2 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go
index 7f0163c7..eca6e51f 100644
--- a/api/gobgp.pb.go
+++ b/api/gobgp.pb.go
@@ -2370,6 +2370,8 @@ type AddBmpRequest struct {
Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
Policy AddBmpRequest_MonitoringPolicy `protobuf:"varint,3,opt,name=policy,enum=gobgpapi.AddBmpRequest_MonitoringPolicy" json:"policy,omitempty"`
StatisticsTimeout int32 `protobuf:"varint,4,opt,name=StatisticsTimeout,json=statisticsTimeout" json:"StatisticsTimeout,omitempty"`
+ SysName string `protobuf:"bytes,5,opt,name=SysName,proto3" json:"SysName,omitempty"`
+ SysDescr string `protobuf:"bytes,6,opt,name=SysDescr,proto3" json:"SysDescr,omitempty"`
}
func (m *AddBmpRequest) Reset() { *m = AddBmpRequest{} }
diff --git a/api/gobgp.proto b/api/gobgp.proto
index 0ff0b94f..5ae6bc8d 100644
--- a/api/gobgp.proto
+++ b/api/gobgp.proto
@@ -439,6 +439,8 @@ message AddBmpRequest {
}
MonitoringPolicy policy = 3;
int32 StatisticsTimeout = 4;
+ string SysName = 5;
+ string SysDescr = 6;
}
message DeleteBmpRequest {
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go
index 0760ae3a..06b38b88 100644
--- a/cmd/gobgpd/main.go
+++ b/cmd/gobgpd/main.go
@@ -279,6 +279,8 @@ func main() {
if err := bgpServer.AddBmp(context.Background(), &api.AddBmpRequest{
Address: c.Config.Address,
Port: c.Config.Port,
+ SysName: c.Config.SysName,
+ SysDescr: c.Config.SysDescr,
Policy: api.AddBmpRequest_MonitoringPolicy(c.Config.RouteMonitoringPolicy.ToInt()),
StatisticsTimeout: int32(c.Config.StatisticsTimeout),
}); err != nil {
diff --git a/internal/pkg/config/bgp_configs.go b/internal/pkg/config/bgp_configs.go
index a49bfe57..f5a8215b 100644
--- a/internal/pkg/config/bgp_configs.go
+++ b/internal/pkg/config/bgp_configs.go
@@ -1394,6 +1394,12 @@ type BmpServerState struct {
// Enable feature for mirroring of received BGP messages
// mainly for debugging purpose.
RouteMirroringEnabled bool `mapstructure:"route-mirroring-enabled" json:"route-mirroring-enabled,omitempty"`
+ // original -> gobgp:sys-name
+ // Reference to the SysName of the BMP server.
+ SysName string `mapstructure:"sys-name" json:"sys-name,omitempty"`
+ // original -> gobgp:sys-descr
+ // Reference to the SysDescr of the BMP server.
+ SysDescr string `mapstructure:"sys-descr" json:"sys-descr,omitempty"`
}
// struct for container gobgp:config.
@@ -1417,6 +1423,12 @@ type BmpServerConfig struct {
// Enable feature for mirroring of received BGP messages
// mainly for debugging purpose.
RouteMirroringEnabled bool `mapstructure:"route-mirroring-enabled" json:"route-mirroring-enabled,omitempty"`
+ // original -> gobgp:sys-name
+ // Reference to the SysName of the BMP server.
+ SysName string `mapstructure:"sys-name" json:"sys-name,omitempty"`
+ // original -> gobgp:sys-descr
+ // Reference to the SysDescr of the BMP server.
+ SysDescr string `mapstructure:"sys-descr" json:"sys-descr,omitempty"`
}
func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool {
@@ -1438,6 +1450,12 @@ func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool {
if lhs.RouteMirroringEnabled != rhs.RouteMirroringEnabled {
return false
}
+ if lhs.SysName != rhs.SysName {
+ return false
+ }
+ if lhs.SysDescr != rhs.SysDescr {
+ return false
+ }
return true
}
diff --git a/internal/pkg/config/default.go b/internal/pkg/config/default.go
index 13e1267c..9bec51be 100644
--- a/internal/pkg/config/default.go
+++ b/internal/pkg/config/default.go
@@ -349,7 +349,14 @@ func setDefaultConfigValuesWithViper(v *viper.Viper, b *BgpConfigSet) error {
return err
}
+ bmpSysPrefix := "Gobgp-R"
for idx, server := range b.BmpServers {
+ if server.Config.SysName == "" {
+ server.Config.SysName = bmpSysPrefix + strconv.Itoa(idx)
+ }
+ if server.Config.SysDescr == "" {
+ server.Config.SysDescr = "Gobgp Version: master"
+ }
if server.Config.Port == 0 {
server.Config.Port = bmp.BMP_DEFAULT_PORT
}
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),
})
diff --git a/tools/pyang_plugins/README.rst b/tools/pyang_plugins/README.rst
index 910330d4..4c2636c8 100644
--- a/tools/pyang_plugins/README.rst
+++ b/tools/pyang_plugins/README.rst
@@ -37,4 +37,4 @@ Generate config/bgp_configs.go from yang files::
$HOME/public/release/models/bgp/openconfig-bgp.yang \
$HOME/public/release/models/policy/openconfig-routing-policy.yang \
$GOBGP_PATH/tools/pyang_plugins/gobgp.yang \
- | gofmt > $GOBGP_PATH/config/bgp_configs.go
+ | gofmt > $GOBGP_PATH/internal/pkg/config/bgp_configs.go
diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang
index 9379f6d5..5677ae32 100644
--- a/tools/pyang_plugins/gobgp.yang
+++ b/tools/pyang_plugins/gobgp.yang
@@ -590,6 +590,18 @@ module gobgp {
"Enable feature for mirroring of received BGP messages
mainly for debugging purpose";
}
+
+ leaf sys-name {
+ type string;
+ description
+ "Reference to the SysName of the BMP server";
+ }
+
+ leaf sys-descr {
+ type string;
+ description
+ "Reference to the SysDescr of the BMP server";
+ }
}
grouping gobgp-bmp-server-set {