| 1 | // Copyright 2018 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 mainscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/ |
| 16 | |
| 17 | import ( |
| 18 | "fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/" |
| 19 | "netscip-go gomod github.com/golang/go/src go1.24.2 net/" |
| 20 | "stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/" |
| 21 | |
| 22 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 23 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 24 | |
| 25 | "github.com/containernetworking/cni/pkg/skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/" |
| 26 | "github.com/containernetworking/cni/pkg/typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/" |
| 27 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/ "github.com/containernetworking/cni/pkg/types/100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/" |
| 28 | "github.com/containernetworking/plugins/pkg/testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/" |
| 29 | ) |
| 30 | |
| 31 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("static Operations", func() { |
| 32 | for _, ver := range testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.AllSpecVersionsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/AllSpecVersions. { |
| 33 | // Redefine ver inside for scope so real value is picked up by each dynamically defined It() |
| 34 | // See Gingkgo's "Patterns for dynamically generating tests" documentation. |
| 35 | ver := ver |
| 36 | |
| 37 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases addresses with ADD/DEL", ver), func() { |
| 38 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 39 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 40 | |
| 41 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 42 | "cniVersion": "%s", |
| 43 | "name": "mynet", |
| 44 | "type": "ipvlan", |
| 45 | "master": "foo0", |
| 46 | "ipam": { |
| 47 | "type": "static", |
| 48 | "addresses": [ { |
| 49 | "address": "10.10.0.1/24", |
| 50 | "gateway": "10.10.0.254" |
| 51 | }, |
| 52 | { |
| 53 | "address": "3ffe:ffff:0:01ff::1/64", |
| 54 | "gateway": "3ffe:ffff:0::1" |
| 55 | }], |
| 56 | "routes": [ |
| 57 | { "dst": "0.0.0.0/0" }, |
| 58 | { "dst": "192.168.0.0/16", "gw": "10.10.5.1" }, |
| 59 | { "dst": "3ffe:ffff:0:01ff::1/64" }], |
| 60 | "dns": { |
| 61 | "nameservers" : ["8.8.8.8"], |
| 62 | "domain": "example.com", |
| 63 | "search": [ "example.com" ] |
| 64 | } |
| 65 | } |
| 66 | }`, ver) |
| 67 | |
| 68 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 69 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 70 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 71 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 72 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 73 | } |
| 74 | |
| 75 | // Allocate the IP |
| 76 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 77 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 78 | }) |
| 79 | 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().()) |
| 80 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 81 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 82 | } |
| 83 | |
| 84 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 85 | 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().()) |
| 86 | |
| 87 | // Gomega is cranky about slices with different caps |
| 88 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0]).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().( |
| 89 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 90 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("10.10.0.1/24"), |
| 91 | Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#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().("10.10.0.254"), |
| 92 | })) |
| 93 | |
| 94 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1]).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().( |
| 95 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 96 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64"), |
| 97 | Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#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().("3ffe:ffff:0::1"), |
| 98 | }, |
| 99 | )) |
| 100 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 101 | |
| 102 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Routesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Routes.).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().([]*typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Routescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#{ |
| 103 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("0.0.0.0/0")}, |
| 104 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("192.168.0.0/16"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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.10.5.1")}, |
| 105 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64")}, |
| 106 | })) |
| 107 | |
| 108 | // Release the IP |
| 109 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 110 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdDel().(args) |
| 111 | }) |
| 112 | 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().()) |
| 113 | }) |
| 114 | |
| 115 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] doesn't error when passed an unknown ID on DEL", ver), func() { |
| 116 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 117 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 118 | |
| 119 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 120 | "cniVersion": "%s", |
| 121 | "name": "mynet", |
| 122 | "type": "ipvlan", |
| 123 | "master": "foo0", |
| 124 | "ipam": { |
| 125 | "type": "static", |
| 126 | "addresses": [ { |
| 127 | "address": "10.10.0.1/24", |
| 128 | "gateway": "10.10.0.254" |
| 129 | }, |
| 130 | { |
| 131 | "address": "3ffe:ffff:0:01ff::1/64", |
| 132 | "gateway": "3ffe:ffff:0::1" |
| 133 | }], |
| 134 | "routes": [ |
| 135 | { "dst": "0.0.0.0/0" }, |
| 136 | { "dst": "192.168.0.0/16", "gw": "10.10.5.1" }, |
| 137 | { "dst": "3ffe:ffff:0:01ff::1/64" }], |
| 138 | "dns": { |
| 139 | "nameservers" : ["8.8.8.8"], |
| 140 | "domain": "example.com", |
| 141 | "search": [ "example.com" ] |
| 142 | } |
| 143 | } |
| 144 | }`, ver) |
| 145 | |
| 146 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 147 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 148 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 149 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 150 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 151 | } |
| 152 | |
| 153 | // Release the IP |
| 154 | err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 155 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdDel().(args) |
| 156 | }) |
| 157 | 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().()) |
| 158 | }) |
| 159 | |
| 160 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases addresses with ADD/DEL, with ENV variables", ver), func() { |
| 161 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 162 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 163 | |
| 164 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 165 | "cniVersion": "%s", |
| 166 | "name": "mynet", |
| 167 | "type": "ipvlan", |
| 168 | "master": "foo0", |
| 169 | "ipam": { |
| 170 | "type": "static", |
| 171 | "routes": [ |
| 172 | { "dst": "0.0.0.0/0" }, |
| 173 | { "dst": "192.168.0.0/16", "gw": "10.10.5.1" }], |
| 174 | "dns": { |
| 175 | "nameservers" : ["8.8.8.8"], |
| 176 | "domain": "example.com", |
| 177 | "search": [ "example.com" ] |
| 178 | } |
| 179 | } |
| 180 | }`, ver) |
| 181 | |
| 182 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 183 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 184 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 185 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 186 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 187 | Argsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Args.: "IP=10.10.0.1/24;GATEWAY=10.10.0.254", |
| 188 | } |
| 189 | |
| 190 | // Allocate the IP |
| 191 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 192 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 193 | }) |
| 194 | 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().()) |
| 195 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 196 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 197 | } |
| 198 | |
| 199 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 200 | 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().()) |
| 201 | |
| 202 | // Gomega is cranky about slices with different caps |
| 203 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0]).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().( |
| 204 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 205 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("10.10.0.1/24"), |
| 206 | Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#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().("10.10.0.254"), |
| 207 | })) |
| 208 | |
| 209 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(1)) |
| 210 | |
| 211 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Routesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Routes.).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().([]*typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Routescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#{ |
| 212 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("0.0.0.0/0")}, |
| 213 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("192.168.0.0/16"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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.10.5.1")}, |
| 214 | })) |
| 215 | |
| 216 | // Release the IP |
| 217 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 218 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdDel().(args) |
| 219 | }) |
| 220 | 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().()) |
| 221 | }) |
| 222 | |
| 223 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases multiple addresses with ADD/DEL, with ENV variables", ver), func() { |
| 224 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 225 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 226 | |
| 227 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 228 | "cniVersion": "%s", |
| 229 | "name": "mynet", |
| 230 | "type": "ipvlan", |
| 231 | "master": "foo0", |
| 232 | "ipam": { |
| 233 | "type": "static" |
| 234 | } |
| 235 | }`, ver) |
| 236 | |
| 237 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 238 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 239 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 240 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 241 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 242 | Argsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Args.: "IP=10.10.0.1/24,11.11.0.1/24;GATEWAY=10.10.0.254", |
| 243 | } |
| 244 | |
| 245 | // Allocate the IP |
| 246 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 247 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 248 | }) |
| 249 | if !testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasMultipleIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasMultipleIPs().(ver) { |
| 250 | errStr := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("CNI version %s does not support more than 1 address per family", ver) |
| 251 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(MatchErrorscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/MatchError().(errStr)) |
| 252 | return |
| 253 | } |
| 254 | |
| 255 | 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().()) |
| 256 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 257 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 258 | } |
| 259 | |
| 260 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 261 | 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().()) |
| 262 | |
| 263 | // Gomega is cranky about slices with different caps |
| 264 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0]).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().( |
| 265 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 266 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("10.10.0.1/24"), |
| 267 | Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#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().("10.10.0.254"), |
| 268 | })) |
| 269 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1]).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().( |
| 270 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 271 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("11.11.0.1/24"), |
| 272 | Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Gateway.: nil, |
| 273 | })) |
| 274 | |
| 275 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 276 | |
| 277 | // Release the IP |
| 278 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 279 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdDel().(args) |
| 280 | }) |
| 281 | 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().()) |
| 282 | }) |
| 283 | |
| 284 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases multiple addresses with ADD/DEL, from RuntimeConfig", ver), func() { |
| 285 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 286 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 287 | |
| 288 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 289 | "cniVersion": "%s", |
| 290 | "name": "mynet", |
| 291 | "type": "ipvlan", |
| 292 | "master": "foo0", |
| 293 | "capabilities": {"ips": true}, |
| 294 | "ipam": { |
| 295 | "type": "static", |
| 296 | "routes": [ |
| 297 | { "dst": "0.0.0.0/0", "gw": "10.10.0.254" }, |
| 298 | { "dst": "3ffe:ffff:0:01ff::1/64", |
| 299 | "gw": "3ffe:ffff:0::1" } ], |
| 300 | "dns": { |
| 301 | "nameservers" : ["8.8.8.8"], |
| 302 | "domain": "example.com", |
| 303 | "search": [ "example.com" ] |
| 304 | } |
| 305 | }, |
| 306 | "RuntimeConfig": { |
| 307 | "ips" : ["10.10.0.1/24", "3ffe:ffff:0:01ff::1/64"] |
| 308 | } |
| 309 | }`, ver) |
| 310 | |
| 311 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 312 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 313 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 314 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 315 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 316 | } |
| 317 | |
| 318 | // Allocate the IP |
| 319 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 320 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 321 | }) |
| 322 | 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().()) |
| 323 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 324 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 325 | } |
| 326 | |
| 327 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 328 | 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().()) |
| 329 | |
| 330 | // Gomega is cranky about slices with different caps |
| 331 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0]).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().( |
| 332 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 333 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("10.10.0.1/24"), |
| 334 | })) |
| 335 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1]).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().( |
| 336 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 337 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64"), |
| 338 | }, |
| 339 | )) |
| 340 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 341 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Routesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Routes.).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().([]*typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Routescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#{ |
| 342 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("0.0.0.0/0"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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.10.0.254")}, |
| 343 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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().("3ffe:ffff:0::1")}, |
| 344 | })) |
| 345 | |
| 346 | // Release the IP |
| 347 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 348 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdDel().(args) |
| 349 | }) |
| 350 | 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().()) |
| 351 | }) |
| 352 | |
| 353 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases multiple addresses with ADD/DEL, from args", ver), func() { |
| 354 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 355 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 356 | |
| 357 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 358 | "cniVersion": "%s", |
| 359 | "name": "mynet", |
| 360 | "type": "ipvlan", |
| 361 | "master": "foo0", |
| 362 | "ipam": { |
| 363 | "type": "static", |
| 364 | "routes": [ |
| 365 | { "dst": "0.0.0.0/0", "gw": "10.10.0.254" }, |
| 366 | { "dst": "3ffe:ffff:0:01ff::1/64", |
| 367 | "gw": "3ffe:ffff:0::1" } ], |
| 368 | "dns": { |
| 369 | "nameservers" : ["8.8.8.8"], |
| 370 | "domain": "example.com", |
| 371 | "search": [ "example.com" ] |
| 372 | } |
| 373 | }, |
| 374 | "args": { |
| 375 | "cni": { |
| 376 | "ips" : ["10.10.0.1/24", "3ffe:ffff:0:01ff::1/64"] |
| 377 | } |
| 378 | } |
| 379 | }`, ver) |
| 380 | |
| 381 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 382 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 383 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 384 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 385 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 386 | } |
| 387 | |
| 388 | // Allocate the IP |
| 389 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 390 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 391 | }) |
| 392 | 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().()) |
| 393 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 394 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 395 | } |
| 396 | |
| 397 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 398 | 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().()) |
| 399 | |
| 400 | // Gomega is cranky about slices with different caps |
| 401 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0]).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().( |
| 402 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 403 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("10.10.0.1/24"), |
| 404 | })) |
| 405 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1]).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().( |
| 406 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 407 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64"), |
| 408 | }, |
| 409 | )) |
| 410 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 411 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Routesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Routes.).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().([]*typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Routescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#{ |
| 412 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("0.0.0.0/0"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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.10.0.254")}, |
| 413 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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().("3ffe:ffff:0::1")}, |
| 414 | })) |
| 415 | |
| 416 | // Release the IP |
| 417 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 418 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdDel().(args) |
| 419 | }) |
| 420 | 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().()) |
| 421 | }) |
| 422 | |
| 423 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] allocates and releases multiple addresses with ADD/DEL, from RuntimeConfig/ARGS/CNI_ARGS", ver), func() { |
| 424 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 425 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 426 | |
| 427 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 428 | "cniVersion": "%s", |
| 429 | "name": "mynet", |
| 430 | "type": "ipvlan", |
| 431 | "master": "foo0", |
| 432 | "capabilities": {"ips": true}, |
| 433 | "ipam": { |
| 434 | "type": "static", |
| 435 | "routes": [ |
| 436 | { "dst": "0.0.0.0/0", "gw": "10.10.0.254" }, |
| 437 | { "dst": "3ffe:ffff:0:01ff::1/64", |
| 438 | "gw": "3ffe:ffff:0::1" } ], |
| 439 | "dns": { |
| 440 | "nameservers" : ["8.8.8.8"], |
| 441 | "domain": "example.com", |
| 442 | "search": [ "example.com" ] |
| 443 | } |
| 444 | }, |
| 445 | "RuntimeConfig": { |
| 446 | "ips" : ["10.10.0.1/24", "3ffe:ffff:0:01ff::1/64"] |
| 447 | }, |
| 448 | "args": { |
| 449 | "cni": { |
| 450 | "ips" : ["10.10.0.2/24", "3ffe:ffff:0:01ff::2/64"] |
| 451 | } |
| 452 | } |
| 453 | }`, ver) |
| 454 | |
| 455 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 456 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 457 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 458 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 459 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 460 | Argsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Args.: "IP=10.10.0.3/24,11.11.0.3/24;GATEWAY=10.10.0.254", |
| 461 | } |
| 462 | |
| 463 | // Allocate the IP |
| 464 | r, raw, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 465 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 466 | }) |
| 467 | 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().()) |
| 468 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasIPVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasIPVersion().(ver) { |
| 469 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Indexscip-go gomod github.com/golang/go/src go1.24.2 strings/Index().(string(raw), "\"version\":")).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 470 | } |
| 471 | |
| 472 | result, err := types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/GetResult().(r) |
| 473 | 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().()) |
| 474 | |
| 475 | // only addresses in runtimeConfig configured because of its priorities |
| 476 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0]).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().( |
| 477 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 478 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("10.10.0.1/24"), |
| 479 | })) |
| 480 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[1]).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().( |
| 481 | types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.IPConfigscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#{ |
| 482 | Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64"), |
| 483 | }, |
| 484 | )) |
| 485 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(2)) |
| 486 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Routesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Routes.).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().([]*typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Routescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#{ |
| 487 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("0.0.0.0/0"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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.10.0.254")}, |
| 488 | {Dstscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#Dst.: mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().("3ffe:ffff:0:01ff::1/64"), GWscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Route#GW.: 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().("3ffe:ffff:0::1")}, |
| 489 | })) |
| 490 | |
| 491 | // Release the IP |
| 492 | err = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdDelWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdDelWithArgs().(args, func() error { |
| 493 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdDel().(args) |
| 494 | }) |
| 495 | 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().()) |
| 496 | }) |
| 497 | |
| 498 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] is returning an error on missing ipam key when args are set", ver), func() { |
| 499 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 500 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 501 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 502 | "cniVersion": "%s", |
| 503 | "name": "mynet", |
| 504 | "type": "ipvlan", |
| 505 | "master": "foo0" |
| 506 | }`, ver) |
| 507 | |
| 508 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 509 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 510 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 511 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 512 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 513 | Argsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Args.: "IP=10.10.0.1/24;GATEWAY=10.10.0.254", |
| 514 | } |
| 515 | |
| 516 | // Allocate the IP |
| 517 | _, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 518 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 519 | }) |
| 520 | 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().("IPAM config missing 'ipam' key")) |
| 521 | }) |
| 522 | |
| 523 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] is returning an error on missing ipam key when runtimeConfig is set", ver), func() { |
| 524 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 525 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 526 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 527 | "cniVersion": "%s", |
| 528 | "name": "mynet", |
| 529 | "type": "ipvlan", |
| 530 | "master": "foo0", |
| 531 | "runtimeConfig": { |
| 532 | "ips": ["10.10.0.1/24"] |
| 533 | } |
| 534 | }`, ver) |
| 535 | |
| 536 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 537 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 538 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 539 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 540 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 541 | } |
| 542 | |
| 543 | // Allocate the IP |
| 544 | _, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 545 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 546 | }) |
| 547 | 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().("IPAM config missing 'ipam' key")) |
| 548 | }) |
| 549 | |
| 550 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] errors when passed an invalid CIDR via ipam config", ver), func() { |
| 551 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 552 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 553 | const ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr. string = "10.10.0.1" |
| 554 | |
| 555 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 556 | "cniVersion": "%s", |
| 557 | "name": "mynet", |
| 558 | "type": "bridge", |
| 559 | "ipam": { |
| 560 | "type": "static", |
| 561 | "addresses": [ { |
| 562 | "address": "%s" |
| 563 | }] |
| 564 | } |
| 565 | }`, ver, ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.) |
| 566 | |
| 567 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 568 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 569 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 570 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 571 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 572 | } |
| 573 | |
| 574 | // Allocate the IP |
| 575 | _, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 576 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 577 | }) |
| 578 | 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().( |
| 579 | fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("the 'address' field is expected to be in CIDR notation, got: '%s'", ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.))) |
| 580 | }) |
| 581 | |
| 582 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] errors when passed an invalid CIDR via Args", ver), func() { |
| 583 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 584 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 585 | const ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr. string = "10.10.0.1" |
| 586 | |
| 587 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 588 | "cniVersion": "%s", |
| 589 | "name": "mynet", |
| 590 | "type": "bridge", |
| 591 | "ipam": { |
| 592 | "type": "static", |
| 593 | "routes": [{ "dst": "0.0.0.0/0" }] |
| 594 | } |
| 595 | }`, ver) |
| 596 | |
| 597 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 598 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 599 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 600 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 601 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 602 | Argsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Args.: fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("IP=%s", ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.), |
| 603 | } |
| 604 | |
| 605 | // Allocate the IP |
| 606 | _, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 607 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 608 | }) |
| 609 | 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().( |
| 610 | fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("the 'ip' field is expected to be in CIDR notation, got: '%s'", ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.))) |
| 611 | }) |
| 612 | |
| 613 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] errors when passed an invalid CIDR via CNI_ARGS", ver), func() { |
| 614 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 615 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 616 | const ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr. string = "10.10.0.1" |
| 617 | |
| 618 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 619 | "cniVersion": "%s", |
| 620 | "name": "mynet", |
| 621 | "type": "bridge", |
| 622 | "ipam": { |
| 623 | "type": "static", |
| 624 | "routes": [{ "dst": "0.0.0.0/0" }] |
| 625 | }, |
| 626 | "args": { |
| 627 | "cni": { |
| 628 | "ips" : ["%s"] |
| 629 | } |
| 630 | } |
| 631 | }`, ver, ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.) |
| 632 | |
| 633 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 634 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 635 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 636 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 637 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 638 | } |
| 639 | |
| 640 | // Allocate the IP |
| 641 | _, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 642 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 643 | }) |
| 644 | 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().( |
| 645 | fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("an entry in the 'ips' field is NOT in CIDR notation, got: '%s'", ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.))) |
| 646 | }) |
| 647 | |
| 648 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] errors when passed an invalid CIDR via RuntimeConfig", ver), func() { |
| 649 | const ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname. string = "eth0" |
| 650 | const nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath. string = "/some/where" |
| 651 | const ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr. string = "10.10.0.1" |
| 652 | |
| 653 | conf := fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().(`{ |
| 654 | "cniVersion": "%s", |
| 655 | "name": "mynet", |
| 656 | "type": "bridge", |
| 657 | "ipam": { |
| 658 | "type": "static", |
| 659 | "routes": [{ "dst": "0.0.0.0/0" }] |
| 660 | }, |
| 661 | "RuntimeConfig": { |
| 662 | "ips" : ["%s"] |
| 663 | } |
| 664 | }`, ver, ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.) |
| 665 | |
| 666 | args := &skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/.CmdArgsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#{ |
| 667 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 668 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: nspathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:nspath., |
| 669 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: ifnamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ifname., |
| 670 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 671 | } |
| 672 | |
| 673 | // Allocate the IP |
| 674 | _, _, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdAddWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdAddWithArgs().(args, func() error { |
| 675 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/cmdAdd().(args) |
| 676 | }) |
| 677 | 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().( |
| 678 | fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("an entry in the 'ips' field is NOT in CIDR notation, got: '%s'", ipStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/_:ipStr.))) |
| 679 | }) |
| 680 | } |
| 681 | }) |
| 682 | |
| 683 | func mustCIDRscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/static`/mustCIDR().(s string) netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPNetscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet# { |
| 684 | ip, n, err := netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseCIDRscip-go gomod github.com/golang/go/src go1.24.2 net/ParseCIDR().(s) |
| 685 | n.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP. = ip |
| 686 | if err != nil { |
| 687 | Failscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Fail().(err.Error()) |
| 688 | } |
| 689 | |
| 690 | return *n |
| 691 | } |