added blackhole communities ranges to config

This commit is contained in:
Annika Hannig 2022-11-17 15:21:52 +01:00
parent a04d065423
commit 27a6b9806d
6 changed files with 34 additions and 8 deletions

View File

@ -97,8 +97,9 @@ load_on_demand = true # Default: false
[blackhole_communities]
65535:666
6695:1105-1189:*
6695:1111:10-90
12345:1105-1189:*
12345:1111:10-90
rt:1234:4200000000-4200010000
[rpki]
# shows rpki validation status in the client, based on the presence of a large

View File

@ -173,3 +173,19 @@ func (c BGPCommunityMap) Communities() Communities {
}
return communities
}
// BGPCommunityRange describes a range within a bgp community:
// It is a tuple with two values, the start and end.
type BGPCommunityRange []int
// RangedBGPCommunity is a list of BGPCommunity ranges,
// with 3 ranges in large communities.
type RangedBGPCommunity []interface{}
// A BGPCommunitiesSet is a set of communities, large and extended.
// The communities are described as ranges.
type BGPCommunitiesSet struct {
Communities []RangedBGPCommunity `json:"communities"`
ExtCommunities []RangedBGPCommunity `json:"ext_communities"`
LargeCommunities []RangedBGPCommunity `json:"large_communities"`
}

View File

@ -38,7 +38,8 @@ type ConfigResponse struct {
Rpki Rpki `json:"rpki"`
BGPCommunities map[string]interface{} `json:"bgp_communities"`
BGPCommunities map[string]interface{} `json:"bgp_communities"`
BGPBlackholeCommunities BGPCommunitiesSet `json:"bgp_blackhole_communities"`
NeighborsColumns map[string]string `json:"neighbors_columns"`
NeighborsColumnsOrder []string `json:"neighbors_columns_order"`

View File

@ -146,8 +146,9 @@ type UIConfig struct {
RoutesNoexports NoexportsConfig
RoutesRejectCandidates RejectCandidatesConfig
BGPCommunities api.BGPCommunityMap
Rpki RpkiConfig
BGPCommunities api.BGPCommunityMap
BGPBlackholeCommunities api.BGPCommunitiesSet
Rpki RpkiConfig
Theme ThemeConfig

View File

@ -128,6 +128,12 @@ invalid = 23042:1000:4-*
# Uptime Displays the relative uptime of this neighbour
# Description The neighbour's description with link to routes page
#
#
[blackhole_communities]
65535:666
12345:1105-1189:*
12345:1111:10-90
rt:1234:4200000000-4200010000
[neighbours_columns]
address = Neighbour

View File

@ -51,9 +51,10 @@ func (s *Server) apiConfigShow(
_params httprouter.Params,
) (response, error) {
result := api.ConfigResponse{
Asn: s.cfg.Server.Asn,
BGPCommunities: s.cfg.UI.BGPCommunities,
RejectReasons: s.cfg.UI.RoutesRejections.Reasons,
Asn: s.cfg.Server.Asn,
BGPCommunities: s.cfg.UI.BGPCommunities,
BGPBlackholeCommunities: s.cfg.UI.BGPBlackholeCommunities,
RejectReasons: s.cfg.UI.RoutesRejections.Reasons,
Noexport: api.Noexport{
LoadOnDemand: s.cfg.UI.RoutesNoexports.LoadOnDemand,
},