Skip to content

Commit cc048c3

Browse files
Merge pull request #29386 from maiqueb/revert-primary-udn-test-workaround-from-virt-tests
CORENET-5329: revert primary udn test workaround from virt tests
2 parents a04183e + c567f6d commit cc048c3

File tree

1 file changed

+5
-53
lines changed

1 file changed

+5
-53
lines changed

test/extended/networking/livemigration.go

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F
6868
)
6969

7070
DescribeTableSubtree("created using",
71-
func(createNetworkFn func(netConfig networkAttachmentConfigParams) networkAttachmentConfig) {
71+
func(createNetworkFn func(netConfig networkAttachmentConfigParams)) {
7272

7373
DescribeTable("[Suite:openshift/network/virtualization] should keep ip", func(netConfig networkAttachmentConfigParams, vmResource string, opCmd func(cli *kubevirt.Client, vmNamespace, vmName string), wlConfig ...workloadNetworkConfig) {
7474
var err error
@@ -108,16 +108,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F
108108
isDualStack = true
109109
}
110110

111-
provisionedNetConfig := createNetworkFn(netConfig)
112-
113-
for _, node := range workerNodes {
114-
Eventually(func() bool {
115-
isNetProvisioned, err := isNetworkProvisioned(oc, node.Name, provisionedNetConfig.networkName)
116-
return err == nil && isNetProvisioned
117-
}).WithPolling(time.Second).WithTimeout(udnNetworkReadyTimeout).Should(
118-
BeTrueBecause("the network must be ready before creating workloads"),
119-
)
120-
}
111+
createNetworkFn(netConfig)
121112

122113
httpServerPods := prepareHTTPServerPods(f, netConfig, workerNodes)
123114
vmCreationParams := kubevirt.CreationTemplateParams{
@@ -314,25 +305,23 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F
314305
),
315306
)
316307
},
317-
Entry("NetworkAttachmentDefinitions", func(c networkAttachmentConfigParams) networkAttachmentConfig {
308+
Entry("NetworkAttachmentDefinitions", func(c networkAttachmentConfigParams) {
318309
netConfig := newNetworkAttachmentConfig(c)
319310
nad := generateNAD(netConfig)
320311
By(fmt.Sprintf("Creating NetworkAttachmentDefinitions %s/%s", nad.Namespace, nad.Name))
321312
_, err := nadClient.NetworkAttachmentDefinitions(c.namespace).Create(context.Background(), nad, metav1.CreateOptions{})
322313
Expect(err).NotTo(HaveOccurred())
323-
return netConfig
324314
}),
325-
Entry("[OCPFeatureGate:NetworkSegmentation] UserDefinedNetwork", func(c networkAttachmentConfigParams) networkAttachmentConfig {
315+
Entry("[OCPFeatureGate:NetworkSegmentation] UserDefinedNetwork", func(c networkAttachmentConfigParams) {
326316
udnManifest := generateUserDefinedNetworkManifest(&c)
327317
By(fmt.Sprintf("Creating UserDefinedNetwork %s/%s", c.namespace, c.name))
328318
Expect(applyManifest(c.namespace, udnManifest)).To(Succeed())
329319
Eventually(userDefinedNetworkReadyFunc(oc.AdminDynamicClient(), c.namespace, c.name), udnCrReadyTimeout, time.Second).Should(Succeed())
330320

331-
nad, err := nadClient.NetworkAttachmentDefinitions(c.namespace).Get(
321+
_, err := nadClient.NetworkAttachmentDefinitions(c.namespace).Get(
332322
context.Background(), c.name, metav1.GetOptions{},
333323
)
334324
Expect(err).NotTo(HaveOccurred())
335-
return networkAttachmentConfig{networkAttachmentConfigParams{networkName: networkName(nad.Spec.Config)}}
336325
}))
337326
})
338327
})
@@ -686,43 +675,6 @@ func checkEastWestTraffic(virtClient *kubevirt.Client, vmiName string, podIPsByN
686675
}
687676
}
688677

689-
func isNetworkProvisioned(oc *exutil.CLI, nodeName string, networkName string) (bool, error) {
690-
ovnkubePodInfo, err := ovnkubePod(oc, nodeName)
691-
if err != nil {
692-
return false, err
693-
}
694-
695-
lsName := logicalSwitchName(networkName)
696-
out, err := adminExecInPod(
697-
oc,
698-
"openshift-ovn-kubernetes",
699-
ovnkubePodInfo.podName,
700-
ovnkubePodInfo.containerName,
701-
fmt.Sprintf("ovn-nbctl list logical-switch %s", lsName),
702-
)
703-
if err != nil {
704-
return false, fmt.Errorf("failed to find a logical switch for network %q: %w", networkName, err)
705-
}
706-
707-
return strings.Contains(out, lsName), nil
708-
}
709-
710-
func logicalSwitchName(networkName string) string {
711-
netName := strings.ReplaceAll(networkName, "-", ".")
712-
netName = strings.ReplaceAll(netName, "/", ".")
713-
return fmt.Sprintf("%s_ovn_layer2_switch", netName)
714-
}
715-
716-
func networkName(netSpecConfig string) string {
717-
GinkgoHelper()
718-
type netConfig struct {
719-
Name string `json:"name,omitempty"`
720-
}
721-
var nc netConfig
722-
Expect(json.Unmarshal([]byte(netSpecConfig), &nc)).To(Succeed())
723-
return nc.Name
724-
}
725-
726678
// formatAddressesAnnotation converts slice of IPs to the required JSON format for kubevirt addresses annotation
727679
func formatAddressesAnnotation(preconfiguredIPs []string) (string, error) {
728680
const primaryUDNNetworkName = "overlay"

0 commit comments

Comments
 (0)