@@ -1699,8 +1699,8 @@ write_files:
16991699 namespace = fr .Namespace .Name
17001700
17011701 networkName := ""
1702- cidrs := generateL2Subnets ( cidrIPv4 , cidrIPv6 )
1703- cudn , networkName = kubevirt .GenerateCUDN (namespace , "net1" , td .topology , td .role , cidrs )
1702+ dualCIDRs := filterDualStackCIDRs ( fr . ClientSet , []udnv1. CIDR { udnv1 . CIDR ( cidrIPv4 ), udnv1 . CIDR ( cidrIPv6 )} )
1703+ cudn , networkName = kubevirt .GenerateCUDN (namespace , "net1" , td .topology , td .role , dualCIDRs )
17041704
17051705 if td .topology == udnv1 .NetworkTopologyLocalnet {
17061706 By ("setting up the localnet underlay" )
@@ -1809,7 +1809,7 @@ ip route add %[3]s via %[4]s
18091809
18101810 // expect 2 addresses on dual-stack deployments; 1 on single-stack
18111811 step = by (vmi .Name , "Wait for addresses at the virtual machine" )
1812- expectedNumberOfAddresses := len (cidrs )
1812+ expectedNumberOfAddresses := len (dualCIDRs )
18131813 expectedAddreses := virtualMachineAddressesFromStatus (vmi , expectedNumberOfAddresses )
18141814 expectedAddresesAtGuest := expectedAddreses
18151815 testPodsIPs := podsMultusNetworkIPs (iperfServerTestPods , podNetworkStatusByNetConfigPredicate (namespace , cudn .Name , strings .ToLower (string (td .role ))))
@@ -1836,7 +1836,7 @@ ip route add %[3]s via %[4]s
18361836 checkEastWestIperfTraffic (vmi , testPodsIPs , step )
18371837
18381838 if td .role == udnv1 .NetworkRolePrimary {
1839- if isIPv6Supported () && isInterconnectEnabled () {
1839+ if isIPv6Supported (fr . ClientSet ) && isInterconnectEnabled () {
18401840 step = by (vmi .Name , fmt .Sprintf ("Checking IPv6 gateway before %s %s" , td .resource .description , td .test .description ))
18411841
18421842 nodeRunningVMI , err := fr .ClientSet .CoreV1 ().Nodes ().Get (context .Background (), vmi .Status .NodeName , metav1.GetOptions {})
@@ -1906,7 +1906,7 @@ ip route add %[3]s via %[4]s
19061906 }
19071907
19081908 if td .role == udnv1 .NetworkRolePrimary && td .test .description == liveMigrate .description && isInterconnectEnabled () {
1909- if isIPv4Supported () {
1909+ if isIPv4Supported (fr . ClientSet ) {
19101910 step = by (vmi .Name , fmt .Sprintf ("Checking IPv4 gateway cached mac after %s %s" , td .resource .description , td .test .description ))
19111911 Expect (crClient .Get (context .TODO (), crclient .ObjectKeyFromObject (vmi ), vmi )).To (Succeed ())
19121912
@@ -1923,7 +1923,7 @@ ip route add %[3]s via %[4]s
19231923 WithPolling (time .Second ).
19241924 Should (Equal (expectedGatewayMAC ), step )
19251925 }
1926- if isIPv6Supported () {
1926+ if isIPv6Supported (fr . ClientSet ) {
19271927 step = by (vmi .Name , fmt .Sprintf ("Checking IPv6 gateway after %s %s" , td .resource .description , td .test .description ))
19281928
19291929 targetNode , err := fr .ClientSet .CoreV1 ().Nodes ().Get (context .Background (), vmi .Status .MigrationState .TargetNode , metav1.GetOptions {})
@@ -2055,8 +2055,8 @@ ip route add %[3]s via %[4]s
20552055 })
20562056 fr .Namespace = ns
20572057 namespace = fr .Namespace .Name
2058- cidrs := generateL2Subnets ( cidrIPv4 , cidrIPv6 )
2059- cudn , _ := kubevirt .GenerateCUDN (namespace , "net1" , udnv1 .NetworkTopologyLayer2 , udnv1 .NetworkRolePrimary , cidrs )
2058+ dualCIDRs := filterDualStackCIDRs ( fr . ClientSet , []udnv1. CIDR { udnv1 . CIDR ( cidrIPv4 ), udnv1 . CIDR ( cidrIPv6 )} )
2059+ cudn , _ := kubevirt .GenerateCUDN (namespace , "net1" , udnv1 .NetworkTopologyLayer2 , udnv1 .NetworkRolePrimary , dualCIDRs )
20602060 cudn .Spec .Network .Layer2 .MTU = 1300
20612061 createCUDN (cudn )
20622062
@@ -2097,7 +2097,7 @@ ip route add %[3]s via %[4]s
20972097 Get (context .Background (), config .Kubernetes .DNSServiceName , metav1.GetOptions {})
20982098 Expect (err ).NotTo (HaveOccurred ())
20992099
2100- if isIPv4Supported () {
2100+ if isIPv4Supported (fr . ClientSet ) {
21012101 expectedIP , err := matchIPv4StringFamily (primaryUDNNetworkStatus .IPs )
21022102 Expect (err ).NotTo (HaveOccurred ())
21032103
@@ -2125,7 +2125,7 @@ ip route add %[3]s via %[4]s
21252125 Expect (primaryUDNValueForDevice ("GENERAL.MTU" )).To (ConsistOf ("1300" ))
21262126 }
21272127
2128- if isIPv6Supported () {
2128+ if isIPv6Supported (fr . ClientSet ) {
21292129 expectedIP , err := matchIPv6StringFamily (primaryUDNNetworkStatus .IPs )
21302130 Expect (err ).NotTo (HaveOccurred ())
21312131 Eventually (primaryUDNValueFor ).
@@ -2164,7 +2164,7 @@ ip route add %[3]s via %[4]s
21642164 vmiIPv4 = "10.128.0.100/24"
21652165 vmiIPv6 = "2010:100:200::100/60"
21662166 vmiMAC = "0A:58:0A:80:00:64"
2167- cidr = selectCIDRs ( ipv4CIDR , ipv6CIDR )
2167+ cidrs = [] string { ipv4CIDR , ipv6CIDR }
21682168 staticIPsNetworkData = func (ips []string ) (string , error ) {
21692169 type Ethernet struct {
21702170 Addresses []string `json:"addresses,omitempty"`
@@ -2213,10 +2213,10 @@ chpasswd: { expire: False }
22132213 selectedNodes = workerNodeList .Items
22142214 Expect (selectedNodes ).NotTo (BeEmpty ())
22152215
2216- iperfServerTestPods , err = createIperfServerPods (selectedNodes , cudn .Name , cudn .Spec .Network .Localnet .Role , cidr )
2216+ iperfServerTestPods , err = createIperfServerPods (selectedNodes , cudn .Name , cudn .Spec .Network .Localnet .Role , filterCIDRs ( fr . ClientSet , cidrs ... ) )
22172217 Expect (err ).NotTo (HaveOccurred ())
22182218
2219- networkData , err := staticIPsNetworkData (selectCIDRs ( vmiIPv4 , vmiIPv6 ))
2219+ networkData , err := staticIPsNetworkData (filterCIDRs ( fr . ClientSet , vmiIPv4 , vmiIPv6 ))
22202220 Expect (err ).NotTo (HaveOccurred ())
22212221
22222222 vmi := fedoraWithTestToolingVMI (nil /*labels*/ , nil /*annotations*/ , nil /*nodeSelector*/ , kubevirtv1.NetworkSource {
0 commit comments