Skip to content

Commit 3c99d89

Browse files
committed
ovn-k, virt, preconfigured-udn-addrs: Test MAC conflict detection
Verify KubeVirt VMs with preconfigured MAC address retain a requested MAC address before and after another VM is created requesting the same MAC address. And verify the other VM requesting the same MAC address get the appropriate address conflict error event. Signed-off-by: Or Mergi <[email protected]>
1 parent 3250567 commit 3c99d89

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/extended/networking/livemigration.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,20 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F
332332
preconfiguredIPs: []string{"203.203.0.100", "2014:100:200::100"},
333333
},
334334
),
335+
Entry(
336+
"[OCPFeatureGate:PreconfiguredUDNAddresses] when the VM with preconfigured MAC address is created when the address is already taken",
337+
networkAttachmentConfigParams{
338+
name: nadName,
339+
topology: "layer2",
340+
role: "primary",
341+
allowPersistentIPs: true,
342+
},
343+
kubevirt.FedoraVMWithPreconfiguredPrimaryUDNAttachment,
344+
duplicateVM,
345+
workloadNetworkConfig{
346+
preconfiguredMAC: "02:00:00:22:22:22",
347+
},
348+
),
335349
)
336350
},
337351
Entry("NetworkAttachmentDefinitions", func(c networkAttachmentConfigParams) {
@@ -588,6 +602,21 @@ func duplicateVM(cli *kubevirt.Client, vmNamespace, vmName string) {
588602
)
589603
})
590604
}
605+
606+
mac, err := cli.GetJSONPath("vmi", vmName, "{.spec.domain.devices.interfaces[0].macAddress}")
607+
Expect(err).NotTo(HaveOccurred())
608+
if len(mac) > 0 {
609+
vmiExpectations = append(vmiExpectations, func() {
610+
waitForVMPodEventWithMessage(
611+
cli,
612+
vmNamespace,
613+
duplicateVMName,
614+
"MAC address already in use",
615+
2*time.Minute,
616+
)
617+
})
618+
}
619+
591620
Expect(cli.CreateVMIFromSpec(vmNamespace, duplicateVMName, vmiSpec, vmiCreationOptions...)).To(Succeed())
592621
for _, expectation := range vmiExpectations {
593622
expectation()

0 commit comments

Comments
 (0)