@@ -30,7 +30,10 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
3030
3131 expectedIPs := []string {"10.1.1.1" , "2000::1" }
3232
33- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )
33+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
34+ Name : subnetName ,
35+ Subnets : ovntest .MustParseIPNets (subnets ... ),
36+ })
3437 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
3538
3639 ips , err := allocator .AllocateNextIPs (subnetName )
@@ -48,7 +51,10 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
4851
4952 expectedIPs := []string {"10.1.1.1" , "2000::1" }
5053
51- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )
54+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
55+ Name : subnetName ,
56+ Subnets : ovntest .MustParseIPNets (subnets ... ),
57+ })
5258 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
5359
5460 ips , err := allocator .AllocateNextIPs (subnetName )
@@ -58,7 +64,10 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
5864 }
5965 subnets = []string {"10.1.2.0/24" }
6066 expectedIPs = []string {"10.1.2.1" }
61- err = allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )
67+ err = allocator .AddOrUpdateSubnet (SubnetConfig {
68+ Name : subnetName ,
69+ Subnets : ovntest .MustParseIPNets (subnets ... ),
70+ })
6271 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
6372
6473 ips , err = allocator .AllocateNextIPs (subnetName )
@@ -78,7 +87,11 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
7887
7988 expectedIPs := []string {"10.1.1.8" }
8089
81- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil , ovntest .MustParseIPNets (excludes ... )... )
90+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
91+ Name : subnetName ,
92+ Subnets : ovntest .MustParseIPNets (subnets ... ),
93+ ExcludeSubnets : ovntest .MustParseIPNets (excludes ... ),
94+ })
8295 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
8396
8497 ips , err := allocator .AllocateNextIPs (subnetName )
@@ -102,7 +115,10 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
102115 {"10.1.1.2" , "2000::2" },
103116 }
104117
105- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )
118+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
119+ Name : subnetName ,
120+ Subnets : ovntest .MustParseIPNets (subnets ... ),
121+ })
106122 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
107123 for _ , expectedIPs := range expectedIPAllocations {
108124 ips , err := allocator .AllocateNextIPs (subnetName )
@@ -122,8 +138,10 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
122138 {"10.1.1.1" },
123139 {"10.1.1.2" },
124140 }
125-
126- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )
141+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
142+ Name : subnetName ,
143+ Subnets : ovntest .MustParseIPNets (subnets ... ),
144+ })
127145 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
128146 for _ , expectedIPs := range expectedIPAllocations {
129147 ips , err := allocator .AllocateNextIPs (subnetName )
@@ -141,7 +159,11 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
141159 ginkgo .It ("fails to allocate multiple IPs from the same subnet" , func () {
142160 subnets := []string {"10.1.1.0/24" , "2000::/64" }
143161
144- gomega .Expect (allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )).To (gomega .Succeed ())
162+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
163+ Name : subnetName ,
164+ Subnets : ovntest .MustParseIPNets (subnets ... ),
165+ })
166+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
145167
146168 ips , err := util .ParseIPNets ([]string {"10.1.1.1/24" , "10.1.1.2/24" })
147169 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
@@ -164,7 +186,10 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
164186 {"10.1.1.5" , "10.1.2.5" },
165187 }
166188
167- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )
189+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
190+ Name : subnetName ,
191+ Subnets : ovntest .MustParseIPNets (subnets ... ),
192+ })
168193 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
169194 // exhaust valid ips in second subnet
170195 for _ , expectedIPs := range expectedIPAllocations {
@@ -202,7 +227,10 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
202227 "2000::1/64" ,
203228 }
204229
205- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), nil )
230+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
231+ Name : subnetName ,
232+ Subnets : ovntest .MustParseIPNets (subnets ... ),
233+ })
206234 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
207235 ips , err := allocator .AllocateNextIPs (subnetName )
208236 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
@@ -226,7 +254,11 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
226254 }
227255 expectedIP := "10.1.1.16/24"
228256
229- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), ovntest .MustParseIPNets (reservedSubnets ... ))
257+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
258+ Name : subnetName ,
259+ Subnets : ovntest .MustParseIPNets (subnets ... ),
260+ ReservedSubnets : ovntest .MustParseIPNets (reservedSubnets ... ),
261+ })
230262 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
231263
232264 ips , err := allocator .AllocateNextIPs (subnetName )
@@ -257,7 +289,12 @@ var _ = ginkgo.Describe("Subnet IP allocator operations", func() {
257289 }
258290 expectedIP := "10.1.1.16/24"
259291
260- err := allocator .AddOrUpdateSubnet (subnetName , ovntest .MustParseIPNets (subnets ... ), ovntest .MustParseIPNets (reservedSubnets ... ), ovntest .MustParseIPNets (excludeSubnets ... )... )
292+ err := allocator .AddOrUpdateSubnet (SubnetConfig {
293+ Name : subnetName ,
294+ Subnets : ovntest .MustParseIPNets (subnets ... ),
295+ ExcludeSubnets : ovntest .MustParseIPNets (excludeSubnets ... ),
296+ ReservedSubnets : ovntest .MustParseIPNets (reservedSubnets ... ),
297+ })
261298 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
262299
263300 ips , err := allocator .AllocateNextIPs (subnetName )
0 commit comments