@@ -17,6 +17,8 @@ limitations under the License.
17
17
package v1alpha7
18
18
19
19
import (
20
+ "errors"
21
+
20
22
apiconversion "k8s.io/apimachinery/pkg/conversion"
21
23
22
24
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
@@ -217,6 +219,38 @@ func Convert_v1alpha7_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *infrav1.Po
217
219
return err
218
220
}
219
221
222
+ // Copy members of ResolvedPortSpecFields
223
+ var allowedAddressPairs []infrav1.AddressPair
224
+ if len (in .AllowedAddressPairs ) > 0 {
225
+ allowedAddressPairs = make ([]infrav1.AddressPair , len (in .AllowedAddressPairs ))
226
+ for i := range in .AllowedAddressPairs {
227
+ aap := & in .AllowedAddressPairs [i ]
228
+ allowedAddressPairs [i ] = infrav1.AddressPair {
229
+ MACAddress : & aap .MACAddress ,
230
+ IPAddress : aap .IPAddress ,
231
+ }
232
+ }
233
+ }
234
+ var valueSpecs []infrav1.ValueSpec
235
+ if len (in .ValueSpecs ) > 0 {
236
+ valueSpecs = make ([]infrav1.ValueSpec , len (in .ValueSpecs ))
237
+ for i , vs := range in .ValueSpecs {
238
+ valueSpecs [i ] = infrav1 .ValueSpec (vs )
239
+ }
240
+ }
241
+ out .AdminStateUp = in .AdminStateUp
242
+ out .AllowedAddressPairs = allowedAddressPairs
243
+ out .DisablePortSecurity = in .DisablePortSecurity
244
+ out .PropagateUplinkStatus = in .PropagateUplinkStatus
245
+ out .ValueSpecs = valueSpecs
246
+ if err := errors .Join (
247
+ optional .Convert_string_To_optional_String (& in .MACAddress , & out .MACAddress , s ),
248
+ optional .Convert_string_To_optional_String (& in .HostID , & out .HostID , s ),
249
+ optional .Convert_string_To_optional_String (& in .VNICType , & out .VNICType , s ),
250
+ ); err != nil {
251
+ return err
252
+ }
253
+
220
254
if len (in .SecurityGroupFilters ) > 0 {
221
255
out .SecurityGroups = make ([]infrav1.SecurityGroupFilter , len (in .SecurityGroupFilters ))
222
256
for i := range in .SecurityGroupFilters {
@@ -241,6 +275,39 @@ func Convert_v1beta1_PortOpts_To_v1alpha7_PortOpts(in *infrav1.PortOpts, out *Po
241
275
return err
242
276
}
243
277
278
+ // Copy members of ResolvedPortSpecFields
279
+ var allowedAddressPairs []AddressPair
280
+ if len (in .AllowedAddressPairs ) > 0 {
281
+ allowedAddressPairs = make ([]AddressPair , len (in .AllowedAddressPairs ))
282
+ for i := range in .AllowedAddressPairs {
283
+ inAAP := & in .AllowedAddressPairs [i ]
284
+ outAAP := & allowedAddressPairs [i ]
285
+ if err := optional .Convert_optional_String_To_string (& inAAP .MACAddress , & outAAP .MACAddress , s ); err != nil {
286
+ return err
287
+ }
288
+ outAAP .IPAddress = inAAP .IPAddress
289
+ }
290
+ }
291
+ var valueSpecs []ValueSpec
292
+ if len (in .ValueSpecs ) > 0 {
293
+ valueSpecs = make ([]ValueSpec , len (in .ValueSpecs ))
294
+ for i , vs := range in .ValueSpecs {
295
+ valueSpecs [i ] = ValueSpec (vs )
296
+ }
297
+ }
298
+ out .AdminStateUp = in .AdminStateUp
299
+ out .AllowedAddressPairs = allowedAddressPairs
300
+ out .DisablePortSecurity = in .DisablePortSecurity
301
+ out .PropagateUplinkStatus = in .PropagateUplinkStatus
302
+ out .ValueSpecs = valueSpecs
303
+ if err := errors .Join (
304
+ optional .Convert_optional_String_To_string (& in .MACAddress , & out .MACAddress , s ),
305
+ optional .Convert_optional_String_To_string (& in .HostID , & out .HostID , s ),
306
+ optional .Convert_optional_String_To_string (& in .VNICType , & out .VNICType , s ),
307
+ ); err != nil {
308
+ return err
309
+ }
310
+
244
311
if len (in .SecurityGroups ) > 0 {
245
312
out .SecurityGroupFilters = make ([]SecurityGroupFilter , len (in .SecurityGroups ))
246
313
for i := range in .SecurityGroups {
0 commit comments