| 1 | // Copyright 2017 CNI authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package allocatorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/ |
| 16 | |
| 17 | import ( |
| 18 | "netscip-go gomod github.com/golang/go/src go1.24.2 net/" |
| 19 | |
| 20 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 21 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 22 | |
| 23 | "github.com/containernetworking/cni/pkg/typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/" |
| 24 | ) |
| 25 | |
| 26 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("IP ranges", func() { |
| 27 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should generate sane defaults for ipv4 with a clean prefix", func() { |
| 28 | snstr := "192.0.2.0/24" |
| 29 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr)} |
| 30 | |
| 31 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 32 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 33 | |
| 34 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 35 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: networkSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/networkSubnet().(snstr), |
| 36 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 1}, |
| 37 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 254}, |
| 38 | Gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 1}, |
| 39 | })) |
| 40 | }) |
| 41 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should generate sane defaults for a smaller ipv4 subnet", func() { |
| 42 | snstr := "192.0.2.0/25" |
| 43 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr)} |
| 44 | |
| 45 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 46 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 47 | |
| 48 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 49 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: networkSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/networkSubnet().(snstr), |
| 50 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 1}, |
| 51 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 126}, |
| 52 | Gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 1}, |
| 53 | })) |
| 54 | }) |
| 55 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should reject ipv4 subnet using a masked address", func() { |
| 56 | snstr := "192.0.2.12/24" |
| 57 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr)} |
| 58 | |
| 59 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 60 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("Network has host bits set. For a subnet mask of length 24 the network address is 192.0.2.0")) |
| 61 | }) |
| 62 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should reject ipv6 subnet using a masked address", func() { |
| 63 | snstr := "2001:DB8:1::24:19ff:fee1:c44a/64" |
| 64 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr)} |
| 65 | |
| 66 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 67 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("Network has host bits set. For a subnet mask of length 64 the network address is 2001:db8:1::")) |
| 68 | }) |
| 69 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should reject ipv6 prefix with host bit set", func() { |
| 70 | snstr := "2001:DB8:24:19ff::/63" |
| 71 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr)} |
| 72 | |
| 73 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 74 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("Network has host bits set. For a subnet mask of length 63 the network address is 2001:db8:24:19fe::")) |
| 75 | }) |
| 76 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should reject ipv4 network with host bit set", func() { |
| 77 | snstr := "192.168.127.0/23" |
| 78 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr)} |
| 79 | |
| 80 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 81 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("Network has host bits set. For a subnet mask of length 23 the network address is 192.168.126.0")) |
| 82 | }) |
| 83 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should generate sane defaults for ipv6 with a clean prefix", func() { |
| 84 | snstr := "2001:DB8:1::/64" |
| 85 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr)} |
| 86 | |
| 87 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 88 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 89 | |
| 90 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 91 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: networkSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/networkSubnet().(snstr), |
| 92 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:DB8:1::1"), |
| 93 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:DB8:1::ffff:ffff:ffff:ffff"), |
| 94 | Gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:DB8:1::1"), |
| 95 | })) |
| 96 | }) |
| 97 | |
| 98 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("Should reject a network that's too small", func() { |
| 99 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("192.0.2.0/31")} |
| 100 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 101 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("Network 192.0.2.0/31 too small to allocate from")) |
| 102 | }) |
| 103 | |
| 104 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should reject invalid RangeStart and RangeEnd specifications", func() { |
| 105 | snstr := "192.0.2.0/24" |
| 106 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr), RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.3.0")} |
| 107 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 108 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("RangeStart 192.0.3.0 not in network 192.0.2.0/24")) |
| 109 | |
| 110 | r = Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr), RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.4.0")} |
| 111 | err = r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 112 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("RangeEnd 192.0.4.0 not in network 192.0.2.0/24")) |
| 113 | |
| 114 | r = Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 115 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: networkSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/networkSubnet().(snstr), |
| 116 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.50"), |
| 117 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.40"), |
| 118 | } |
| 119 | err = r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 120 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().("RangeStart 192.0.2.50 not in network 192.0.2.0/24")) |
| 121 | }) |
| 122 | |
| 123 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should parse all fields correctly", func() { |
| 124 | snstr := "192.0.2.0/24" |
| 125 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 126 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(snstr), |
| 127 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.40"), |
| 128 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.50"), |
| 129 | Gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.254"), |
| 130 | } |
| 131 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 132 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 133 | |
| 134 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 135 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: networkSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/networkSubnet().(snstr), |
| 136 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 40}, |
| 137 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 50}, |
| 138 | Gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IP#{192, 0, 2, 254}, |
| 139 | })) |
| 140 | }) |
| 141 | |
| 142 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should accept v4 IPs in range and reject IPs out of range", func() { |
| 143 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 144 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("192.0.2.0/24"), |
| 145 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.40"), |
| 146 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.50"), |
| 147 | Gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Gateway.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.254"), |
| 148 | } |
| 149 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 150 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 151 | |
| 152 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.3.0"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 153 | |
| 154 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.39"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 155 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.40"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 156 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.50"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 157 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("192.0.2.51"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 158 | }) |
| 159 | |
| 160 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("should accept v6 IPs in range and reject IPs out of range", func() { |
| 161 | r := Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 162 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("2001:DB8:1::/64"), |
| 163 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::40"), |
| 164 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::50"), |
| 165 | } |
| 166 | err := r.Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 167 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 168 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:2::"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 169 | |
| 170 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::39"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 171 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::40"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 172 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::50"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 173 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.Containsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Contains().(netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("2001:db8:1::51"))).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 174 | }) |
| 175 | |
| 176 | DescribeTablescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/DescribeTable().("Detecting overlap", |
| 177 | func(r1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r1. Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#, r2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r2. Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#, expectedscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:expected. bool) { |
| 178 | r1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r1..Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 179 | r2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r2..Canonicalizescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Canonicalize().() |
| 180 | |
| 181 | // operation should be commutative |
| 182 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r1..Overlapsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Overlaps().(&r2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r2.)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(expectedscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:expected.)) |
| 183 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r2..Overlapsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Overlaps().(&r1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:r1.)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(expectedscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/_:expected.)) |
| 184 | }, |
| 185 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("non-overlapping", |
| 186 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/24")}, |
| 187 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.1.0/24")}, |
| 188 | false), |
| 189 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("different families", |
| 190 | // Note that the bits overlap |
| 191 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("0.0.0.0/24")}, |
| 192 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("::/24")}, |
| 193 | false), |
| 194 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("Identical", |
| 195 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/24")}, |
| 196 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/24")}, |
| 197 | true), |
| 198 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("Containing", |
| 199 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/20")}, |
| 200 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.1.0/24")}, |
| 201 | true), |
| 202 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("same subnet, non overlapping start + end", |
| 203 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 204 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/24"), |
| 205 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.0.0.127"), |
| 206 | }, |
| 207 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 208 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/24"), |
| 209 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.0.0.128"), |
| 210 | }, |
| 211 | false), |
| 212 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("same subnet, overlapping start + end", |
| 213 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 214 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/24"), |
| 215 | RangeEndscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeEnd.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.0.0.127"), |
| 216 | }, |
| 217 | Rangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#{ |
| 218 | Subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#Subnet.: mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().("10.0.0.0/24"), |
| 219 | RangeStartscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/Range#RangeStart.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseIPscip-go gomod github.com/golang/go/src go1.24.2 net/ParseIP().("10.0.0.127"), |
| 220 | }, |
| 221 | true), |
| 222 | ) |
| 223 | }) |
| 224 | |
| 225 | func mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(s string) typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.IPNetscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/IPNet# { |
| 226 | n, err := typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.ParseCIDRscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/ParseCIDR().(s) |
| 227 | if err != nil { |
| 228 | Failscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Fail().(err.Error()) |
| 229 | } |
| 230 | canonicalizeIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/canonicalizeIP().(&n.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.) |
| 231 | return typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.IPNetscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/IPNet#(*n) |
| 232 | } |
| 233 | |
| 234 | func networkSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/networkSubnet().(s string) typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.IPNetscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/IPNet# { |
| 235 | net := mustSubnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/mustSubnet().(s) |
| 236 | net.IP = net.IP.Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Mask().(net.Mask) |
| 237 | return net |
| 238 | } |