Skip to content

Commit 20df32f

Browse files
committed
Fix bond networkdata template
Align it with openstack network_data.json. Change-Id: Iea45ad2822d273937d53f98b99e0aea0a2bf47f0 Signed-off-by: rabi <ramishra@redhat.com>
1 parent 0565bc4 commit 20df32f

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

templates/openstackbaremetalset/cloudinit/networkdata

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ links:
88
- name: {{ .CtlplaneInterface }}
99
id: {{ .CtlplaneInterface }}
1010
type: bond
11-
bond_interfaces:
11+
bond_links:
1212
{{- range $iface := .CtlplaneBondInterfaces }}
1313
- {{ $iface }}
1414
{{- end }}
1515
bond_mode: {{ if .CtlplaneBondMode }}{{ .CtlplaneBondMode }}{{ else }}active-backup{{ end }}
1616
{{- if (index . "CtlplaneBondOptions") }}
17-
params:
18-
{{- range $key, $value := .CtlplaneBondOptions }}
19-
{{ $key }}: {{ $value }}
20-
{{- end }}
17+
{{- range $key, $value := .CtlplaneBondOptions }}
18+
{{ $key }}: {{ $value }}
19+
{{- end }}
2120
{{- else }}
22-
params:
23-
bond-miimon: 100
21+
bond_miimon: 100
2422
{{- end }}
2523
{{- else }}
2624
- name: {{ .CtlplaneInterface }}
@@ -39,9 +37,11 @@ networks:
3937
{{- if (index . "CtlplaneVlan") }}
4038
- link: {{ .CtlplaneInterface }}.{{ .CtlplaneVlan }}
4139
id: {{ .CtlplaneInterface }}.{{ .CtlplaneVlan }}
40+
network_id: {{ .CtlplaneInterface }}.{{ .CtlplaneVlan }}
4241
{{- else }}
4342
- link: {{ .CtlplaneInterface }}
4443
id: {{ .CtlplaneInterface }}
44+
network_id: {{ .CtlplaneInterface }}
4545
{{- end }}
4646
type: {{ .CtlplaneIpVersion }}
4747
ip_address: {{ .CtlplaneIp }}

tests/functional/openstackbaremetalset_controller_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,10 @@ var _ = Describe("BaremetalSet Test", func() {
488488
Expect(networkData).NotTo(ContainSubstring("dns_nameservers: - "))
489489
Expect(networkData).To(MatchRegexp("(?m)^ dns_search:\n"))
490490
Expect(networkData).NotTo(ContainSubstring("dns_search: - "))
491-
Expect(networkData).To(ContainSubstring("dns_nameservers:"))
492491
Expect(networkData).To(ContainSubstring("8.8.8.8"))
493492
Expect(networkData).To(ContainSubstring("8.8.4.4"))
493+
Expect(networkData).To(ContainSubstring("dns_nameservers:"))
494494
Expect(networkData).To(ContainSubstring("dns_search:"))
495-
Expect(networkData).To(ContainSubstring("example.com"))
496-
Expect(networkData).To(ContainSubstring("test.local"))
497495
})
498496
})
499497

@@ -1026,12 +1024,13 @@ var _ = Describe("BaremetalSet Test", func() {
10261024
// Verify proper YAML formatting
10271025
g.Expect(networkData).To(MatchRegexp("(?m)^links:\n"))
10281026
g.Expect(networkData).NotTo(ContainSubstring("links:- "))
1029-
g.Expect(networkData).To(MatchRegexp("(?m)^ bond_interfaces:\n"))
1030-
g.Expect(networkData).NotTo(ContainSubstring("bond_interfaces: - "))
1027+
g.Expect(networkData).To(MatchRegexp("(?m)^ bond_links:\n"))
1028+
g.Expect(networkData).NotTo(ContainSubstring("bond_links: - "))
10311029
g.Expect(networkData).To(MatchRegexp("bond_mode: [^\n]+\n "))
1032-
g.Expect(networkData).NotTo(MatchRegexp("bond_mode: [^\n]+ params:"))
1030+
g.Expect(networkData).NotTo(ContainSubstring("params:"))
10331031
g.Expect(networkData).Should(ContainSubstring("type: bond"))
10341032
g.Expect(networkData).Should(ContainSubstring("bond_mode: active-backup"))
1033+
g.Expect(networkData).Should(ContainSubstring("bond_miimon: 100"))
10351034
g.Expect(networkData).Should(ContainSubstring("eno1"))
10361035
g.Expect(networkData).Should(ContainSubstring("eno2"))
10371036
}, th.Timeout, th.Interval).Should(Succeed())
@@ -1103,9 +1102,12 @@ var _ = Describe("BaremetalSet Test", func() {
11031102
networkData := string(secret.Data["networkData"])
11041103
g.Expect(networkData).Should(ContainSubstring("type: bond"))
11051104
g.Expect(networkData).Should(ContainSubstring("bond_mode: 802.3ad"))
1105+
g.Expect(networkData).Should(ContainSubstring("bond_links:"))
11061106
g.Expect(networkData).Should(ContainSubstring("type: vlan"))
11071107
g.Expect(networkData).Should(ContainSubstring("vlan_id: 100"))
11081108
g.Expect(networkData).Should(ContainSubstring("bond0.100"))
1109+
g.Expect(networkData).Should(ContainSubstring("network_id: bond0.100"))
1110+
g.Expect(networkData).Should(ContainSubstring("vlan_mac_address: null"))
11091111
}, th.Timeout, th.Interval).Should(Succeed())
11101112
})
11111113
})

0 commit comments

Comments
 (0)