Skip to content

Commit d80cf0c

Browse files
authored
controller: remove unused InterfacesAndPeers flag from templateData struct (#2074)
1 parent 02c119e commit d80cf0c

File tree

4 files changed

+30
-53
lines changed

4 files changed

+30
-53
lines changed

controlplane/controller/internal/controller/models.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ type templateData struct {
251251
UnknownBgpPeers []net.IP
252252
MulticastGroupBlock string
253253
NoHardware bool
254-
InterfacesAndPeers bool
255254
TelemetryTWAMPListenPort int
256255
LocalASN uint32
257256
Strings StringsHelper

controlplane/controller/internal/controller/render_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func TestRenderConfig(t *testing.T) {
2525
Strings: StringsHelper{},
2626
MulticastGroupBlock: "239.0.0.0/24",
2727
TelemetryTWAMPListenPort: 862,
28-
InterfacesAndPeers: true,
2928
LocalASN: 65342,
3029
Device: &Device{
3130
PublicIP: net.IP{7, 7, 7, 7},
@@ -76,7 +75,6 @@ func TestRenderConfig(t *testing.T) {
7675
Strings: StringsHelper{},
7776
MulticastGroupBlock: "239.0.0.0/24",
7877
TelemetryTWAMPListenPort: 862,
79-
InterfacesAndPeers: true,
8078
LocalASN: 21682,
8179
Device: &Device{
8280
Interfaces: []Interface{},
@@ -129,7 +127,6 @@ func TestRenderConfig(t *testing.T) {
129127
Strings: StringsHelper{},
130128
MulticastGroupBlock: "239.0.0.0/24",
131129
TelemetryTWAMPListenPort: 862,
132-
InterfacesAndPeers: true,
133130
LocalASN: 65342,
134131
Device: &Device{
135132
Interfaces: []Interface{},
@@ -213,7 +210,6 @@ func TestRenderConfig(t *testing.T) {
213210
Strings: StringsHelper{},
214211
MulticastGroupBlock: "239.0.0.0/24",
215212
TelemetryTWAMPListenPort: 862,
216-
InterfacesAndPeers: true,
217213
LocalASN: 65342,
218214
Device: &Device{
219215
Interfaces: []Interface{},
@@ -309,7 +305,6 @@ func TestRenderConfig(t *testing.T) {
309305
NoHardware: true,
310306
MulticastGroupBlock: "239.0.0.0/24",
311307
TelemetryTWAMPListenPort: 862,
312-
InterfacesAndPeers: true,
313308
LocalASN: 65342,
314309
Device: &Device{
315310
Interfaces: []Interface{},
@@ -404,7 +399,6 @@ func TestRenderConfig(t *testing.T) {
404399
Strings: StringsHelper{},
405400
MulticastGroupBlock: "239.0.0.0/24",
406401
TelemetryTWAMPListenPort: 862,
407-
InterfacesAndPeers: true,
408402
LocalASN: 65342,
409403
Device: &Device{
410404
PublicIP: net.IP{7, 7, 7, 7},
@@ -487,7 +481,6 @@ func TestRenderConfig(t *testing.T) {
487481
Strings: StringsHelper{},
488482
MulticastGroupBlock: "239.0.0.0/24",
489483
TelemetryTWAMPListenPort: 862,
490-
InterfacesAndPeers: true,
491484
LocalASN: 65342,
492485
Device: &Device{
493486
PublicIP: net.IP{7, 7, 7, 7},

controlplane/controller/internal/controller/server.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,6 @@ func (c *Controller) GetConfig(ctx context.Context, req *pb.ConfigRequest) (*pb.
653653
Ipv4BgpPeers: ipv4Peers,
654654
UnknownBgpPeers: unknownPeers,
655655
NoHardware: c.noHardware,
656-
InterfacesAndPeers: true,
657656
TelemetryTWAMPListenPort: telemetryconfig.TWAMPListenPort,
658657
LocalASN: localASN,
659658
Strings: StringsHelper{},

controlplane/controller/internal/controller/server_test.go

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,16 @@ func renderTemplateFile(filepath string, data any) (string, error) {
7878

7979
func TestGetConfig(t *testing.T) {
8080
tests := []struct {
81-
Name string
82-
Description string
83-
StateCache stateCache
84-
NoHardware bool
85-
InterfacesAndPeers bool
86-
Pubkey string
87-
Want string
81+
Name string
82+
Description string
83+
StateCache stateCache
84+
NoHardware bool
85+
Pubkey string
86+
Want string
8887
}{
8988
{
90-
Name: "render_unicast_config_successfully",
91-
Description: "render configuration for a set of unicast devices successfully",
92-
InterfacesAndPeers: true,
89+
Name: "render_unicast_config_successfully",
90+
Description: "render configuration for a set of unicast devices successfully",
9391
StateCache: stateCache{
9492
Config: serviceability.Config{
9593
MulticastGroupBlock: [5]uint8{239, 0, 0, 0, 24},
@@ -140,9 +138,8 @@ func TestGetConfig(t *testing.T) {
140138
Want: "fixtures/unicast.tunnel.tmpl",
141139
},
142140
{
143-
Name: "render_multicast_config_successfully",
144-
Description: "render configuration for a set of multicast devices successfully",
145-
InterfacesAndPeers: true,
141+
Name: "render_multicast_config_successfully",
142+
Description: "render configuration for a set of multicast devices successfully",
146143
StateCache: stateCache{
147144
Config: serviceability.Config{
148145
MulticastGroupBlock: [5]uint8{239, 0, 0, 0, 24},
@@ -226,9 +223,8 @@ func TestGetConfig(t *testing.T) {
226223
Want: "fixtures/multicast.tunnel.tmpl",
227224
},
228225
{
229-
Name: "get_config_mixed_tunnels_successfully",
230-
Description: "get config for a mix of unicast and multicast tunnels",
231-
InterfacesAndPeers: true,
226+
Name: "get_config_mixed_tunnels_successfully",
227+
Description: "get config for a mix of unicast and multicast tunnels",
232228
StateCache: stateCache{
233229
Config: serviceability.Config{
234230
MulticastGroupBlock: [5]uint8{239, 0, 0, 0, 24},
@@ -322,10 +318,9 @@ func TestGetConfig(t *testing.T) {
322318
Want: "fixtures/mixed.tunnel.tmpl",
323319
},
324320
{
325-
Name: "get_config_nohardware_tunnels_successfully",
326-
Description: "get config for a mix of unicast and multicast tunnels with no hardware option",
327-
NoHardware: true,
328-
InterfacesAndPeers: true,
321+
Name: "get_config_nohardware_tunnels_successfully",
322+
Description: "get config for a mix of unicast and multicast tunnels with no hardware option",
323+
NoHardware: true,
329324
StateCache: stateCache{
330325
Config: serviceability.Config{
331326
MulticastGroupBlock: [5]uint8{239, 0, 0, 0, 24},
@@ -419,9 +414,8 @@ func TestGetConfig(t *testing.T) {
419414
Want: "fixtures/nohardware.tunnel.tmpl",
420415
},
421416
{
422-
Name: "render_base_config_successfully",
423-
Description: "render base configuration with BGP peers",
424-
InterfacesAndPeers: true,
417+
Name: "render_base_config_successfully",
418+
Description: "render base configuration with BGP peers",
425419
StateCache: stateCache{
426420
Config: serviceability.Config{
427421
MulticastGroupBlock: [5]uint8{239, 0, 0, 0, 24},
@@ -481,9 +475,8 @@ func TestGetConfig(t *testing.T) {
481475
Want: "fixtures/base.config.txt",
482476
},
483477
{
484-
Name: "render_base_config_with_mgmt_vrf_successfully",
485-
Description: "render base configuration with BGP peers",
486-
InterfacesAndPeers: true,
478+
Name: "render_base_config_with_mgmt_vrf_successfully",
479+
Description: "render base configuration with BGP peers",
487480
StateCache: stateCache{
488481
Config: serviceability.Config{
489482
MulticastGroupBlock: [5]uint8{239, 0, 0, 0, 24},
@@ -530,9 +523,6 @@ func TestGetConfig(t *testing.T) {
530523
noHardware: test.NoHardware,
531524
deviceLocalASN: 65342,
532525
}
533-
if !test.InterfacesAndPeers {
534-
controller.log = slog.New(slog.NewTextHandler(io.Discard, nil))
535-
}
536526
pb.RegisterControllerServer(server, controller)
537527

538528
go func() {
@@ -1221,17 +1211,16 @@ func TestServiceabilityProgramClientArg(t *testing.T) {
12211211
// can be rendered and sent back to the client via gRPC.
12221212
func TestEndToEnd(t *testing.T) {
12231213
tests := []struct {
1224-
Name string
1225-
Config serviceability.Config
1226-
Users []serviceability.User
1227-
Devices []serviceability.Device
1228-
Links []serviceability.Link
1229-
MulticastGroups []serviceability.MulticastGroup
1230-
Exchanges []serviceability.Exchange
1231-
InterfacesAndPeers bool
1232-
AgentRequest *pb.ConfigRequest
1233-
DevicePubKey string
1234-
Want string
1214+
Name string
1215+
Config serviceability.Config
1216+
Users []serviceability.User
1217+
Devices []serviceability.Device
1218+
Links []serviceability.Link
1219+
MulticastGroups []serviceability.MulticastGroup
1220+
Exchanges []serviceability.Exchange
1221+
AgentRequest *pb.ConfigRequest
1222+
DevicePubKey string
1223+
Want string
12351224
}{
12361225
{
12371226
Name: "fetch_accounts_and_render_config_successfully",
@@ -1251,7 +1240,6 @@ func TestEndToEnd(t *testing.T) {
12511240
BgpCommunity: 10050,
12521241
},
12531242
},
1254-
InterfacesAndPeers: true,
12551243
Users: []serviceability.User{
12561244
{
12571245
AccountType: serviceability.AccountType(0),
@@ -1368,7 +1356,6 @@ func TestEndToEnd(t *testing.T) {
13681356
BgpCommunity: 10050,
13691357
},
13701358
},
1371-
InterfacesAndPeers: true,
13721359
Users: []serviceability.User{
13731360
{
13741361
AccountType: serviceability.AccountType(0),
@@ -1490,8 +1477,7 @@ func TestEndToEnd(t *testing.T) {
14901477
BgpCommunity: 10050,
14911478
},
14921479
},
1493-
InterfacesAndPeers: true,
1494-
Users: []serviceability.User{},
1480+
Users: []serviceability.User{},
14951481
Devices: []serviceability.Device{
14961482
{
14971483
AccountType: serviceability.AccountType(0),

0 commit comments

Comments
 (0)