From 1af040873ab8ed39964639bbef50086ca4f4e40a Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Thu, 8 Dec 2022 11:37:21 +0100 Subject: [PATCH] export mustParseTPL for use with firewall-controller (#91) --- pkg/netconf/frr.go | 2 +- pkg/netconf/frr_test.go | 2 +- pkg/netconf/hostname_test.go | 2 +- pkg/netconf/hosts_test.go | 2 +- pkg/netconf/nftables_test.go | 2 +- pkg/netconf/service_test.go | 2 +- pkg/netconf/template.go | 2 +- pkg/netconf/testdata/frr.conf.firewall | 2 +- pkg/netconf/testdata/frr.conf.firewall_dmz | 2 +- pkg/netconf/testdata/frr.conf.firewall_dmz_app | 2 +- pkg/netconf/testdata/frr.conf.firewall_dmz_app_storage | 2 +- pkg/netconf/testdata/frr.conf.firewall_ipv6 | 2 +- pkg/netconf/testdata/frr.conf.firewall_shared | 2 +- pkg/netconf/testdata/frr.conf.machine | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/netconf/frr.go b/pkg/netconf/frr.go index aa00024..8ce06b6 100644 --- a/pkg/netconf/frr.go +++ b/pkg/netconf/frr.go @@ -13,7 +13,7 @@ import ( const ( // FRRVersion holds a string that is used in the frr.conf to define the FRR version. - FRRVersion = "7.5" + FRRVersion = "8.3" // TplFirewallFRR defines the name of the template to render FRR configuration to a 'firewall'. TplFirewallFRR = "frr.firewall.tpl" // TplMachineFRR defines the name of the template to render FRR configuration to a 'machine'. diff --git a/pkg/netconf/frr_test.go b/pkg/netconf/frr_test.go index 4985d71..0bd9fef 100644 --- a/pkg/netconf/frr_test.go +++ b/pkg/netconf/frr_test.go @@ -76,7 +76,7 @@ func TestFrrConfigApplier(t *testing.T) { a := NewFrrConfigApplier(test.configuratorType, *kb, "") b := bytes.Buffer{} - tpl := mustParseTpl(test.tpl) + tpl := MustParseTpl(test.tpl) err = a.Render(&b, *tpl) assert.NoError(t, err) diff --git a/pkg/netconf/hostname_test.go b/pkg/netconf/hostname_test.go index 7aaf936..df1a54d 100644 --- a/pkg/netconf/hostname_test.go +++ b/pkg/netconf/hostname_test.go @@ -21,7 +21,7 @@ func TestNameHostname(t *testing.T) { a := newHostnameApplier(*kb, "") b := bytes.Buffer{} - tpl := mustParseTpl(tplHostname) + tpl := MustParseTpl(tplHostname) err = a.Render(&b, *tpl) assert.NoError(err) assert.Equal(string(expected), b.String()) diff --git a/pkg/netconf/hosts_test.go b/pkg/netconf/hosts_test.go index eac2a3e..c3c3419 100644 --- a/pkg/netconf/hosts_test.go +++ b/pkg/netconf/hosts_test.go @@ -21,7 +21,7 @@ func TestNewHostsApplier(t *testing.T) { a := newHostsApplier(*kb, "") b := bytes.Buffer{} - tpl := mustParseTpl(tplHosts) + tpl := MustParseTpl(tplHosts) err = a.Render(&b, *tpl) assert.NoError(err) assert.Equal(string(expected), b.String()) diff --git a/pkg/netconf/nftables_test.go b/pkg/netconf/nftables_test.go index 109c806..60701ca 100644 --- a/pkg/netconf/nftables_test.go +++ b/pkg/netconf/nftables_test.go @@ -62,7 +62,7 @@ func TestCompileNftRules(t *testing.T) { a := newNftablesConfigApplier(*kb, nil, tt.enableDNSProxy) b := bytes.Buffer{} - tpl := mustParseTpl(TplNftables) + tpl := MustParseTpl(TplNftables) err = a.Render(&b, *tpl) assert.NoError(err) assert.Equal(string(expected), b.String()) diff --git a/pkg/netconf/service_test.go b/pkg/netconf/service_test.go index ec5de27..e0e759c 100644 --- a/pkg/netconf/service_test.go +++ b/pkg/netconf/service_test.go @@ -65,7 +65,7 @@ func TestServices(t *testing.T) { assert.NoError(err) b := bytes.Buffer{} - tpl := mustParseTpl(test.template) + tpl := MustParseTpl(test.template) err = test.applier.Render(&b, *tpl) assert.NoError(err) assert.Equal(string(expected), b.String()) diff --git a/pkg/netconf/template.go b/pkg/netconf/template.go index 1004db7..f88242d 100644 --- a/pkg/netconf/template.go +++ b/pkg/netconf/template.go @@ -17,7 +17,7 @@ func mustReadTpl(tplName string) string { return string(contents) } -func mustParseTpl(tplName string) *template.Template { +func MustParseTpl(tplName string) *template.Template { s := mustReadTpl(tplName) return template.Must(template.New(tplName).Parse(string(s))) } diff --git a/pkg/netconf/testdata/frr.conf.firewall b/pkg/netconf/testdata/frr.conf.firewall index 0bfc03b..65f1fbf 100644 --- a/pkg/netconf/testdata/frr.conf.firewall +++ b/pkg/netconf/testdata/frr.conf.firewall @@ -1,6 +1,6 @@ # This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version . # Do not edit. -frr version 7.5 +frr version 8.3 frr defaults datacenter hostname firewall username cumulus nopassword diff --git a/pkg/netconf/testdata/frr.conf.firewall_dmz b/pkg/netconf/testdata/frr.conf.firewall_dmz index f4c144d..7d62436 100644 --- a/pkg/netconf/testdata/frr.conf.firewall_dmz +++ b/pkg/netconf/testdata/frr.conf.firewall_dmz @@ -1,6 +1,6 @@ # This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version . # Do not edit. -frr version 7.5 +frr version 8.3 frr defaults datacenter hostname firewall username cumulus nopassword diff --git a/pkg/netconf/testdata/frr.conf.firewall_dmz_app b/pkg/netconf/testdata/frr.conf.firewall_dmz_app index 2b472e9..378e731 100644 --- a/pkg/netconf/testdata/frr.conf.firewall_dmz_app +++ b/pkg/netconf/testdata/frr.conf.firewall_dmz_app @@ -1,6 +1,6 @@ # This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version . # Do not edit. -frr version 7.5 +frr version 8.3 frr defaults datacenter hostname firewall username cumulus nopassword diff --git a/pkg/netconf/testdata/frr.conf.firewall_dmz_app_storage b/pkg/netconf/testdata/frr.conf.firewall_dmz_app_storage index ff49088..d55a33a 100644 --- a/pkg/netconf/testdata/frr.conf.firewall_dmz_app_storage +++ b/pkg/netconf/testdata/frr.conf.firewall_dmz_app_storage @@ -1,6 +1,6 @@ # This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version . # Do not edit. -frr version 7.5 +frr version 8.3 frr defaults datacenter hostname firewall username cumulus nopassword diff --git a/pkg/netconf/testdata/frr.conf.firewall_ipv6 b/pkg/netconf/testdata/frr.conf.firewall_ipv6 index 1499564..5060e82 100644 --- a/pkg/netconf/testdata/frr.conf.firewall_ipv6 +++ b/pkg/netconf/testdata/frr.conf.firewall_ipv6 @@ -1,6 +1,6 @@ # This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version . # Do not edit. -frr version 7.5 +frr version 8.3 frr defaults datacenter hostname firewall username cumulus nopassword diff --git a/pkg/netconf/testdata/frr.conf.firewall_shared b/pkg/netconf/testdata/frr.conf.firewall_shared index 78b778a..a9d537a 100644 --- a/pkg/netconf/testdata/frr.conf.firewall_shared +++ b/pkg/netconf/testdata/frr.conf.firewall_shared @@ -1,6 +1,6 @@ # This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version . # Do not edit. -frr version 7.5 +frr version 8.3 frr defaults datacenter hostname firewall username cumulus nopassword diff --git a/pkg/netconf/testdata/frr.conf.machine b/pkg/netconf/testdata/frr.conf.machine index b8236bf..67aec44 100644 --- a/pkg/netconf/testdata/frr.conf.machine +++ b/pkg/netconf/testdata/frr.conf.machine @@ -1,6 +1,6 @@ # This file was auto generated for machine: 'e0ab02d2-27cd-5a5e-8efc-080ba80cf258' by app version . # Do not edit. -frr version 7.5 +frr version 8.3 frr defaults datacenter hostname machine username cumulus nopassword