Skip to content

Commit

Permalink
Merge pull request #203 from shiftstack/ssipv6
Browse files Browse the repository at this point in the history
OCPBUGS-45132: Adapt tests to ssipv6
  • Loading branch information
openshift-merge-bot[bot] authored Nov 27, 2024
2 parents a2cb883 + fb6274c commit 4f34d68
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
15 changes: 12 additions & 3 deletions test/extended/openstack/egressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ var _ = g.Describe("[sig-installer][Suite:openshift/openstack][egressip] An egre
e2eskipper.Skipf("Test not applicable for '%s' NetworkType (only valid for '%s')", networkType, NetworkTypeOVNKubernetes)
}

singleStackIpv6, err := isSingleStackIpv6Cluster(ctx, oc)
o.Expect(err).NotTo(o.HaveOccurred())
if singleStackIpv6 { //This test is covering and scenario that has no sense with ipv6 as there is no FIP/VIP association.
e2eskipper.Skipf("Test not applicable for singleStack IPv6 environments")
}

// Skip based on number of required worker nodes
minWorkerNum := 2
g.By(fmt.Sprintf("Check the number of worker nodes (should be %d at least)", minWorkerNum))
Expand Down Expand Up @@ -207,14 +213,17 @@ var _ = g.Describe("[sig-installer][Suite:openshift/openstack][egressip] An egre
})

// https://issues.redhat.com/browse/OCPBUGS-27222
g.It("with IPv6 format should be created on dualstack cluster with OVN-Kubernetes NetworkType and dhcpv6-stateful mode", func(ctx g.SpecContext) {
g.It("with IPv6 format should be created on dualstack or ssipv6 cluster with OVN-Kubernetes NetworkType and dhcpv6-stateful mode", func(ctx g.SpecContext) {

networks, err := oc.AdminConfigClient().ConfigV1().Networks().Get(ctx, "cluster", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
dualstack, err := isDualStackCluster(networks.Status.ClusterNetwork)
o.Expect(err).NotTo(o.HaveOccurred())
if !dualstack {
e2eskipper.Skipf("Test only applicable for dualstack clusters")
ssipv6, err := isSingleStackIpv6Cluster(ctx, oc)
o.Expect(err).NotTo(o.HaveOccurred())

if !(dualstack || ssipv6) {
e2eskipper.Skipf("Test only applicable for dualstack or SingleStack IPv6 clusters")
}

g.By("Getting the network type")
Expand Down
9 changes: 8 additions & 1 deletion test/extended/openstack/loadbalancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ var _ = g.Describe("[sig-installer][Suite:openshift/openstack][lb][Serial] The O
if dualstackIpv6Primary { //This test is covering and scenario that has no sense with ipv6 as there is no FIP/VIP association.
e2eskipper.Skipf("Test not applicable for ipv6primary dualstack environments")
}
singleStackIpv6, err := isSingleStackIpv6Cluster(ctx, oc)
o.Expect(err).NotTo(o.HaveOccurred())
if singleStackIpv6 { //This test is covering and scenario that has no sense with ipv6 as there is no FIP/VIP association.
e2eskipper.Skipf("Test not applicable for singleStack IPv6 environments")
}

g.By("Create FIP to be used on the subsequent LoadBalancer Service")
var fip *floatingips.FloatingIP
Expand Down Expand Up @@ -634,7 +639,9 @@ var _ = g.Describe("[sig-installer][Suite:openshift/openstack][lb][Serial] The O
allowed_sourcerange := "9.9.9.9/32"
ipv6PrimaryDualStack, err := isIpv6primaryDualStackCluster(ctx, oc)
o.Expect(err).NotTo(o.HaveOccurred())
if ipv6PrimaryDualStack {
singleStackIpv6, err := isSingleStackIpv6Cluster(ctx, oc)
o.Expect(err).NotTo(o.HaveOccurred())
if ipv6PrimaryDualStack || singleStackIpv6 {
allowed_sourcerange = "2001:db8:2222:5555::/64"
}

Expand Down
18 changes: 18 additions & 0 deletions test/extended/openstack/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,24 @@ func isDualStackCluster(clusterNetwork []configv1.ClusterNetworkEntry) (bool, er
return (ipv4Found && ipv6Found), nil
}

func isSingleStackIpv6Cluster(ctx context.Context, oc *exutil.CLI) (bool, error) {

networks, err := oc.AdminConfigClient().ConfigV1().Networks().Get(ctx, "cluster", metav1.GetOptions{})
if err != nil {
return false, err
}
if len(networks.Status.ClusterNetwork) == 1 {
ip, _, err := net.ParseCIDR(networks.Status.ClusterNetwork[0].CIDR)
if err != nil {
return false, err
}
if isIpv6(ip.String()) {
return true, nil
}
}
return false, nil
}

// Check if it is a dualstack cluster and the first cluster network technology. Returns true if it is ipv6.
func isIpv6primaryDualStackCluster(ctx context.Context, oc *exutil.CLI) (bool, error) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var Annotations = map[string]string{

"[sig-installer][Suite:openshift/openstack][egressip] An egressIP attached to a floating IP should be kept after EgressIP node failover with OVN-Kubernetes NetworkType": "",

"[sig-installer][Suite:openshift/openstack][egressip] An egressIP with IPv6 format should be created on dualstack cluster with OVN-Kubernetes NetworkType and dhcpv6-stateful mode": "",
"[sig-installer][Suite:openshift/openstack][egressip] An egressIP with IPv6 format should be created on dualstack or ssipv6 cluster with OVN-Kubernetes NetworkType and dhcpv6-stateful mode": "",

"[sig-installer][Suite:openshift/openstack][lb][Serial] The Openstack platform should apply lb-method on TCP Amphora LoadBalancer when a TCP svc with monitors and ETP:Local is created on Openshift": "",

Expand Down

0 comments on commit 4f34d68

Please sign in to comment.