feat: refine BGP template handling and documentation updates. Remove local IP requirements in BGP template options, simplifying the configuration to focus on ASN. Update OpenAPI documentation to clarify BIRD parameters and enhance user guidance on JSON settings format in the UI. Adjust tests to align with the new BGP template structure.
CI / changes (push) Successful in 5s
CI / openapi (push) Successful in 28s
CI / go (push) Successful in 25s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Successful in 1m3s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Successful in 1m21s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 16s
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Successful in 1m4s
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Successful in 2m31s
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Successful in 1m35s
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Successful in 1m21s
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Successful in 1m23s
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Successful in 1m19s
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Successful in 1m22s
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Successful in 1m22s
CI / changes (push) Successful in 5s
CI / openapi (push) Successful in 28s
CI / go (push) Successful in 25s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Successful in 1m3s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Successful in 1m21s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 16s
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Successful in 1m4s
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Successful in 2m31s
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Successful in 1m35s
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Successful in 1m21s
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Successful in 1m23s
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Successful in 1m19s
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Successful in 1m22s
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Successful in 1m22s
This commit is contained in:
+4
-12
@@ -11,10 +11,9 @@ const (
|
||||
BGPTemplateNameV6 = "bgp_template_v6"
|
||||
)
|
||||
|
||||
// BGPTemplatesOptions holds tenant defaults for template bgp bgp_template (+ v6 mirror).
|
||||
// BGPTemplatesOptions holds ASN and export filters for template bgp bgp_template (+ v6 mirror).
|
||||
// Templates use "local as <asn>;" only (no local IP); peers supply source address / optional local override.
|
||||
type BGPTemplatesOptions struct {
|
||||
LocalIPv4 string
|
||||
LocalIPv6 string
|
||||
LocalASN uint32
|
||||
ExportFilterV4 string
|
||||
ExportFilterV6 string
|
||||
@@ -22,9 +21,6 @@ type BGPTemplatesOptions struct {
|
||||
|
||||
// RenderBGPTemplates renders two template bgp blocks (IPv4 and IPv6 AFI).
|
||||
func RenderBGPTemplates(opts BGPTemplatesOptions) (string, error) {
|
||||
if strings.TrimSpace(opts.LocalIPv4) == "" || strings.TrimSpace(opts.LocalIPv6) == "" {
|
||||
return "", fmt.Errorf("birdfmt: template local IPv4 and IPv6 are required")
|
||||
}
|
||||
if opts.LocalASN == 0 {
|
||||
return "", fmt.Errorf("birdfmt: template local ASN must be non-zero")
|
||||
}
|
||||
@@ -38,9 +34,7 @@ func RenderBGPTemplates(opts BGPTemplatesOptions) (string, error) {
|
||||
}
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "template bgp %s {\n", BGPTemplateNameV4)
|
||||
b.WriteString(" local ")
|
||||
b.WriteString(strings.TrimSpace(opts.LocalIPv4))
|
||||
fmt.Fprintf(&b, " as %d;\n", opts.LocalASN)
|
||||
fmt.Fprintf(&b, " local as %d;\n", opts.LocalASN)
|
||||
b.WriteString(" ipv4 {\n")
|
||||
b.WriteString(" import all;\n")
|
||||
b.WriteString(" export ")
|
||||
@@ -49,9 +43,7 @@ func RenderBGPTemplates(opts BGPTemplatesOptions) (string, error) {
|
||||
b.WriteString(" };\n")
|
||||
b.WriteString("}\n\n")
|
||||
fmt.Fprintf(&b, "template bgp %s {\n", BGPTemplateNameV6)
|
||||
b.WriteString(" local ")
|
||||
b.WriteString(strings.TrimSpace(opts.LocalIPv6))
|
||||
fmt.Fprintf(&b, " as %d;\n", opts.LocalASN)
|
||||
fmt.Fprintf(&b, " local as %d;\n", opts.LocalASN)
|
||||
b.WriteString(" ipv6 {\n")
|
||||
b.WriteString(" import all;\n")
|
||||
b.WriteString(" export ")
|
||||
|
||||
@@ -30,8 +30,6 @@ func TestStandardLayout_GeneratorMatchesFixtures(t *testing.T) {
|
||||
assertFileEquals(t, "testdata/scenarios/standard_layout/bird.d/evobgp_prefixes_v6.conf", staticV6)
|
||||
|
||||
tpl, err := RenderBGPTemplates(BGPTemplatesOptions{
|
||||
LocalIPv4: "192.0.2.1",
|
||||
LocalIPv6: "2001:db8::1",
|
||||
LocalASN: 65001,
|
||||
ExportFilterV4: "evobgp_export_v4",
|
||||
ExportFilterV6: "evobgp_export_v6",
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
template bgp bgp_template {
|
||||
local 192.0.2.1 as 65001;
|
||||
local as 65001;
|
||||
ipv4 {
|
||||
import all;
|
||||
export filter evobgp_export_v4;
|
||||
@@ -7,7 +7,7 @@ template bgp bgp_template {
|
||||
}
|
||||
|
||||
template bgp bgp_template_v6 {
|
||||
local 2001:db8::1 as 65001;
|
||||
local as 65001;
|
||||
ipv6 {
|
||||
import all;
|
||||
export filter evobgp_export_v6;
|
||||
|
||||
Reference in New Issue
Block a user