Skip to content

Commit 7076438

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 f43feb8 commit 7076438

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
@@ -328,6 +328,20 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F
328328
preconfiguredIPs: []string{"203.203.0.100", "2014:100:200::100"},
329329
},
330330
),
331+
Entry(
332+
"[OCPFeatureGate:PreconfiguredUDNAddresses] when the VM with preconfigured MAC address is created when the address is already taken",
333+
networkAttachmentConfigParams{
334+
name: nadName,
335+
topology: "layer2",
336+
role: "primary",
337+
allowPersistentIPs: true,
338+
},
339+
kubevirt.FedoraVMWithPreconfiguredPrimaryUDNAttachment,
340+
duplicateVM,
341+
workloadNetworkConfig{
342+
preconfiguredMAC: "aa:bb:cc:dd:ee:ff",
343+
},
344+
),
331345
)
332346
},
333347
Entry("NetworkAttachmentDefinitions", func(c networkAttachmentConfigParams) networkAttachmentConfig {
@@ -586,6 +600,21 @@ func duplicateVM(cli *kubevirt.Client, vmNamespace, vmName string) {
586600
)
587601
})
588602
}
603+
604+
mac, err := cli.GetJSONPath("vmi", vmName, "{.spec.domain.devices.interfaces[0].macAddress}")
605+
Expect(err).NotTo(HaveOccurred())
606+
if len(mac) > 0 {
607+
vmiExpectations = append(vmiExpectations, func() {
608+
waitForVMPodEventWithMessage(
609+
cli,
610+
vmNamespace,
611+
duplicateVMName,
612+
"MAC address already in use",
613+
2*time.Minute,
614+
)
615+
})
616+
}
617+
589618
Expect(cli.CreateVMIFromSpec(vmNamespace, duplicateVMName, vmiSpec, vmiCreationOptions...)).To(Succeed())
590619
for _, expectation := range vmiExpectations {
591620
expectation()

0 commit comments

Comments
 (0)