| 1 | // Copyright 2015-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/main/bridge`/ |
| 16 | |
| 17 | import ( |
| 18 | "contextscip-go gomod github.com/golang/go/src go1.24.2 context/" |
| 19 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/" |
| 20 | "fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/" |
| 21 | "netscip-go gomod github.com/golang/go/src go1.24.2 net/" |
| 22 | "osscip-go gomod github.com/golang/go/src go1.24.2 os/" |
| 23 | "stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/" |
| 24 | |
| 25 | "github.com/coreos/go-iptables/iptablesscip-go gomod github.com/coreos/go-iptables v0.8.0 `github.com/coreos/go-iptables/iptables`/" |
| 26 | "github.com/networkplumbing/go-nft/nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/" |
| 27 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 28 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 29 | "github.com/vishvananda/netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/" |
| 30 | "github.com/vishvananda/netlink/nlscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink/nl`/" |
| 31 | "sigs.k8s.io/knftablesscip-go gomod sigs.k8s.io/knftables v0.0.18 `sigs.k8s.io/knftables`/" |
| 32 | |
| 33 | "github.com/containernetworking/cni/pkg/skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/" |
| 34 | "github.com/containernetworking/cni/pkg/typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/" |
| 35 | types040scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/ "github.com/containernetworking/cni/pkg/types/040scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/" |
| 36 | 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`/" |
| 37 | "github.com/containernetworking/plugins/pkg/ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/" |
| 38 | "github.com/containernetworking/plugins/pkg/netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/" |
| 39 | "github.com/containernetworking/plugins/pkg/nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/" |
| 40 | "github.com/containernetworking/plugins/pkg/testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/" |
| 41 | "github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocatorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/" |
| 42 | ) |
| 43 | |
| 44 | const ( |
| 45 | BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME. = "bridge0" |
| 46 | BRNAMEVLANscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAMEVLAN. = "bridge0.100" |
| 47 | IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME. = "eth0" |
| 48 | NAMESERVERscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NAMESERVER. = "192.0.2.0" |
| 49 | ) |
| 50 | |
| 51 | type Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net# struct { |
| 52 | Namescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#Name. string `json:"name"` |
| 53 | CNIVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#CNIVersion. string `json:"cniVersion"` |
| 54 | Typescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#Type. string `json:"type,omitempty"` |
| 55 | BrNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#BrName. string `json:"bridge"` |
| 56 | IPAMscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#IPAM. *allocatorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/.IPAMConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/IPAMConfig# `json:"ipam"` |
| 57 | // RuntimeConfig struct { // The capability arg |
| 58 | // IPRanges []RangeSet `json:"ipRanges,omitempty"` |
| 59 | // Args *struct { |
| 60 | // } `json:"runtimeConfig,omitempty"` |
| 61 | |
| 62 | // A *IPAMArgs `json:"cni"` |
| 63 | DNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#DNS. typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.DNSscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS# `json:"dns"` |
| 64 | RawPrevResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#RawPrevResult. map[string]interface{} `json:"prevResult,omitempty"` |
| 65 | PrevResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#PrevResult. types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result# `json:"-"` |
| 66 | } |
| 67 | |
| 68 | // testCase defines the CNI network configuration and the expected |
| 69 | // bridge addresses for a test case. |
| 70 | type testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase# struct { |
| 71 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. string // CNI Version |
| 72 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet. string // Single subnet config: Subnet CIDR |
| 73 | gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#gateway. string // Single subnet config: Gateway |
| 74 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges. []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo# // Ranges list (multiple subnets config) |
| 75 | resolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#resolvConf. string // host-local resolvConf file path |
| 76 | isGWscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isGW. bool |
| 77 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. bool |
| 78 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. []string // Expected gateway addresses in CIDR form |
| 79 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. int |
| 80 | vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk# |
| 81 | removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. bool |
| 82 | ipMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasq. bool |
| 83 | ipMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackend. string |
| 84 | macspoofchkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#macspoofchk. bool |
| 85 | disableContIfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#disableContIface. bool |
| 86 | portIsolationscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#portIsolation. bool |
| 87 | |
| 88 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020. string |
| 89 | DelErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr020. string |
| 90 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010. string |
| 91 | DelErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr010. string |
| 92 | |
| 93 | envArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#envArgs. string // CNI_ARGS |
| 94 | runtimeConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#runtimeConfig. struct { |
| 95 | macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_56cad4e26b96cf38#mac. string |
| 96 | } |
| 97 | argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#args. struct { |
| 98 | cniscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#cni. struct { |
| 99 | macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#$anon_56cad4e26b96cf38#mac. string |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | // Unlike the parameters above, the following parameters |
| 104 | // are expected values to be checked against. |
| 105 | // e.g. the mac address has several sources: CNI_ARGS, Args and RuntimeConfig. |
| 106 | expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac. string |
| 107 | } |
| 108 | |
| 109 | // Range definition for each entry in the ranges list |
| 110 | type rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo# struct { |
| 111 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet. string |
| 112 | gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#gateway. string |
| 113 | } |
| 114 | |
| 115 | // netConf() creates a NetConf structure for a test case. |
| 116 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) netConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConf().() *NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf# { |
| 117 | return &NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#{ |
| 118 | NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#NetConf.: typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.NetConfscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/NetConf#{ |
| 119 | CNIVersionscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#CNIVersion.: tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion., |
| 120 | Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#Name.: "testConfig", |
| 121 | Typescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#Type.: "bridge", |
| 122 | }, |
| 123 | BrNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#BrName.: BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., |
| 124 | IsGWscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#IsGW.: tc.isGWscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isGW., |
| 125 | IPMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#IPMasq.: false, |
| 126 | MTUscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#MTU.: 5000, |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // Snippets for generating a JSON network configuration string. |
| 131 | const ( |
| 132 | netConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/netConfStr. = ` |
| 133 | "cniVersion": "%s", |
| 134 | "name": "testConfig", |
| 135 | "type": "bridge", |
| 136 | "bridge": "%s"` |
| 137 | |
| 138 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlan. = `, |
| 139 | "vlan": %d` |
| 140 | |
| 141 | vlanTrunkStartStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunkStartStr. = `, |
| 142 | "vlanTrunk": [` |
| 143 | |
| 144 | vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunk. = ` |
| 145 | { |
| 146 | "id": %d |
| 147 | }` |
| 148 | |
| 149 | vlanTrunkRangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunkRange. = ` |
| 150 | { |
| 151 | "minID": %d, |
| 152 | "maxID": %d |
| 153 | }` |
| 154 | |
| 155 | vlanTrunkEndStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunkEndStr. = ` |
| 156 | ]` |
| 157 | |
| 158 | preserveDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/preserveDefaultVlan. = `, |
| 159 | "preserveDefaultVlan": false` |
| 160 | |
| 161 | netDefaultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/netDefault. = `, |
| 162 | "isDefaultGateway": true` |
| 163 | |
| 164 | disableContainerInterfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/disableContainerInterface. = `, |
| 165 | "disableContainerInterface": true` |
| 166 | |
| 167 | portIsolationscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/portIsolation. = `, |
| 168 | "portIsolation": true` |
| 169 | |
| 170 | ipamStartStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamStartStr. = `, |
| 171 | "ipam": { |
| 172 | "type": "host-local"` |
| 173 | |
| 174 | ipamDataDirStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamDataDirStr. = `, |
| 175 | "dataDir": "%s"` |
| 176 | |
| 177 | ipamResolvConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamResolvConfStr. = `, |
| 178 | "resolvConf": "%s"` |
| 179 | |
| 180 | ipMasqConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipMasqConfStr. = `, |
| 181 | "ipMasq": %t` |
| 182 | |
| 183 | ipMasqBackendConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipMasqBackendConfStr. = `, |
| 184 | "ipMasqBackend": "%s"` |
| 185 | |
| 186 | // Single subnet configuration (legacy) |
| 187 | subnetConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/subnetConfStr. = `, |
| 188 | "subnet": "%s"` |
| 189 | gatewayConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/gatewayConfStr. = `, |
| 190 | "gateway": "%s"` |
| 191 | |
| 192 | // Ranges (multiple subnets) configuration |
| 193 | rangesStartStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangesStartStr. = `, |
| 194 | "ranges": [` |
| 195 | rangeSubnetConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeSubnetConfStr. = ` |
| 196 | [{ |
| 197 | "subnet": "%s" |
| 198 | }]` |
| 199 | rangeSubnetGWConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeSubnetGWConfStr. = ` |
| 200 | [{ |
| 201 | "subnet": "%s", |
| 202 | "gateway": "%s" |
| 203 | }]` |
| 204 | rangesEndStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangesEndStr. = ` |
| 205 | ]` |
| 206 | |
| 207 | ipamEndStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamEndStr. = ` |
| 208 | }` |
| 209 | |
| 210 | macspoofchkFormatscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/macspoofchkFormat. = `, |
| 211 | "macspoofchk": %t` |
| 212 | |
| 213 | argsFormatscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/argsFormat. = `, |
| 214 | "args": { |
| 215 | "cni": { |
| 216 | "mac": %q |
| 217 | } |
| 218 | }` |
| 219 | |
| 220 | runtimeConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/runtimeConfig. = `, |
| 221 | "RuntimeConfig": { |
| 222 | "mac": %q |
| 223 | }` |
| 224 | ) |
| 225 | |
| 226 | // netConfJSON() generates a JSON network configuration string |
| 227 | // for a test case. |
| 228 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) netConfJSONscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConfJSON().(dataDir string) string { |
| 229 | 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().(netConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/netConfStr., tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion., BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 230 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 231 | 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().(vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlan., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.) |
| 232 | |
| 233 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 234 | conf += preserveDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/preserveDefaultVlan. |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | if tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. != nil { |
| 239 | conf += vlanTrunkStartStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunkStartStr. |
| 240 | for i, vlan := range tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. { |
| 241 | if i > 0 { |
| 242 | conf += "," |
| 243 | } |
| 244 | if vlan.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID. != nil { |
| 245 | 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().(vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunk., *vlan.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID.) |
| 246 | } |
| 247 | if vlan.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID. != nil && vlan.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID. != nil { |
| 248 | 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().(vlanTrunkRangescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunkRange., *vlan.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID., *vlan.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.) |
| 249 | } |
| 250 | } |
| 251 | conf += vlanTrunkEndStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/vlanTrunkEndStr. |
| 252 | } |
| 253 | |
| 254 | if tc.ipMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasq. { |
| 255 | conf += tc.ipMasqConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqConfig().() |
| 256 | } |
| 257 | if tc.ipMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackend. != "" { |
| 258 | conf += tc.ipMasqBackendConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackendConfig().() |
| 259 | } |
| 260 | if tc.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#args..cniscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#cni..macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#$anon_56cad4e26b96cf38#mac. != "" { |
| 261 | 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().(argsFormatscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/argsFormat., tc.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#args..cniscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#cni..macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#$anon_56cad4e26b96cf38#mac.) |
| 262 | } |
| 263 | if tc.runtimeConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#runtimeConfig..macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_56cad4e26b96cf38#mac. != "" { |
| 264 | 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().(runtimeConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/runtimeConfig., tc.runtimeConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#runtimeConfig..macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_56cad4e26b96cf38#mac.) |
| 265 | } |
| 266 | if tc.macspoofchkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#macspoofchk. { |
| 267 | 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().(macspoofchkFormatscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/macspoofchkFormat., tc.macspoofchkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#macspoofchk.) |
| 268 | } |
| 269 | |
| 270 | if tc.disableContIfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#disableContIface. { |
| 271 | conf += disableContainerInterfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/disableContainerInterface. |
| 272 | } |
| 273 | |
| 274 | if tc.portIsolationscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#portIsolation. { |
| 275 | conf += portIsolationscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/portIsolation. |
| 276 | } |
| 277 | |
| 278 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. { |
| 279 | conf += netDefaultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/netDefault. |
| 280 | if tc.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet. != "" || tc.rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges. != nil { |
| 281 | conf += ipamStartStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamStartStr. |
| 282 | if dataDir != "" { |
| 283 | 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().(ipamDataDirStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamDataDirStr., dataDir) |
| 284 | } |
| 285 | if tc.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet. != "" { |
| 286 | conf += tc.subnetConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnetConfig().() |
| 287 | } |
| 288 | if tc.rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges. != nil { |
| 289 | conf += tc.rangesConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#rangesConfig().() |
| 290 | } |
| 291 | if tc.resolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#resolvConf. != "" { |
| 292 | conf += tc.resolvConfConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#resolvConfConfig().() |
| 293 | } |
| 294 | conf += ipamEndStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamEndStr. |
| 295 | } |
| 296 | } else { |
| 297 | conf += `, |
| 298 | "ipam": {}` |
| 299 | } |
| 300 | return "{" + conf + "\n}" |
| 301 | } |
| 302 | |
| 303 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) subnetConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnetConfig().() string { |
| 304 | 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().(subnetConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/subnetConfStr., tc.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.) |
| 305 | if tc.gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#gateway. != "" { |
| 306 | 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().(gatewayConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/gatewayConfStr., tc.gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#gateway.) |
| 307 | } |
| 308 | return conf |
| 309 | } |
| 310 | |
| 311 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) ipMasqConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqConfig().() string { |
| 312 | 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().(ipMasqConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipMasqConfStr., tc.ipMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasq.) |
| 313 | return conf |
| 314 | } |
| 315 | |
| 316 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) ipMasqBackendConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackendConfig().() string { |
| 317 | 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().(ipMasqBackendConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipMasqBackendConfStr., tc.ipMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackend.) |
| 318 | return conf |
| 319 | } |
| 320 | |
| 321 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) rangesConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#rangesConfig().() string { |
| 322 | conf := rangesStartStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangesStartStr. |
| 323 | for i, tcRange := range tc.rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges. { |
| 324 | if i > 0 { |
| 325 | conf += "," |
| 326 | } |
| 327 | if tcRange.gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#gateway. != "" { |
| 328 | 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().(rangeSubnetGWConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeSubnetGWConfStr., tcRange.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet., tcRange.gatewayscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#gateway.) |
| 329 | } else { |
| 330 | 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().(rangeSubnetConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeSubnetConfStr., tcRange.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.) |
| 331 | } |
| 332 | } |
| 333 | return conf + rangesEndStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangesEndStr. |
| 334 | } |
| 335 | |
| 336 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) resolvConfConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#resolvConfConfig().() string { |
| 337 | 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().(ipamResolvConfStrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipamResolvConfStr., tc.resolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#resolvConf.) |
| 338 | return conf |
| 339 | } |
| 340 | |
| 341 | func newResolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/newResolvConf().() (string, error) { |
| 342 | f, err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.CreateTempscip-go gomod github.com/golang/go/src go1.24.2 os/CreateTemp().("", "host_local_resolv") |
| 343 | if err != nil { |
| 344 | return "", err |
| 345 | } |
| 346 | defer f.Closescip-go gomod github.com/golang/go/src go1.24.2 os/File#Close().() |
| 347 | name := f.Namescip-go gomod github.com/golang/go/src go1.24.2 os/File#Name().() |
| 348 | _, err = fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Fprintf().(f, "nameserver %s", NAMESERVERscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NAMESERVER.) |
| 349 | return name, err |
| 350 | } |
| 351 | |
| 352 | func deleteResolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/deleteResolvConf().(path string) error { |
| 353 | return osscip-go gomod github.com/golang/go/src go1.24.2 os/.Removescip-go gomod github.com/golang/go/src go1.24.2 os/Remove().(path) |
| 354 | } |
| 355 | |
| 356 | var counterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/counter. uint |
| 357 | |
| 358 | // createCmdArgs generates network configuration and creates command |
| 359 | // arguments for a test case. |
| 360 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(targetNS nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#, dataDir string) *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# { |
| 361 | conf := tc.netConfJSONscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConfJSON().(dataDir) |
| 362 | // defer func() { counter += 1 }() |
| 363 | return &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#{ |
| 364 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: 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().("dummy-%d", counterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/counter.), |
| 365 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: targetNS.Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.(), |
| 366 | 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/main/bridge`/IFNAME., |
| 367 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 368 | Argsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Args.: tc.envArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#envArgs., |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | // createCheckCmdArgs generates network configuration and creates command |
| 373 | // arguments for a Check test case. |
| 374 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) createCheckCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCheckCmdArgs().(targetNS nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#, config *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#) *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# { |
| 375 | conf, err := jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/Marshal().(config) |
| 376 | 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().()) |
| 377 | |
| 378 | // TODO Don't we need to use the same counter as before? |
| 379 | // defer func() { counter += 1 }() |
| 380 | return &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#{ |
| 381 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: 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().("dummy-%d", counterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/counter.), |
| 382 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: targetNS.Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.(), |
| 383 | 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/main/bridge`/IFNAME., |
| 384 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: conf, |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | // expectedCIDRs determines the IPv4 and IPv6 CIDRs in which the resulting |
| 389 | // addresses are expected to be contained. |
| 390 | func (tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) expectedCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedCIDRs().() ([]*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#, []*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#) { |
| 391 | var cidrsV4, cidrsV6 []*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# |
| 392 | appendSubnet := func(subnet string) { |
| 393 | ip, cidr, 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().(subnet) |
| 394 | 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().()) |
| 395 | if ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(ip) == "4" { |
| 396 | cidrsV4 = append(cidrsV4, cidr) |
| 397 | } else { |
| 398 | cidrsV6 = append(cidrsV6, cidr) |
| 399 | } |
| 400 | } |
| 401 | if tc.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet. != "" { |
| 402 | appendSubnet(tc.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.) |
| 403 | } |
| 404 | for _, r := range tc.rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges. { |
| 405 | appendSubnet(r.subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.) |
| 406 | } |
| 407 | return cidrsV4, cidrsV6 |
| 408 | } |
| 409 | |
| 410 | // delBridgeAddrs() deletes addresses from the bridge |
| 411 | func delBridgeAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/delBridgeAddrs().(testNS nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) { |
| 412 | err := testNS.Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 413 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 414 | |
| 415 | br, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 416 | 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().()) |
| 417 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(br, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 418 | 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().()) |
| 419 | for _, addr := range addrs { |
| 420 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 421 | err = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.AddrDelscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/AddrDel().(br, &addr) |
| 422 | 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().()) |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | br, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEVLANscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAMEVLAN.) |
| 427 | if err == nil { |
| 428 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(br, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 429 | 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().()) |
| 430 | for _, addr := range addrs { |
| 431 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 432 | err = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.AddrDelscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/AddrDel().(br, &addr) |
| 433 | 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().()) |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | return nil |
| 439 | }) |
| 440 | 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().()) |
| 441 | } |
| 442 | |
| 443 | func delVlanAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/delVlanAddrs().(testNS nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#, vlan int) { |
| 444 | err := testNS.Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 445 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 446 | |
| 447 | vlanLink, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., vlan)) |
| 448 | 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().()) |
| 449 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(vlanLink, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 450 | 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().()) |
| 451 | for _, addr := range addrs { |
| 452 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 453 | err = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.AddrDelscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/AddrDel().(vlanLink, &addr) |
| 454 | 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().()) |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | return nil |
| 459 | }) |
| 460 | 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().()) |
| 461 | } |
| 462 | |
| 463 | func ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(ip 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#) string { |
| 464 | if ip.To4scip-go gomod github.com/golang/go/src go1.24.2 net/IP#To4().() != nil { |
| 465 | return "4" |
| 466 | } |
| 467 | return "6" |
| 468 | } |
| 469 | |
| 470 | func countIPAMIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/countIPAMIPs().(path string) (int, error) { |
| 471 | count := 0 |
| 472 | entries, err := osscip-go gomod github.com/golang/go/src go1.24.2 os/.ReadDirscip-go gomod github.com/golang/go/src go1.24.2 os/ReadDir().(path) |
| 473 | if err != nil { |
| 474 | return -1, err |
| 475 | } |
| 476 | for _, entry := range entries { |
| 477 | if entry.IsDirscip-go gomod github.com/golang/go/src go1.24.2 `io/fs`/DirEntry#IsDir().() { |
| 478 | continue |
| 479 | } |
| 480 | |
| 481 | if 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().(entry.Namescip-go gomod github.com/golang/go/src go1.24.2 `io/fs`/DirEntry#Name().()) != nil { |
| 482 | count++ |
| 483 | } |
| 484 | } |
| 485 | return count, nil |
| 486 | } |
| 487 | |
| 488 | func checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(vlanID int, bridgeVlanInfo []*nlscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink/nl`/.BridgeVlanInfoscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink/nl`/BridgeVlanInfo#) bool { |
| 489 | for _, vlan := range bridgeVlanInfo { |
| 490 | if vlan.Vidscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink/nl`/BridgeVlanInfo#Vid. == uint16(vlanID) { |
| 491 | return true |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | return false |
| 496 | } |
| 497 | |
| 498 | type cmdAddDelTesterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester# interface { |
| 499 | cmdAddTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdAddTest.(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) (typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#, error) |
| 500 | cmdCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdCheckTest.(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, conf *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#, dataDir string) |
| 501 | cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdDelTest.(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) |
| 502 | } |
| 503 | |
| 504 | type testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase# struct { |
| 505 | testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS. nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS# |
| 506 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS. nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS# |
| 507 | argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#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# |
| 508 | vethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#vethName. string |
| 509 | } |
| 510 | |
| 511 | type ( |
| 512 | testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase# |
| 513 | testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase# |
| 514 | testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase# |
| 515 | testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase# |
| 516 | ) |
| 517 | |
| 518 | func newTesterByVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/newTesterByVersion().(version string, testNS, targetNS nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) cmdAddDelTesterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester# { |
| 519 | switch { |
| 520 | case stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.24.2 strings/HasPrefix().(version, "1.1."): |
| 521 | return &testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#{ |
| 522 | testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS.: testNS, |
| 523 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS.: targetNS, |
| 524 | } |
| 525 | case stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.24.2 strings/HasPrefix().(version, "1.0."): |
| 526 | return &testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#{ |
| 527 | testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS.: testNS, |
| 528 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS.: targetNS, |
| 529 | } |
| 530 | case stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.24.2 strings/HasPrefix().(version, "0.4."): |
| 531 | return &testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x#{ |
| 532 | testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS.: testNS, |
| 533 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS.: targetNS, |
| 534 | } |
| 535 | case stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.24.2 strings/HasPrefix().(version, "0.3."): |
| 536 | return &testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#{ |
| 537 | testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS.: testNS, |
| 538 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS.: targetNS, |
| 539 | } |
| 540 | default: |
| 541 | return &testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x#{ |
| 542 | testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS.: testNS, |
| 543 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS.: targetNS, |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | func (tester *testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#) cmdAddTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#cmdAddTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) (typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#, error) { |
| 549 | // Generate network config and command arguments |
| 550 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., dataDir) |
| 551 | |
| 552 | // Execute cmdADD on the plugin |
| 553 | var result *types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result# |
| 554 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 555 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 556 | |
| 557 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 558 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 559 | }) |
| 560 | 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().()) |
| 561 | 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), "\"interfaces\":")).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)) |
| 562 | |
| 563 | resultType, err := r.GetAsVersionscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#GetAsVersion().(tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.) |
| 564 | 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().()) |
| 565 | result = resultType.(*types100scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#) |
| 566 | |
| 567 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 568 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.).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().(4)) |
| 569 | } else { |
| 570 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.).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().(3)) |
| 571 | } |
| 572 | |
| 573 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[0].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 574 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[0].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Mac.).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().(17)) |
| 575 | |
| 576 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Name.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HavePrefixscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HavePrefix().("veth")) |
| 577 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[1].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Mac.).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().(17)) |
| 578 | |
| 579 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[2].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 580 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[2].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Mac.).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().(17)) |
| 581 | if tc.expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac. != "" { |
| 582 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[2].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Mac.).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().(tc.expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac.)) |
| 583 | } |
| 584 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[2].Sandboxscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Sandbox.).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().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.())) |
| 585 | |
| 586 | // Make sure bridge link exists |
| 587 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[0].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Name.) |
| 588 | 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().()) |
| 589 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 590 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#{})) |
| 591 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).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().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[0].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Mac.)) |
| 592 | bridgeMAC := link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().() |
| 593 | |
| 594 | var vlanLink netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Linkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link# |
| 595 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 596 | // Make sure vlan link exists |
| 597 | vlanLink, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.)) |
| 598 | 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().()) |
| 599 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.))) |
| 600 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 601 | |
| 602 | // Check the bridge dot vlan interface have the vlan tag |
| 603 | peerLink, err := netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.LinkByIndexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkByIndex().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index. - 1) |
| 604 | 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().()) |
| 605 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 606 | 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().()) |
| 607 | vlans, isExist := interfaceMap[int32(peerLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 608 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 609 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 610 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 611 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | // Check the bridge vlan filtering equals true |
| 616 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 || tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. != nil { |
| 617 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 618 | } else { |
| 619 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 620 | } |
| 621 | |
| 622 | // Ensure bridge has expected gateway address(es) |
| 623 | var addrs []netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Addrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr# |
| 624 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 625 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 626 | } else { |
| 627 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(vlanLink, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 628 | } |
| 629 | 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().()) |
| 630 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).ToNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#ToNot().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 631 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 632 | ip, subnet, 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().(cidr) |
| 633 | 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().()) |
| 634 | |
| 635 | found := false |
| 636 | subnetPrefix, subnetBits := subnet.Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 637 | for _, a := range addrs { |
| 638 | aPrefix, aBits := a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 639 | if a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(ip) && aPrefix == subnetPrefix && aBits == subnetBits { |
| 640 | found = true |
| 641 | break |
| 642 | } |
| 643 | } |
| 644 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().(), 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().("failed to find %s", cidr)) |
| 645 | } |
| 646 | |
| 647 | // Check for the veth link in the main namespace |
| 648 | links, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkList().() |
| 649 | 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().()) |
| 650 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 651 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(5)) // Bridge, Bridge vlan veth, veth, and loopback |
| 652 | } else { |
| 653 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(3)) // Bridge, veth, and loopback |
| 654 | } |
| 655 | |
| 656 | link, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Name.) |
| 657 | 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().()) |
| 658 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 659 | tester.vethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#vethName. = result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Interface#Name. |
| 660 | |
| 661 | protInfo, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkGetProtinfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkGetProtinfo().(link) |
| 662 | 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().()) |
| 663 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(protInfo.Isolatedscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Protinfo#Isolated.).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().(tc.portIsolationscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#portIsolation.), "link isolation should be on when portIsolation is set") |
| 664 | |
| 665 | // check vlan exist on the veth interface |
| 666 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 667 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 668 | 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().()) |
| 669 | vlans, isExist := interfaceMap[int32(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 670 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 671 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 672 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 673 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | // check VlanTrunks exist on the veth interface |
| 678 | if tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. != nil { |
| 679 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 680 | 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().()) |
| 681 | vlans, isExist := interfaceMap[int32(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 682 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 683 | |
| 684 | for _, vlanEntry := range tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. { |
| 685 | if vlanEntry.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID. != nil { |
| 686 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(*vlanEntry.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 687 | } |
| 688 | if vlanEntry.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID. != nil && vlanEntry.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID. != nil { |
| 689 | for vid := *vlanEntry.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.; vid <= *vlanEntry.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.; vid++ { |
| 690 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(vid, vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 691 | } |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | // Check native vlan |
| 696 | nativeVlan := tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. |
| 697 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 698 | nativeVlan = 1 |
| 699 | } |
| 700 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(nativeVlan, vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 701 | } |
| 702 | |
| 703 | // Check that the bridge has a different mac from the veth |
| 704 | // If not, it means the bridge has an unstable mac and will change |
| 705 | // as ifs are added and removed |
| 706 | // this check is not relevant for a layer 2 bridge |
| 707 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 708 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(bridgeMAC)) |
| 709 | } |
| 710 | |
| 711 | // Check that resolvConf was used properly |
| 712 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.resolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#resolvConf. != "" { |
| 713 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.DNSscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#DNS..Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.).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().([]string{NAMESERVERscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NAMESERVER.})) |
| 714 | } |
| 715 | |
| 716 | return nil |
| 717 | }) |
| 718 | 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().()) |
| 719 | |
| 720 | // Find the veth peer in the container namespace and the default route |
| 721 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 722 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 723 | |
| 724 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 725 | 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().()) |
| 726 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 727 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 728 | assertContainerInterfaceLinkStatescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertContainerInterfaceLinkState().(&tc, link) |
| 729 | |
| 730 | expCIDRsV4, expCIDRsV6 := tc.expectedCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedCIDRs().() |
| 731 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4.) |
| 732 | 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().()) |
| 733 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV4))) |
| 734 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V6scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V6.) |
| 735 | 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().()) |
| 736 | assertIPv6Addressesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertIPv6Addresses().(&tc, addrs, expCIDRsV6) |
| 737 | |
| 738 | // Ignore link local address which may or may not be |
| 739 | // ready when we read addresses. |
| 740 | var foundAddrs int |
| 741 | for _, addr := range addrs { |
| 742 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 743 | foundAddrs++ |
| 744 | } |
| 745 | } |
| 746 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(foundAddrs).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().(len(expCIDRsV6))) |
| 747 | |
| 748 | // Ensure the default route(s) |
| 749 | routes, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.RouteListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/RouteList().(link, 0) |
| 750 | 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().()) |
| 751 | |
| 752 | var defaultRouteFound4, defaultRouteFound6 bool |
| 753 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 754 | gwIP, _, 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().(cidr) |
| 755 | 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().()) |
| 756 | var found *bool |
| 757 | if ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(gwIP) == "4" { |
| 758 | found = &defaultRouteFound4 |
| 759 | } else { |
| 760 | found = &defaultRouteFound6 |
| 761 | } |
| 762 | if *found == true { |
| 763 | continue |
| 764 | } |
| 765 | for _, route := range routes { |
| 766 | *found = (ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.IsIPNetZeroscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/IsIPNetZero().(route.Dstscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Dst.) && route.Srcscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Src. == nil && route.Gwscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Gw..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(gwIP)) |
| 767 | if *found { |
| 768 | break |
| 769 | } |
| 770 | } |
| 771 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 772 | } |
| 773 | |
| 774 | return nil |
| 775 | }) |
| 776 | 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().()) |
| 777 | |
| 778 | return result, nil |
| 779 | } |
| 780 | |
| 781 | func assertContainerInterfaceLinkStatescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertContainerInterfaceLinkState().(tc *testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, link netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Linkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#) { |
| 782 | linkState := int(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().OperStatescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#OperState.) |
| 783 | if tc.disableContIfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#disableContIface. { |
| 784 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(linkState).ToNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#ToNot().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.OperUpscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/OperUp.)) |
| 785 | } else { |
| 786 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(linkState).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().(netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.OperUpscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/OperUp.)) |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | func (tester *testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#) cmdCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#cmdCheckTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, conf *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#, _ string) { |
| 791 | // Generate network config and command arguments |
| 792 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCheckCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCheckCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., conf) |
| 793 | |
| 794 | // Execute cmdCHECK on the plugin |
| 795 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 796 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 797 | |
| 798 | err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdCheckWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdCheckWithArgs().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 799 | return cmdCheckscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdCheck().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 800 | }) |
| 801 | 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().()) |
| 802 | |
| 803 | return nil |
| 804 | }) |
| 805 | 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().()) |
| 806 | |
| 807 | // Find the veth peer in the container namespace and the default route |
| 808 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 809 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 810 | |
| 811 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 812 | 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().()) |
| 813 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 814 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 815 | |
| 816 | expCIDRsV4, expCIDRsV6 := tc.expectedCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedCIDRs().() |
| 817 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4.) |
| 818 | 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().()) |
| 819 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV4))) |
| 820 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V6scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V6.) |
| 821 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV6) + 1)) // add one for the link-local |
| 822 | 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().()) |
| 823 | // Ignore link local address which may or may not be |
| 824 | // ready when we read addresses. |
| 825 | var foundAddrs int |
| 826 | for _, addr := range addrs { |
| 827 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 828 | foundAddrs++ |
| 829 | } |
| 830 | } |
| 831 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(foundAddrs).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().(len(expCIDRsV6))) |
| 832 | |
| 833 | // Ensure the default route(s) |
| 834 | routes, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.RouteListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/RouteList().(link, 0) |
| 835 | 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().()) |
| 836 | |
| 837 | var defaultRouteFound4, defaultRouteFound6 bool |
| 838 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 839 | gwIP, _, 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().(cidr) |
| 840 | 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().()) |
| 841 | var found *bool |
| 842 | if ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(gwIP) == "4" { |
| 843 | found = &defaultRouteFound4 |
| 844 | } else { |
| 845 | found = &defaultRouteFound6 |
| 846 | } |
| 847 | if *found == true { |
| 848 | continue |
| 849 | } |
| 850 | for _, route := range routes { |
| 851 | *found = (ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.IsIPNetZeroscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/IsIPNetZero().(route.Dstscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Dst.) && route.Srcscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Src. == nil && route.Gwscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Gw..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(gwIP)) |
| 852 | if *found { |
| 853 | break |
| 854 | } |
| 855 | } |
| 856 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 857 | } |
| 858 | |
| 859 | return nil |
| 860 | }) |
| 861 | 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().()) |
| 862 | } |
| 863 | |
| 864 | func (tester *testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#) cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV10x#cmdDelTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) { |
| 865 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., dataDir) |
| 866 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 867 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 868 | |
| 869 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 870 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdDel().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 871 | }) |
| 872 | 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().()) |
| 873 | return nil |
| 874 | }) |
| 875 | 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().()) |
| 876 | |
| 877 | // Make sure the host veth has been deleted |
| 878 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 879 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 880 | |
| 881 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 882 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 883 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 884 | return nil |
| 885 | }) |
| 886 | 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().()) |
| 887 | |
| 888 | // Make sure the container veth has been deleted |
| 889 | err = tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 890 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 891 | |
| 892 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(tester.vethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#vethName.) |
| 893 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 894 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 895 | return nil |
| 896 | }) |
| 897 | 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().()) |
| 898 | } |
| 899 | |
| 900 | func (tester *testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x#) cmdAddTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x#cmdAddTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) (typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#, error) { |
| 901 | // Generate network config and command arguments |
| 902 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., dataDir) |
| 903 | |
| 904 | // Execute cmdADD on the plugin |
| 905 | var result *types040scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result# |
| 906 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 907 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 908 | |
| 909 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 910 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 911 | }) |
| 912 | 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().()) |
| 913 | 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), "\"interfaces\":")).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)) |
| 914 | |
| 915 | resultType, err := r.GetAsVersionscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#GetAsVersion().(tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.) |
| 916 | 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().()) |
| 917 | result = resultType.(*types040scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#) |
| 918 | |
| 919 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 920 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.).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().(4)) |
| 921 | } else { |
| 922 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.).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().(3)) |
| 923 | } |
| 924 | |
| 925 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 926 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(17)) |
| 927 | |
| 928 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HavePrefixscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HavePrefix().("veth")) |
| 929 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(17)) |
| 930 | |
| 931 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 932 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(17)) |
| 933 | if tc.expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac. != "" { |
| 934 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(tc.expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac.)) |
| 935 | } |
| 936 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Sandboxscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Sandbox.).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().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.())) |
| 937 | |
| 938 | // Make sure bridge link exists |
| 939 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.) |
| 940 | 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().()) |
| 941 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 942 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#{})) |
| 943 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).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().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.)) |
| 944 | bridgeMAC := link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().() |
| 945 | |
| 946 | var vlanLink netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Linkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link# |
| 947 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 948 | // Make sure vlan link exists |
| 949 | vlanLink, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.)) |
| 950 | 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().()) |
| 951 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.))) |
| 952 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 953 | |
| 954 | // Check the bridge dot vlan interface have the vlan tag |
| 955 | peerLink, err := netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.LinkByIndexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkByIndex().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index. - 1) |
| 956 | 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().()) |
| 957 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 958 | 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().()) |
| 959 | vlans, isExist := interfaceMap[int32(peerLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 960 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 961 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 962 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 963 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | // Check the bridge vlan filtering equals true |
| 968 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 || tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. != nil { |
| 969 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 970 | } else { |
| 971 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 972 | } |
| 973 | |
| 974 | // Ensure bridge has expected gateway address(es) |
| 975 | var addrs []netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Addrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr# |
| 976 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 977 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 978 | } else { |
| 979 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(vlanLink, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 980 | } |
| 981 | 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().()) |
| 982 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).ToNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#ToNot().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 983 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 984 | ip, subnet, 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().(cidr) |
| 985 | 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().()) |
| 986 | |
| 987 | found := false |
| 988 | subnetPrefix, subnetBits := subnet.Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 989 | for _, a := range addrs { |
| 990 | aPrefix, aBits := a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 991 | if a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(ip) && aPrefix == subnetPrefix && aBits == subnetBits { |
| 992 | found = true |
| 993 | break |
| 994 | } |
| 995 | } |
| 996 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 997 | } |
| 998 | |
| 999 | // Check for the veth link in the main namespace |
| 1000 | links, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkList().() |
| 1001 | 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().()) |
| 1002 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1003 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(5)) // Bridge, Bridge vlan veth, veth, and loopback |
| 1004 | } else { |
| 1005 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(3)) // Bridge, veth, and loopback |
| 1006 | } |
| 1007 | |
| 1008 | link, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.) |
| 1009 | 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().()) |
| 1010 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1011 | tester.vethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#vethName. = result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name. |
| 1012 | |
| 1013 | // check vlan exist on the veth interface |
| 1014 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1015 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 1016 | 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().()) |
| 1017 | vlans, isExist := interfaceMap[int32(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 1018 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1019 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1020 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 1021 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 1022 | } |
| 1023 | } |
| 1024 | |
| 1025 | // check VlanTrunks exist on the veth interface |
| 1026 | if tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. != nil { |
| 1027 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 1028 | 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().()) |
| 1029 | vlans, isExist := interfaceMap[int32(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 1030 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1031 | |
| 1032 | for _, vlanEntry := range tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. { |
| 1033 | if vlanEntry.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID. != nil { |
| 1034 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(*vlanEntry.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1035 | } |
| 1036 | if vlanEntry.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID. != nil && vlanEntry.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID. != nil { |
| 1037 | for vid := *vlanEntry.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.; vid <= *vlanEntry.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.; vid++ { |
| 1038 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(vid, vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1039 | } |
| 1040 | } |
| 1041 | } |
| 1042 | |
| 1043 | // Check native vlan |
| 1044 | nativeVlan := tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. |
| 1045 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 1046 | nativeVlan = 1 |
| 1047 | } |
| 1048 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(nativeVlan, vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1049 | } |
| 1050 | |
| 1051 | // Check that the bridge has a different mac from the veth |
| 1052 | // If not, it means the bridge has an unstable mac and will change |
| 1053 | // as ifs are added and removed |
| 1054 | // this check is not relevant for a layer 2 bridge |
| 1055 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 1056 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(bridgeMAC)) |
| 1057 | } |
| 1058 | |
| 1059 | return nil |
| 1060 | }) |
| 1061 | 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().()) |
| 1062 | |
| 1063 | // Find the veth peer in the container namespace and the default route |
| 1064 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1065 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1066 | |
| 1067 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1068 | 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().()) |
| 1069 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 1070 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1071 | |
| 1072 | expCIDRsV4, expCIDRsV6 := tc.expectedCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedCIDRs().() |
| 1073 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4.) |
| 1074 | 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().()) |
| 1075 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV4))) |
| 1076 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V6scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V6.) |
| 1077 | 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().()) |
| 1078 | assertIPv6Addressesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertIPv6Addresses().(&tc, addrs, expCIDRsV6) |
| 1079 | |
| 1080 | // Ignore link local address which may or may not be |
| 1081 | // ready when we read addresses. |
| 1082 | var foundAddrs int |
| 1083 | for _, addr := range addrs { |
| 1084 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 1085 | foundAddrs++ |
| 1086 | } |
| 1087 | } |
| 1088 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(foundAddrs).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().(len(expCIDRsV6))) |
| 1089 | |
| 1090 | // Ensure the default route(s) |
| 1091 | routes, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.RouteListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/RouteList().(link, 0) |
| 1092 | 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().()) |
| 1093 | |
| 1094 | var defaultRouteFound4, defaultRouteFound6 bool |
| 1095 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 1096 | gwIP, _, 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().(cidr) |
| 1097 | 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().()) |
| 1098 | var found *bool |
| 1099 | if ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(gwIP) == "4" { |
| 1100 | found = &defaultRouteFound4 |
| 1101 | } else { |
| 1102 | found = &defaultRouteFound6 |
| 1103 | } |
| 1104 | if *found == true { |
| 1105 | continue |
| 1106 | } |
| 1107 | for _, route := range routes { |
| 1108 | *found = (ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.IsIPNetZeroscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/IsIPNetZero().(route.Dstscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Dst.) && route.Srcscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Src. == nil && route.Gwscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Gw..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(gwIP)) |
| 1109 | if *found { |
| 1110 | break |
| 1111 | } |
| 1112 | } |
| 1113 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1114 | } |
| 1115 | |
| 1116 | return nil |
| 1117 | }) |
| 1118 | 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().()) |
| 1119 | |
| 1120 | return result, nil |
| 1121 | } |
| 1122 | |
| 1123 | func assertIPv6Addressesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertIPv6Addresses().(tc *testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, addrs []netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Addrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#, expCIDRsV6 []*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#) { |
| 1124 | if tc.disableContIfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#disableContIface. { |
| 1125 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 1126 | } else { |
| 1127 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV6) + 1)) // add one for the link-local |
| 1128 | } |
| 1129 | } |
| 1130 | |
| 1131 | func (tester *testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x#) cmdCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x#cmdCheckTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, conf *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#, _ string) { |
| 1132 | // Generate network config and command arguments |
| 1133 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCheckCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCheckCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., conf) |
| 1134 | |
| 1135 | // Execute cmdCHECK on the plugin |
| 1136 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1137 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1138 | |
| 1139 | err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdCheckWithArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdCheckWithArgs().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 1140 | return cmdCheckscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdCheck().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 1141 | }) |
| 1142 | 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().()) |
| 1143 | |
| 1144 | return nil |
| 1145 | }) |
| 1146 | 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().()) |
| 1147 | |
| 1148 | // Find the veth peer in the container namespace and the default route |
| 1149 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1150 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1151 | |
| 1152 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1153 | 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().()) |
| 1154 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 1155 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1156 | |
| 1157 | expCIDRsV4, expCIDRsV6 := tc.expectedCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedCIDRs().() |
| 1158 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4.) |
| 1159 | 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().()) |
| 1160 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV4))) |
| 1161 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V6scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V6.) |
| 1162 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV6) + 1)) // add one for the link-local |
| 1163 | 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().()) |
| 1164 | // Ignore link local address which may or may not be |
| 1165 | // ready when we read addresses. |
| 1166 | var foundAddrs int |
| 1167 | for _, addr := range addrs { |
| 1168 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 1169 | foundAddrs++ |
| 1170 | } |
| 1171 | } |
| 1172 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(foundAddrs).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().(len(expCIDRsV6))) |
| 1173 | |
| 1174 | // Ensure the default route(s) |
| 1175 | routes, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.RouteListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/RouteList().(link, 0) |
| 1176 | 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().()) |
| 1177 | |
| 1178 | var defaultRouteFound4, defaultRouteFound6 bool |
| 1179 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 1180 | gwIP, _, 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().(cidr) |
| 1181 | 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().()) |
| 1182 | var found *bool |
| 1183 | if ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(gwIP) == "4" { |
| 1184 | found = &defaultRouteFound4 |
| 1185 | } else { |
| 1186 | found = &defaultRouteFound6 |
| 1187 | } |
| 1188 | if *found == true { |
| 1189 | continue |
| 1190 | } |
| 1191 | for _, route := range routes { |
| 1192 | *found = (ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.IsIPNetZeroscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/IsIPNetZero().(route.Dstscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Dst.) && route.Srcscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Src. == nil && route.Gwscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Gw..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(gwIP)) |
| 1193 | if *found { |
| 1194 | break |
| 1195 | } |
| 1196 | } |
| 1197 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1198 | } |
| 1199 | |
| 1200 | return nil |
| 1201 | }) |
| 1202 | 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().()) |
| 1203 | } |
| 1204 | |
| 1205 | func (tester *testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x#) cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV04x#cmdDelTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) { |
| 1206 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., dataDir) |
| 1207 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1208 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1209 | |
| 1210 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 1211 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdDel().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 1212 | }) |
| 1213 | 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().()) |
| 1214 | return nil |
| 1215 | }) |
| 1216 | 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().()) |
| 1217 | |
| 1218 | // Make sure the host veth has been deleted |
| 1219 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1220 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1221 | |
| 1222 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1223 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 1224 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 1225 | return nil |
| 1226 | }) |
| 1227 | 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().()) |
| 1228 | |
| 1229 | // Make sure the container veth has been deleted |
| 1230 | err = tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1231 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1232 | |
| 1233 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(tester.vethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#vethName.) |
| 1234 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 1235 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 1236 | return nil |
| 1237 | }) |
| 1238 | 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().()) |
| 1239 | } |
| 1240 | |
| 1241 | func (tester *testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#) cmdAddTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#cmdAddTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) (typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#, error) { |
| 1242 | // Generate network config and command arguments |
| 1243 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., dataDir) |
| 1244 | |
| 1245 | // Execute cmdADD on the plugin |
| 1246 | var result *types040scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result# |
| 1247 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1248 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1249 | |
| 1250 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 1251 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 1252 | }) |
| 1253 | 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().()) |
| 1254 | 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), "\"interfaces\":")).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)) |
| 1255 | |
| 1256 | resultType, err := r.GetAsVersionscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#GetAsVersion().(tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.) |
| 1257 | 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().()) |
| 1258 | result = resultType.(*types040scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#) |
| 1259 | |
| 1260 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1261 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.).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().(4)) |
| 1262 | } else { |
| 1263 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.).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().(3)) |
| 1264 | } |
| 1265 | |
| 1266 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1267 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(17)) |
| 1268 | |
| 1269 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HavePrefixscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HavePrefix().("veth")) |
| 1270 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(17)) |
| 1271 | |
| 1272 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 1273 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(17)) |
| 1274 | if tc.expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac. != "" { |
| 1275 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.).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().(tc.expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac.)) |
| 1276 | } |
| 1277 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[2].Sandboxscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Sandbox.).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().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.())) |
| 1278 | |
| 1279 | // Make sure bridge link exists |
| 1280 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.) |
| 1281 | 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().()) |
| 1282 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1283 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#{})) |
| 1284 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).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().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[0].Macscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Mac.)) |
| 1285 | bridgeMAC := link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().() |
| 1286 | |
| 1287 | var vlanLink netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Linkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link# |
| 1288 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1289 | // Make sure vlan link exists |
| 1290 | vlanLink, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.)) |
| 1291 | 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().()) |
| 1292 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.))) |
| 1293 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1294 | |
| 1295 | // Check the bridge dot vlan interface have the vlan tag |
| 1296 | peerLink, err := netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.LinkByIndexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkByIndex().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index. - 1) |
| 1297 | 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().()) |
| 1298 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 1299 | 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().()) |
| 1300 | vlans, isExist := interfaceMap[int32(peerLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 1301 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1302 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1303 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 1304 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 1305 | } |
| 1306 | } |
| 1307 | |
| 1308 | // Check the bridge vlan filtering equals true |
| 1309 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 || tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. != nil { |
| 1310 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1311 | } else { |
| 1312 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 1313 | } |
| 1314 | |
| 1315 | // Ensure bridge has expected gateway address(es) |
| 1316 | var addrs []netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Addrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr# |
| 1317 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 1318 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 1319 | } else { |
| 1320 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(vlanLink, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 1321 | } |
| 1322 | 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().()) |
| 1323 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).ToNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#ToNot().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 1324 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 1325 | ip, subnet, 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().(cidr) |
| 1326 | 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().()) |
| 1327 | |
| 1328 | found := false |
| 1329 | subnetPrefix, subnetBits := subnet.Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 1330 | for _, a := range addrs { |
| 1331 | aPrefix, aBits := a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 1332 | if a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(ip) && aPrefix == subnetPrefix && aBits == subnetBits { |
| 1333 | found = true |
| 1334 | break |
| 1335 | } |
| 1336 | } |
| 1337 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1338 | } |
| 1339 | |
| 1340 | // Check for the veth link in the main namespace |
| 1341 | links, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkList().() |
| 1342 | 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().()) |
| 1343 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1344 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(5)) // Bridge, Bridge vlan veth, veth, and loopback |
| 1345 | } else { |
| 1346 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(3)) // Bridge, veth, and loopback |
| 1347 | } |
| 1348 | |
| 1349 | link, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name.) |
| 1350 | 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().()) |
| 1351 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1352 | tester.vethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#vethName. = result.Interfacesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#Interfaces.[1].Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Interface#Name. |
| 1353 | |
| 1354 | // check vlan exist on the veth interface |
| 1355 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1356 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 1357 | 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().()) |
| 1358 | vlans, isExist := interfaceMap[int32(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 1359 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1360 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1361 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 1362 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 1363 | } |
| 1364 | } |
| 1365 | |
| 1366 | // check VlanTrunks exist on the veth interface |
| 1367 | if tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. != nil { |
| 1368 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 1369 | 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().()) |
| 1370 | vlans, isExist := interfaceMap[int32(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 1371 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1372 | |
| 1373 | for _, vlanEntry := range tc.vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk. { |
| 1374 | if vlanEntry.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID. != nil { |
| 1375 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(*vlanEntry.IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1376 | } |
| 1377 | if vlanEntry.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID. != nil && vlanEntry.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID. != nil { |
| 1378 | for vid := *vlanEntry.MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.; vid <= *vlanEntry.MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.; vid++ { |
| 1379 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(vid, vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1380 | } |
| 1381 | } |
| 1382 | } |
| 1383 | |
| 1384 | // Check native vlan |
| 1385 | nativeVlan := tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. |
| 1386 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 1387 | nativeVlan = 1 |
| 1388 | } |
| 1389 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(nativeVlan, vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1390 | } |
| 1391 | |
| 1392 | // Check that the bridge has a different mac from the veth |
| 1393 | // If not, it means the bridge has an unstable mac and will change |
| 1394 | // as ifs are added and removed |
| 1395 | // this check is not relevant for a layer 2 bridge |
| 1396 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 1397 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/HardwareAddr#String().()).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(bridgeMAC)) |
| 1398 | } |
| 1399 | |
| 1400 | return nil |
| 1401 | }) |
| 1402 | 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().()) |
| 1403 | |
| 1404 | // Find the veth peer in the container namespace and the default route |
| 1405 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1406 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1407 | |
| 1408 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1409 | 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().()) |
| 1410 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 1411 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1412 | |
| 1413 | expCIDRsV4, expCIDRsV6 := tc.expectedCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedCIDRs().() |
| 1414 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4.) |
| 1415 | 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().()) |
| 1416 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV4))) |
| 1417 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V6scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V6.) |
| 1418 | 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().()) |
| 1419 | // Ignore link local address which may or may not be |
| 1420 | // ready when we read addresses. |
| 1421 | var foundAddrs int |
| 1422 | for _, addr := range addrs { |
| 1423 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 1424 | foundAddrs++ |
| 1425 | } |
| 1426 | } |
| 1427 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(foundAddrs).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().(len(expCIDRsV6))) |
| 1428 | |
| 1429 | // Ensure the default route(s) |
| 1430 | routes, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.RouteListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/RouteList().(link, 0) |
| 1431 | 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().()) |
| 1432 | |
| 1433 | var defaultRouteFound4, defaultRouteFound6 bool |
| 1434 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 1435 | gwIP, _, 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().(cidr) |
| 1436 | 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().()) |
| 1437 | var found *bool |
| 1438 | if ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(gwIP) == "4" { |
| 1439 | found = &defaultRouteFound4 |
| 1440 | } else { |
| 1441 | found = &defaultRouteFound6 |
| 1442 | } |
| 1443 | if *found == true { |
| 1444 | continue |
| 1445 | } |
| 1446 | for _, route := range routes { |
| 1447 | *found = (ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.IsIPNetZeroscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/IsIPNetZero().(route.Dstscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Dst.) && route.Srcscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Src. == nil && route.Gwscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Gw..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(gwIP)) |
| 1448 | if *found { |
| 1449 | break |
| 1450 | } |
| 1451 | } |
| 1452 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1453 | } |
| 1454 | |
| 1455 | return nil |
| 1456 | }) |
| 1457 | 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().()) |
| 1458 | return result, nil |
| 1459 | } |
| 1460 | |
| 1461 | func (tester *testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#) cmdCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#cmdCheckTest().(_ testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, _ *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#, _ string) { |
| 1462 | } |
| 1463 | |
| 1464 | func (tester *testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#) cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#cmdDelTest().(_ testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, _ string) { |
| 1465 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1466 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1467 | |
| 1468 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 1469 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdDel().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 1470 | }) |
| 1471 | 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().()) |
| 1472 | return nil |
| 1473 | }) |
| 1474 | 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().()) |
| 1475 | |
| 1476 | // Make sure the host veth has been deleted |
| 1477 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1478 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1479 | |
| 1480 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1481 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 1482 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 1483 | return nil |
| 1484 | }) |
| 1485 | 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().()) |
| 1486 | |
| 1487 | // Make sure the container veth has been deleted |
| 1488 | err = tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1489 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1490 | |
| 1491 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(tester.vethNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#vethName.) |
| 1492 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 1493 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 1494 | return nil |
| 1495 | }) |
| 1496 | 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().()) |
| 1497 | } |
| 1498 | |
| 1499 | func expect020AddErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect020AddError().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) bool { |
| 1500 | return tc.AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020. != "" && tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. == "0.2.0" |
| 1501 | } |
| 1502 | |
| 1503 | func expect020DelErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect020DelError().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) bool { |
| 1504 | return tc.DelErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr020. != "" && tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. == "0.2.0" |
| 1505 | } |
| 1506 | |
| 1507 | func expect010AddErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect010AddError().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) bool { |
| 1508 | return tc.AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010. != "" && tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. == "0.1.0" |
| 1509 | } |
| 1510 | |
| 1511 | func expect010DelErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect010DelError().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#) bool { |
| 1512 | return tc.DelErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr010. != "" && tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. == "0.1.0" |
| 1513 | } |
| 1514 | |
| 1515 | func (tester *testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x#) cmdAddTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x#cmdAddTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) (typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#, error) { |
| 1516 | // Generate network config and command arguments |
| 1517 | tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args. = tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS., dataDir) |
| 1518 | |
| 1519 | var hostNSVlanMap map[int32][]*nlscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink/nl`/.BridgeVlanInfoscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink/nl`/BridgeVlanInfo# |
| 1520 | |
| 1521 | // Execute cmdADD on the plugin |
| 1522 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1523 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1524 | |
| 1525 | // check that STATUS is |
| 1526 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasSTATUSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasSTATUS().(tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.) { |
| 1527 | err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.CmdStatusscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/CmdStatus().(func() error { |
| 1528 | return cmdStatusscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdStatus().(&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#{StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(tc.netConfJSONscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConfJSON().(dataDir))}) |
| 1529 | }) |
| 1530 | 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().()) |
| 1531 | } |
| 1532 | |
| 1533 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 1534 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 1535 | }) |
| 1536 | |
| 1537 | if expect020AddErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect020AddError().(tc) || expect010AddErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect010AddError().(tc) { |
| 1538 | return err |
| 1539 | } |
| 1540 | 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().()) |
| 1541 | 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), "\"ip\":")).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)) |
| 1542 | |
| 1543 | // We expect a version 0.1.0 or 0.2.0 result |
| 1544 | _, err = r.GetAsVersionscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#GetAsVersion().(tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.) |
| 1545 | 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().()) |
| 1546 | |
| 1547 | // Make sure bridge link exists |
| 1548 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 1549 | 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().()) |
| 1550 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1551 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#{})) |
| 1552 | |
| 1553 | var vlanLink netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Linkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link# |
| 1554 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1555 | // Make sure vlan link exists |
| 1556 | vlanLink, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.)) |
| 1557 | 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().()) |
| 1558 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(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.%d", BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME., tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.))) |
| 1559 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlanLink).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1560 | |
| 1561 | // Check the bridge dot vlan interface have the vlan tag |
| 1562 | peerLink, err := netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.LinkByIndexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkByIndex().(vlanLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index. - 1) |
| 1563 | 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().()) |
| 1564 | interfaceMap, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 1565 | 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().()) |
| 1566 | vlans, isExist := interfaceMap[int32(peerLink.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.)] |
| 1567 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1568 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1569 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 1570 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 1571 | } |
| 1572 | } |
| 1573 | |
| 1574 | // Check the bridge vlan filtering equals true |
| 1575 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1576 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1577 | } else { |
| 1578 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*link.(*netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#).VlanFilteringscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#VlanFiltering.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 1579 | } |
| 1580 | |
| 1581 | // Ensure bridge has expected gateway address(es) |
| 1582 | var addrs []netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Addrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr# |
| 1583 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. == 0 { |
| 1584 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 1585 | } else { |
| 1586 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(vlanLink, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_ALLscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_ALL.) |
| 1587 | } |
| 1588 | 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().()) |
| 1589 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).ToNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#ToNot().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 1590 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 1591 | ip, subnet, 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().(cidr) |
| 1592 | 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().()) |
| 1593 | |
| 1594 | found := false |
| 1595 | subnetPrefix, subnetBits := subnet.Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 1596 | for _, a := range addrs { |
| 1597 | aPrefix, aBits := a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask..Sizescip-go gomod github.com/golang/go/src go1.24.2 net/IPMask#Size().() |
| 1598 | if a.IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(ip) && aPrefix == subnetPrefix && aBits == subnetBits { |
| 1599 | found = true |
| 1600 | break |
| 1601 | } |
| 1602 | } |
| 1603 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1604 | } |
| 1605 | |
| 1606 | // Check for the veth link in the main namespace; can't |
| 1607 | // check the for the specific link since version 0.1.0 |
| 1608 | // doesn't report interfaces |
| 1609 | links, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkList().() |
| 1610 | 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().()) |
| 1611 | if !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. && tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1612 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(5)) // Bridge, Bridge vlan veth, veth, and loopback |
| 1613 | } else { |
| 1614 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(links).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().(3)) // Bridge, veth, and loopback |
| 1615 | } |
| 1616 | |
| 1617 | // Grab the vlan map in the host NS for checking later |
| 1618 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1619 | hostNSVlanMap, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.BridgeVlanListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/BridgeVlanList().() |
| 1620 | 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().()) |
| 1621 | } |
| 1622 | return nil |
| 1623 | }) |
| 1624 | if expect020AddErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect020AddError().(tc) { |
| 1625 | 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().(tc.AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.)) |
| 1626 | return nil, nil |
| 1627 | } else if expect010AddErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect010AddError().(tc) { |
| 1628 | 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().(tc.AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.)) |
| 1629 | return nil, nil |
| 1630 | } |
| 1631 | 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().()) |
| 1632 | |
| 1633 | // Find the veth peer in the container namespace and the default route |
| 1634 | err = tester.targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1635 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1636 | |
| 1637 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1638 | 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().()) |
| 1639 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.)) |
| 1640 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeAssignableToTypeOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeAssignableToTypeOf().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Vethscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Veth#{})) |
| 1641 | |
| 1642 | expCIDRsV4, expCIDRsV6 := tc.expectedCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedCIDRs().() |
| 1643 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4.) |
| 1644 | 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().()) |
| 1645 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(len(expCIDRsV4))) |
| 1646 | addrs, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(link, netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V6scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V6.) |
| 1647 | 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().()) |
| 1648 | // Ignore link local address which may or may not be |
| 1649 | // ready when we read addresses. |
| 1650 | var foundAddrs int |
| 1651 | for _, addr := range addrs { |
| 1652 | if !addr.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..IsLinkLocalUnicastscip-go gomod github.com/golang/go/src go1.24.2 net/IP#IsLinkLocalUnicast().() { |
| 1653 | foundAddrs++ |
| 1654 | } |
| 1655 | } |
| 1656 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(foundAddrs).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().(len(expCIDRsV6))) |
| 1657 | |
| 1658 | // Ensure the default route(s) |
| 1659 | routes, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.RouteListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/RouteList().(link, 0) |
| 1660 | 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().()) |
| 1661 | |
| 1662 | var defaultRouteFound4, defaultRouteFound6 bool |
| 1663 | for _, cidr := range tc.expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs. { |
| 1664 | gwIP, _, 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().(cidr) |
| 1665 | 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().()) |
| 1666 | var found *bool |
| 1667 | if ipVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ipVersion().(gwIP) == "4" { |
| 1668 | found = &defaultRouteFound4 |
| 1669 | } else { |
| 1670 | found = &defaultRouteFound6 |
| 1671 | } |
| 1672 | if *found == true { |
| 1673 | continue |
| 1674 | } |
| 1675 | for _, route := range routes { |
| 1676 | *found = (ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.IsIPNetZeroscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/IsIPNetZero().(route.Dstscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Dst.) && route.Srcscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Src. == nil && route.Gwscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Gw..Equalscip-go gomod github.com/golang/go/src go1.24.2 net/IP#Equal().(gwIP)) |
| 1677 | if *found { |
| 1678 | break |
| 1679 | } |
| 1680 | } |
| 1681 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(*found).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1682 | } |
| 1683 | |
| 1684 | // Validate VLAN in the host NS. Since 0.1.0/0.2.0 don't return |
| 1685 | // any host interface information, we have to look up the container |
| 1686 | // namespace veth's peer index instead |
| 1687 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 { |
| 1688 | _, peerIndex, err := ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/.GetVethPeerIfindexscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ip`/GetVethPeerIfindex().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1689 | 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().()) |
| 1690 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(peerIndex).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNumericallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNumerically().(">", 0)) |
| 1691 | vlans, isExist := hostNSVlanMap[int32(peerIndex)] |
| 1692 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(isExist).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1693 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(checkVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/checkVlan().(tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan., vlans)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeTruescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeTrue().()) |
| 1694 | if tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. { |
| 1695 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(vlans).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)) |
| 1696 | } |
| 1697 | } |
| 1698 | |
| 1699 | return nil |
| 1700 | }) |
| 1701 | 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().()) |
| 1702 | return nil, nil |
| 1703 | } |
| 1704 | |
| 1705 | func (tester *testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x#) cmdCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x#cmdCheckTest().(_ testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, _ *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#, _ string) { |
| 1706 | } |
| 1707 | |
| 1708 | func (tester *testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x#) cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV01xOr02x#cmdDelTest().(tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, _ string) { |
| 1709 | err := tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1710 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1711 | |
| 1712 | 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().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args., func() error { |
| 1713 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdDel().(tester.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.) |
| 1714 | }) |
| 1715 | switch { |
| 1716 | case expect020DelErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect020DelError().(tc): |
| 1717 | 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().(tc.DelErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr020.)) |
| 1718 | case expect010DelErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/expect010DelError().(tc): |
| 1719 | 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().(tc.DelErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr010.)) |
| 1720 | default: |
| 1721 | 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().()) |
| 1722 | } |
| 1723 | return nil |
| 1724 | }) |
| 1725 | 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().()) |
| 1726 | |
| 1727 | // Make sure the container veth has been deleted; cannot check |
| 1728 | // host veth as version 0.1.0 can't report its name |
| 1729 | err = tester.testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1730 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1731 | |
| 1732 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/IFNAME.) |
| 1733 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 1734 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 1735 | return nil |
| 1736 | }) |
| 1737 | 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().()) |
| 1738 | } |
| 1739 | |
| 1740 | func cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(origNS, targetNS nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#, tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) { |
| 1741 | tester := newTesterByVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/newTesterByVersion().(tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion., origNS, targetNS) |
| 1742 | |
| 1743 | // Test IP allocation |
| 1744 | _, err := tester.cmdAddTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdAddTest.(tc, dataDir) |
| 1745 | 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().()) |
| 1746 | |
| 1747 | // Test IP Release |
| 1748 | tester.cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdDelTest.(tc, dataDir) |
| 1749 | |
| 1750 | // Clean up bridge addresses for next test case |
| 1751 | delBridgeAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/delBridgeAddrs().(origNS) |
| 1752 | } |
| 1753 | |
| 1754 | func buildOneConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/buildOneConfig().(name, cniVersion string, orig *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#, prevResult typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.Resultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/Result#) (*Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#, error) { |
| 1755 | var err error |
| 1756 | |
| 1757 | inject := map[string]interface{}{ |
| 1758 | "name": name, |
| 1759 | "cniVersion": cniVersion, |
| 1760 | } |
| 1761 | // Add previous plugin result |
| 1762 | if prevResult != nil { |
| 1763 | inject["prevResult"] = prevResult |
| 1764 | } |
| 1765 | |
| 1766 | // Ensure every config uses the same name and version |
| 1767 | config := make(map[string]interface{}) |
| 1768 | confBytes, err := jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/Marshal().(orig) |
| 1769 | if err != nil { |
| 1770 | return nil, err |
| 1771 | } |
| 1772 | |
| 1773 | err = jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/Unmarshal().(confBytes, &config) |
| 1774 | if err != nil { |
| 1775 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("unmarshal existing network bytes: %s", err) |
| 1776 | } |
| 1777 | |
| 1778 | for key, value := range inject { |
| 1779 | config[key] = value |
| 1780 | } |
| 1781 | |
| 1782 | newBytes, err := jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/Marshal().(config) |
| 1783 | if err != nil { |
| 1784 | return nil, err |
| 1785 | } |
| 1786 | |
| 1787 | conf := &Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#{} |
| 1788 | if err := jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/Unmarshal().(newBytes, &conf); err != nil { |
| 1789 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("error parsing configuration: %s", err) |
| 1790 | } |
| 1791 | |
| 1792 | return conf, nil |
| 1793 | } |
| 1794 | |
| 1795 | func cmdAddDelCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelCheckTest().(origNS, targetNS nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#, tc testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#, dataDir string) { |
| 1796 | tester := newTesterByVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/newTesterByVersion().(tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion., origNS, targetNS) |
| 1797 | |
| 1798 | // Test IP allocation |
| 1799 | prevResult, err := tester.cmdAddTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdAddTest.(tc, dataDir) |
| 1800 | 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().()) |
| 1801 | |
| 1802 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(prevResult).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(BeNilscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeNil().()) |
| 1803 | |
| 1804 | confString := tc.netConfJSONscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConfJSON().(dataDir) |
| 1805 | |
| 1806 | conf := &Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#{} |
| 1807 | err = jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/Unmarshal().([]byte(confString), &conf) |
| 1808 | 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().()) |
| 1809 | |
| 1810 | conf.IPAMscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/Net#IPAM., _, err = allocatorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/.LoadIPAMConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator`/LoadIPAMConfig().([]byte(confString), "") |
| 1811 | 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().()) |
| 1812 | |
| 1813 | newConf, err := buildOneConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/buildOneConfig().("testConfig", tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion., conf, prevResult) |
| 1814 | 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().()) |
| 1815 | |
| 1816 | // Test CHECK |
| 1817 | tester.cmdCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdCheckTest.(tc, newConf, dataDir) |
| 1818 | |
| 1819 | // Test IP Release |
| 1820 | tester.cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTester#cmdDelTest.(tc, dataDir) |
| 1821 | |
| 1822 | // Clean up bridge addresses for next test case |
| 1823 | delBridgeAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/delBridgeAddrs().(origNS) |
| 1824 | |
| 1825 | if tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan. != 0 && !tc.isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2. { |
| 1826 | delVlanAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/delVlanAddrs().(origNS, tc.vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.) |
| 1827 | } |
| 1828 | } |
| 1829 | |
| 1830 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("bridge Operations", func() { |
| 1831 | var originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS. nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS# |
| 1832 | var dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir. string |
| 1833 | |
| 1834 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 1835 | // Create a new NetNS so we don't modify the host |
| 1836 | var errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:err. error |
| 1837 | originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:err. = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.NewNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/NewNS().() |
| 1838 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_: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().()) |
| 1839 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:err. = testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.NewNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/NewNS().() |
| 1840 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_: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().()) |
| 1841 | |
| 1842 | dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:err. = osscip-go gomod github.com/golang/go/src go1.24.2 os/.MkdirTempscip-go gomod github.com/golang/go/src go1.24.2 os/MkdirTemp().("", "bridge_test") |
| 1843 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_: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().()) |
| 1844 | |
| 1845 | // Do not emulate an error, each test will set this if needed |
| 1846 | debugPostIPAMErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/debugPostIPAMError. = nil |
| 1847 | }) |
| 1848 | |
| 1849 | AfterEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/AfterEach().(func() { |
| 1850 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(osscip-go gomod github.com/golang/go/src go1.24.2 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.24.2 os/RemoveAll().(dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 1851 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Closescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Close.()).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 1852 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.UnmountNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/UnmountNS().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS.)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 1853 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS..Closescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Close.()).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 1854 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.UnmountNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/UnmountNS().(targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS.)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 1855 | }) |
| 1856 | |
| 1857 | var ( |
| 1858 | correctIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctID. = 10 |
| 1859 | correctMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMinID. = 100 |
| 1860 | correctMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMaxID. = 105 |
| 1861 | incorrectMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:incorrectMinID. = 1000 |
| 1862 | incorrectMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:incorrectMaxID. = 100 |
| 1863 | overIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:overID. = 5000 |
| 1864 | negativeIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:negativeID. = -1 |
| 1865 | ) |
| 1866 | |
| 1867 | DescribeTablescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/DescribeTable().( |
| 1868 | "collectVlanTrunk succeeds", |
| 1869 | func(vlanTrunksscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:vlanTrunks. []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#, expectedVIDsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedVIDs. []int) { |
| 1870 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(collectVlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/collectVlanTrunk().(vlanTrunksscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:vlanTrunks.)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(ConsistOfscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/ConsistOf().(expectedVIDsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedVIDs.)) |
| 1871 | }, |
| 1872 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when provided an empty VLAN trunk configuration", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{}, nil), |
| 1873 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when provided a VLAN trunk configuration with both min / max range", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{ |
| 1874 | { |
| 1875 | MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &correctMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMinID., |
| 1876 | MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &correctMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMaxID., |
| 1877 | }, |
| 1878 | }, []int{100, 101, 102, 103, 104, 105}), |
| 1879 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when provided a VLAN trunk configuration with id only", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{ |
| 1880 | { |
| 1881 | IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID.: &correctIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctID., |
| 1882 | }, |
| 1883 | }, []int{10}), |
| 1884 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when provided a VLAN trunk configuration with id and range", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{ |
| 1885 | { |
| 1886 | IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID.: &correctIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctID., |
| 1887 | }, |
| 1888 | { |
| 1889 | MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &correctMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMinID., |
| 1890 | MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &correctMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMaxID., |
| 1891 | }, |
| 1892 | }, []int{10, 100, 101, 102, 103, 104, 105}), |
| 1893 | ) |
| 1894 | |
| 1895 | DescribeTablescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/DescribeTable().( |
| 1896 | "collectVlanTrunk failed", |
| 1897 | func(vlanTrunksscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:vlanTrunks. []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#, expectedErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedError. error) { |
| 1898 | _, err := collectVlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/collectVlanTrunk().(vlanTrunksscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:vlanTrunks.) |
| 1899 | 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().(expectedErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedError.)) |
| 1900 | }, |
| 1901 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when not passed the maxID", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &correctMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMinID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("minID and maxID should be configured simultaneously, maxID is missing")), |
| 1902 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when not passed the minID", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &correctMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMaxID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("minID and maxID should be configured simultaneously, minID is missing")), |
| 1903 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when the minID is negative", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &negativeIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:negativeID., MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &correctMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMaxID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("incorrect trunk minID parameter")), |
| 1904 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when the minID is larger than 4094", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &overIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:overID., MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &correctMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMaxID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("incorrect trunk minID parameter")), |
| 1905 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when the maxID is larger than 4094", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &correctMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMinID., MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &overIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:overID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("incorrect trunk maxID parameter")), |
| 1906 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when the maxID is negative", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &correctMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:correctMinID., MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &overIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:overID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("incorrect trunk maxID parameter")), |
| 1907 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when the ID is larger than 4094", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID.: &overIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:overID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("incorrect trunk id parameter")), |
| 1908 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when the ID is negative", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID.: &negativeIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:negativeID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("incorrect trunk id parameter")), |
| 1909 | Entryscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Entry().("when the maxID is smaller than minID", []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{{MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &incorrectMinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:incorrectMinID., MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &incorrectMaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:incorrectMaxID.}}, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("minID is greater than maxID in trunk parameter")), |
| 1910 | ) |
| 1911 | |
| 1912 | 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. { |
| 1913 | // Redefine ver inside for scope so real value is picked up by each dynamically defined It() |
| 1914 | // See Gingkgo's "Patterns for dynamically generating tests" documentation. |
| 1915 | ver := ver |
| 1916 | |
| 1917 | 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] creates a bridge", ver), func() { |
| 1918 | conf := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver}.netConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConf().() |
| 1919 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1920 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1921 | |
| 1922 | bridge, _, err := setupBridgescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/setupBridge().(conf) |
| 1923 | 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().()) |
| 1924 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(bridge.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1925 | |
| 1926 | // Double check that the link was added |
| 1927 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 1928 | 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().()) |
| 1929 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1930 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Promiscscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Promisc.).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().(0)) |
| 1931 | return nil |
| 1932 | }) |
| 1933 | 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().()) |
| 1934 | }) |
| 1935 | |
| 1936 | 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] handles an existing bridge", ver), func() { |
| 1937 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 1938 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 1939 | |
| 1940 | linkAttrs := netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.NewLinkAttrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/NewLinkAttrs().() |
| 1941 | linkAttrs.Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name. = BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME. |
| 1942 | err := netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.LinkAddscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAdd().(&netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Bridgescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#{ |
| 1943 | LinkAttrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#LinkAttrs.: linkAttrs, |
| 1944 | }) |
| 1945 | 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().()) |
| 1946 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 1947 | 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().()) |
| 1948 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1949 | ifindex := link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index. |
| 1950 | |
| 1951 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, isGWscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isGW.: false} |
| 1952 | conf := tc.netConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConf().() |
| 1953 | |
| 1954 | bridge, _, err := setupBridgescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/setupBridge().(conf) |
| 1955 | 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().()) |
| 1956 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(bridge.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1957 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(bridge.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Bridge#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.).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().(ifindex)) |
| 1958 | |
| 1959 | // Double check that the link has the same ifindex |
| 1960 | link, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 1961 | 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().()) |
| 1962 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name.).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().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.)) |
| 1963 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Indexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Index.).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().(ifindex)) |
| 1964 | return nil |
| 1965 | }) |
| 1966 | 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().()) |
| 1967 | }) |
| 1968 | |
| 1969 | for i, tc := range []testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 1970 | { |
| 1971 | // IPv4 only |
| 1972 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 1973 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"10.1.2.1/24"}, |
| 1974 | }, |
| 1975 | { |
| 1976 | // IPv6 only |
| 1977 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "2001:db8::0/64", |
| 1978 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"2001:db8::1/64"}, |
| 1979 | }, |
| 1980 | { |
| 1981 | // Dual-Stack |
| 1982 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{ |
| 1983 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "192.168.0.0/24"}, |
| 1984 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "fd00::0/64"}, |
| 1985 | }, |
| 1986 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{ |
| 1987 | "192.168.0.1/24", |
| 1988 | "fd00::1/64", |
| 1989 | }, |
| 1990 | }, |
| 1991 | { |
| 1992 | // 3 Subnets (1 IPv4 and 2 IPv6 subnets) |
| 1993 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{ |
| 1994 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "192.168.0.0/24"}, |
| 1995 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "fd00::0/64"}, |
| 1996 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "2001:db8::0/64"}, |
| 1997 | }, |
| 1998 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{ |
| 1999 | "192.168.0.1/24", |
| 2000 | "fd00::1/64", |
| 2001 | "2001:db8::1/64", |
| 2002 | }, |
| 2003 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "CNI version 0.2.0 does not support more than 1 address per family", |
| 2004 | DelErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr020.: "CNI version 0.2.0 does not support more than 1 address per family", |
| 2005 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "CNI version 0.1.0 does not support more than 1 address per family", |
| 2006 | DelErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr010.: "CNI version 0.1.0 does not support more than 1 address per family", |
| 2007 | }, |
| 2008 | { |
| 2009 | // with resolvConf DNS settings |
| 2010 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2011 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"10.1.2.1/24"}, |
| 2012 | resolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#resolvConf.: resolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/resolvConf., |
| 2013 | }, |
| 2014 | } { |
| 2015 | tc := tc |
| 2016 | i := i |
| 2017 | 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] (%d) configures and deconfigures a bridge and veth with default route with ADD/DEL", ver, i), func() { |
| 2018 | tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. = ver |
| 2019 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2020 | }) |
| 2021 | } |
| 2022 | |
| 2023 | 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] configures and deconfigures a l2 bridge and veth with ADD/DEL", ver), func() { |
| 2024 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2025 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2026 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2027 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2028 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2029 | } |
| 2030 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2031 | }) |
| 2032 | |
| 2033 | 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] configures and deconfigures a l2 bridge with vlan id 100 using ADD/DEL", ver), func() { |
| 2034 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2035 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2036 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2037 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: 100, |
| 2038 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2039 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2040 | } |
| 2041 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2042 | }) |
| 2043 | |
| 2044 | // TODO find some way to put pointer |
| 2045 | 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] configures and deconfigures a l2 bridge with vlanTrunk 101,200~210 using ADD/DEL", ver), func() { |
| 2046 | id, minID, maxID := 101, 200, 210 |
| 2047 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2048 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2049 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2050 | vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk.: []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{ |
| 2051 | {IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID.: &id}, |
| 2052 | { |
| 2053 | MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &minID, |
| 2054 | MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &maxID, |
| 2055 | }, |
| 2056 | }, |
| 2057 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2058 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2059 | } |
| 2060 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2061 | }) |
| 2062 | |
| 2063 | 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] configures and deconfigures a l2 bridge with vlan 100, and vlanTrunk 101,200~210 using ADD/DEL", ver), func() { |
| 2064 | nativeVlan := 100 |
| 2065 | id, minID, maxID := 101, 200, 210 |
| 2066 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2067 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2068 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2069 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: nativeVlan, |
| 2070 | vlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlanTrunk.: []*VlanTrunkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#{ |
| 2071 | {IDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#ID.: &id}, |
| 2072 | { |
| 2073 | MinIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MinID.: &minID, |
| 2074 | MaxIDscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/VlanTrunk#MaxID.: &maxID, |
| 2075 | }, |
| 2076 | }, |
| 2077 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2078 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2079 | } |
| 2080 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2081 | }) |
| 2082 | |
| 2083 | 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] configures and deconfigures a l2 bridge with vlan id 100 and no default vlan using ADD/DEL", ver), func() { |
| 2084 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2085 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2086 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2087 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: 100, |
| 2088 | removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan.: true, |
| 2089 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2090 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2091 | } |
| 2092 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2093 | }) |
| 2094 | |
| 2095 | for i, tc := range []testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2096 | { |
| 2097 | // IPv4 only |
| 2098 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2099 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"10.1.2.1/24"}, |
| 2100 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: 100, |
| 2101 | }, |
| 2102 | { |
| 2103 | // IPv6 only |
| 2104 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "2001:db8::0/64", |
| 2105 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"2001:db8::1/64"}, |
| 2106 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: 100, |
| 2107 | }, |
| 2108 | { |
| 2109 | // Dual-Stack |
| 2110 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{ |
| 2111 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "192.168.0.0/24"}, |
| 2112 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "fd00::0/64"}, |
| 2113 | }, |
| 2114 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{ |
| 2115 | "192.168.0.1/24", |
| 2116 | "fd00::1/64", |
| 2117 | }, |
| 2118 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: 100, |
| 2119 | }, |
| 2120 | { |
| 2121 | // 3 Subnets (1 IPv4 and 2 IPv6 subnets) |
| 2122 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{ |
| 2123 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "192.168.0.0/24"}, |
| 2124 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "fd00::0/64"}, |
| 2125 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "2001:db8::0/64"}, |
| 2126 | }, |
| 2127 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{ |
| 2128 | "192.168.0.1/24", |
| 2129 | "fd00::1/64", |
| 2130 | "2001:db8::1/64", |
| 2131 | }, |
| 2132 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: 100, |
| 2133 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "CNI version 0.2.0 does not support more than 1 address per family", |
| 2134 | DelErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr020.: "CNI version 0.2.0 does not support more than 1 address per family", |
| 2135 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "CNI version 0.1.0 does not support more than 1 address per family", |
| 2136 | DelErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#DelErr010.: "CNI version 0.1.0 does not support more than 1 address per family", |
| 2137 | }, |
| 2138 | } { |
| 2139 | tc := tc |
| 2140 | i := i |
| 2141 | 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] (%d) configures and deconfigures a bridge, veth with default route and vlanID 100 with ADD/DEL", ver, i), func() { |
| 2142 | tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. = ver |
| 2143 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2144 | }) |
| 2145 | 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] (%d) configures and deconfigures a bridge, veth with default route and vlanID 100 and no default vlan with ADD/DEL", ver, i), func() { |
| 2146 | tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. = ver |
| 2147 | tc.removeDefaultVlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#removeDefaultVlan. = true |
| 2148 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2149 | }) |
| 2150 | } |
| 2151 | |
| 2152 | for i, tc := range []testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2153 | { |
| 2154 | // IPv4 only |
| 2155 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2156 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"10.1.2.1/24"}, |
| 2157 | }, |
| 2158 | { |
| 2159 | // IPv6 only |
| 2160 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "2001:db8::0/64", |
| 2161 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"2001:db8::1/64"}, |
| 2162 | }, |
| 2163 | { |
| 2164 | // Dual-Stack |
| 2165 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{ |
| 2166 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "192.168.0.0/24"}, |
| 2167 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "fd00::0/64"}, |
| 2168 | }, |
| 2169 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{ |
| 2170 | "192.168.0.1/24", |
| 2171 | "fd00::1/64", |
| 2172 | }, |
| 2173 | }, |
| 2174 | } { |
| 2175 | tc := tc |
| 2176 | i := i |
| 2177 | 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] (%d) configures and deconfigures a bridge and veth with default route with ADD/DEL", ver, i), func() { |
| 2178 | tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. = ver |
| 2179 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2180 | }) |
| 2181 | } |
| 2182 | |
| 2183 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("deconfigures an unconfigured bridge with DEL", func() { |
| 2184 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2185 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2186 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2187 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"10.1.2.1/24"}, |
| 2188 | } |
| 2189 | |
| 2190 | tester := testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#{ |
| 2191 | testNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#testNS.: originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., |
| 2192 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#targetNS.: targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., |
| 2193 | argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerBase#args.: tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.), |
| 2194 | } |
| 2195 | |
| 2196 | // Execute cmdDEL on the plugin, expect no errors |
| 2197 | tester.cmdDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testerV03x#cmdDelTest().(tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2198 | }) |
| 2199 | |
| 2200 | for i, tc := range []struct { |
| 2201 | gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst. string |
| 2202 | gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond. string |
| 2203 | }{ |
| 2204 | { |
| 2205 | // IPv4 |
| 2206 | gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst.: "10.0.0.1/8", |
| 2207 | gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond.: "10.1.2.3/16", |
| 2208 | }, |
| 2209 | { |
| 2210 | // IPv6, overlapping subnets |
| 2211 | gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst.: "2001:db8:1::1/48", |
| 2212 | gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond.: "2001:db8:1:2::1/64", |
| 2213 | }, |
| 2214 | { |
| 2215 | // IPv6, non-overlapping subnets |
| 2216 | gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst.: "2001:db8:1:2::1/64", |
| 2217 | gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond.: "fd00:1234::1/64", |
| 2218 | }, |
| 2219 | } { |
| 2220 | tc := tc |
| 2221 | i := i |
| 2222 | 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] (%d) ensure bridge address", ver, i), func() { |
| 2223 | conf := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, isGWscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isGW.: true}.netConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConf().() |
| 2224 | |
| 2225 | gwIP, gwSubnet, 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().(tc.gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst.) |
| 2226 | 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().()) |
| 2227 | gwnFirst := 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#{IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.: gwIP, Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask.: gwSubnet.Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask.} |
| 2228 | gwIP, gwSubnet, 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().(tc.gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond.) |
| 2229 | 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().()) |
| 2230 | gwnSecond := 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#{IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.: gwIP, Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask.: gwSubnet.Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask.} |
| 2231 | |
| 2232 | var familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family., expNumAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expNumAddrs. int |
| 2233 | switch { |
| 2234 | case gwIP.To4scip-go gomod github.com/golang/go/src go1.24.2 net/IP#To4().() != nil: |
| 2235 | familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family. = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4. |
| 2236 | expNumAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expNumAddrs. = 1 |
| 2237 | default: |
| 2238 | familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family. = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V6scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V6. |
| 2239 | // Expect configured gw address plus link local |
| 2240 | expNumAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expNumAddrs. = 2 |
| 2241 | } |
| 2242 | |
| 2243 | subnetsOverlap := gwnFirst.Containsscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Contains().(gwnSecond.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.) || |
| 2244 | gwnSecond.Containsscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Contains().(gwnFirst.IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.) |
| 2245 | |
| 2246 | err = originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2247 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2248 | |
| 2249 | // Create the bridge |
| 2250 | bridge, _, err := setupBridgescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/setupBridge().(conf) |
| 2251 | 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().()) |
| 2252 | |
| 2253 | // Function to check IP address(es) on bridge |
| 2254 | checkBridgeIPs := func(cidr0scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:cidr0., cidr1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:cidr1. string) { |
| 2255 | addrs, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.AddrListscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/AddrList().(bridge, familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family.) |
| 2256 | 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().()) |
| 2257 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addrs).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().(expNumAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expNumAddrs.)) |
| 2258 | addr := addrs[0].IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#String().() |
| 2259 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addr).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().(cidr0scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:cidr0.)) |
| 2260 | if cidr1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:cidr1. != "" { |
| 2261 | addr = addrs[1].IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#String().() |
| 2262 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(addr).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().(cidr1scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:cidr1.)) |
| 2263 | } |
| 2264 | } |
| 2265 | |
| 2266 | // Check if ForceAddress has default value |
| 2267 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(conf.ForceAddressscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#ForceAddress.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 2268 | |
| 2269 | // Set first address on bridge |
| 2270 | err = ensureAddrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ensureAddr().(bridge, familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family., &gwnFirst, conf.ForceAddressscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#ForceAddress.) |
| 2271 | 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().()) |
| 2272 | checkBridgeIPs(tc.gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst., "") |
| 2273 | |
| 2274 | // Attempt to set the second address on the bridge |
| 2275 | // with ForceAddress set to false. |
| 2276 | err = ensureAddrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ensureAddr().(bridge, familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family., &gwnSecond, false) |
| 2277 | if familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family. == netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4. || subnetsOverlap { |
| 2278 | // IPv4 or overlapping IPv6 subnets: |
| 2279 | // Expect an error, and address should remain the same |
| 2280 | 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().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 2281 | checkBridgeIPs(tc.gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst., "") |
| 2282 | } else { |
| 2283 | // Non-overlapping IPv6 subnets: |
| 2284 | // There should be 2 addresses (in addition to link local) |
| 2285 | 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().()) |
| 2286 | expNumAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expNumAddrs.++ |
| 2287 | checkBridgeIPs(tc.gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond., tc.gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst.) |
| 2288 | } |
| 2289 | |
| 2290 | // Set the second address on the bridge |
| 2291 | // with ForceAddress set to true. |
| 2292 | err = ensureAddrscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/ensureAddr().(bridge, familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family., &gwnSecond, true) |
| 2293 | 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().()) |
| 2294 | if familyscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:family. == netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.FAMILY_V4scip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/FAMILY_V4. || subnetsOverlap { |
| 2295 | // IPv4 or overlapping IPv6 subnets: |
| 2296 | // IP address should be reconfigured. |
| 2297 | checkBridgeIPs(tc.gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond., "") |
| 2298 | } else { |
| 2299 | // Non-overlapping IPv6 subnets: |
| 2300 | // There should be 2 addresses (in addition to link local) |
| 2301 | checkBridgeIPs(tc.gwCIDRSecondscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRSecond., tc.gwCIDRFirstscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:gwCIDRFirst.) |
| 2302 | } |
| 2303 | |
| 2304 | return nil |
| 2305 | }) |
| 2306 | 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().()) |
| 2307 | |
| 2308 | // Clean up bridge addresses for next test case |
| 2309 | delBridgeAddrsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/delBridgeAddrs().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS.) |
| 2310 | }) |
| 2311 | } |
| 2312 | |
| 2313 | 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] ensure promiscuous mode on bridge", ver), func() { |
| 2314 | const IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:IFNAME. = "bridge0" |
| 2315 | |
| 2316 | conf := &NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#{ |
| 2317 | NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#NetConf.: typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/.NetConfscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/NetConf#{ |
| 2318 | Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#Name.: "testConfig", |
| 2319 | Typescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#Type.: "bridge", |
| 2320 | }, |
| 2321 | BrNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#BrName.: IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:IFNAME., |
| 2322 | IsGWscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#IsGW.: true, |
| 2323 | IPMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#IPMasq.: false, |
| 2324 | HairpinModescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#HairpinMode.: false, |
| 2325 | PromiscModescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#PromiscMode.: true, |
| 2326 | MTUscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#MTU.: 5000, |
| 2327 | } |
| 2328 | |
| 2329 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2330 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2331 | |
| 2332 | conf.NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#NetConf..CNIVersionscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#CNIVersion. = ver |
| 2333 | _, _, err := setupBridgescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/setupBridge().(conf) |
| 2334 | 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().()) |
| 2335 | // Check if ForceAddress has default value |
| 2336 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(conf.ForceAddressscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/NetConf#ForceAddress.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeFalsescip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeFalse().()) |
| 2337 | |
| 2338 | // Check if promiscuous mode is set correctly |
| 2339 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().("bridge0") |
| 2340 | 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().()) |
| 2341 | |
| 2342 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().Promiscscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Promisc.).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().(1)) |
| 2343 | return nil |
| 2344 | }) |
| 2345 | 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().()) |
| 2346 | }) |
| 2347 | |
| 2348 | for i, tc := range []testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2349 | { |
| 2350 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2351 | }, |
| 2352 | { |
| 2353 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "2001:db8:42::/64", |
| 2354 | }, |
| 2355 | } { |
| 2356 | tc := tc |
| 2357 | i := i |
| 2358 | 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] (%d) creates a bridge with a stable MAC addresses", ver, i), func() { |
| 2359 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2360 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2361 | |
| 2362 | tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. = ver |
| 2363 | _, _, err := setupBridgescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/setupBridge().(tc.netConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConf().()) |
| 2364 | 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().()) |
| 2365 | link, err := netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 2366 | 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().()) |
| 2367 | origMac := link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr. |
| 2368 | |
| 2369 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2370 | |
| 2371 | link, err = netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/.LinkByNamescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/LinkByName().(BRNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/BRNAME.) |
| 2372 | 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().()) |
| 2373 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(link.Attrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Link#Attrs().().HardwareAddrscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#HardwareAddr.).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().(origMac)) |
| 2374 | return nil |
| 2375 | }) |
| 2376 | 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().()) |
| 2377 | }) |
| 2378 | } |
| 2379 | |
| 2380 | 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] uses an explicit MAC addresses for the container iface (from CNI_ARGS)", ver), func() { |
| 2381 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2382 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2383 | |
| 2384 | const expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac. = "02:00:00:00:00:00" |
| 2385 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2386 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2387 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2388 | envArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#envArgs.: "MAC=" + expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac., |
| 2389 | |
| 2390 | expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac.: expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac., |
| 2391 | } |
| 2392 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2393 | |
| 2394 | return nil |
| 2395 | }) |
| 2396 | 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().()) |
| 2397 | }) |
| 2398 | |
| 2399 | 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] uses an explicit MAC addresses for the container iface (from Args)", ver), func() { |
| 2400 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2401 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2402 | |
| 2403 | const expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac. = "02:00:00:00:00:00" |
| 2404 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2405 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2406 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2407 | envArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#envArgs.: "MAC=" + "02:00:00:00:04:56", |
| 2408 | |
| 2409 | expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac.: expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac., |
| 2410 | } |
| 2411 | tc.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#args..cniscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#cni..macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#$anon_56cad4e26b96cf38#mac. = expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac. |
| 2412 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2413 | |
| 2414 | return nil |
| 2415 | }) |
| 2416 | 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().()) |
| 2417 | }) |
| 2418 | |
| 2419 | 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] uses an explicit MAC addresses for the container iface (from RuntimeConfig)", ver), func() { |
| 2420 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2421 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2422 | |
| 2423 | const expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac. = "02:00:00:00:00:00" |
| 2424 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2425 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2426 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2427 | envArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#envArgs.: "MAC=" + "02:00:00:00:04:56", |
| 2428 | |
| 2429 | expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expectedMac.: expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac., |
| 2430 | } |
| 2431 | tc.argsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#args..cniscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#cni..macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_f87832d34924ed8f#$anon_56cad4e26b96cf38#mac. = "02:00:00:00:07:89" |
| 2432 | tc.runtimeConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#runtimeConfig..macscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#$anon_56cad4e26b96cf38#mac. = expectedMacscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:expectedMac. |
| 2433 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2434 | |
| 2435 | return nil |
| 2436 | }) |
| 2437 | 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().()) |
| 2438 | }) |
| 2439 | |
| 2440 | 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] checks ip release in case of error", ver), func() { |
| 2441 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2442 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2443 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2444 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2445 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2446 | } |
| 2447 | |
| 2448 | _, _, err := setupBridgescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/setupBridge().(tc.netConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConf().()) |
| 2449 | 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().()) |
| 2450 | |
| 2451 | args := tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2452 | |
| 2453 | // get number of allocated IPs before asking for a new one |
| 2454 | before, err := countIPAMIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/countIPAMIPs().(dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2455 | 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().()) |
| 2456 | |
| 2457 | debugPostIPAMErrorscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/debugPostIPAMError. = fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("debugPostIPAMError") |
| 2458 | _, _, 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 { |
| 2459 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(args) |
| 2460 | }) |
| 2461 | 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().("debugPostIPAMError")) |
| 2462 | |
| 2463 | // get number of allocated IPs after failure |
| 2464 | after, err := countIPAMIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/countIPAMIPs().(dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2465 | 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().()) |
| 2466 | |
| 2467 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(before).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().(after)) |
| 2468 | return nil |
| 2469 | }) |
| 2470 | 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().()) |
| 2471 | }) |
| 2472 | |
| 2473 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasChainingscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasChaining().(ver) { |
| 2474 | for _, tc := range []testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2475 | { |
| 2476 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{{ |
| 2477 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "10.1.2.0/24", |
| 2478 | }}, |
| 2479 | ipMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasq.: true, |
| 2480 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2481 | }, |
| 2482 | { |
| 2483 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{{ |
| 2484 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "10.1.2.0/24", |
| 2485 | }}, |
| 2486 | ipMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasq.: true, |
| 2487 | ipMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackend.: "iptables", |
| 2488 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2489 | }, |
| 2490 | { |
| 2491 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{{ |
| 2492 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "10.1.2.0/24", |
| 2493 | }}, |
| 2494 | ipMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasq.: true, |
| 2495 | ipMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackend.: "nftables", |
| 2496 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2497 | }, |
| 2498 | } { |
| 2499 | tc := tc |
| 2500 | 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] configures a bridge and ipMasq rules with ipMasqBackend %q", ver, tc.ipMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackend.), func() { |
| 2501 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2502 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2503 | |
| 2504 | args := tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2505 | r, _, 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 { |
| 2506 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(args) |
| 2507 | }) |
| 2508 | 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().()) |
| 2509 | 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) |
| 2510 | 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().()) |
| 2511 | 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.).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(1)) |
| 2512 | |
| 2513 | ip := result.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.[0].Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Address..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().() |
| 2514 | |
| 2515 | // Update this if the default ipmasq backend changes |
| 2516 | switch tc.ipMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ipMasqBackend. { |
| 2517 | case "iptables", "": |
| 2518 | ipt, err := iptablesscip-go gomod github.com/coreos/go-iptables v0.8.0 `github.com/coreos/go-iptables/iptables`/.NewWithProtocolscip-go gomod github.com/coreos/go-iptables v0.8.0 `github.com/coreos/go-iptables/iptables`/NewWithProtocol().(iptablesscip-go gomod github.com/coreos/go-iptables v0.8.0 `github.com/coreos/go-iptables/iptables`/.ProtocolIPv4scip-go gomod github.com/coreos/go-iptables v0.8.0 `github.com/coreos/go-iptables/iptables`/ProtocolIPv4.) |
| 2519 | 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().()) |
| 2520 | |
| 2521 | rules, err := ipt.Listscip-go gomod github.com/coreos/go-iptables v0.8.0 `github.com/coreos/go-iptables/iptables`/IPTables#List().("nat", "POSTROUTING") |
| 2522 | 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().()) |
| 2523 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(rules).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#Should().(ContainElementscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/ContainElement().(ContainSubstringscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/ContainSubstring().(ip))) |
| 2524 | case "nftables": |
| 2525 | nft, err := knftablesscip-go gomod sigs.k8s.io/knftables v0.0.18 `sigs.k8s.io/knftables`/.Newscip-go gomod sigs.k8s.io/knftables v0.0.18 `sigs.k8s.io/knftables`/New().(knftablesscip-go gomod sigs.k8s.io/knftables v0.0.18 `sigs.k8s.io/knftables`/.InetFamilyscip-go gomod sigs.k8s.io/knftables v0.0.18 `sigs.k8s.io/knftables`/InetFamily., "cni_plugins_masquerade") |
| 2526 | 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().()) |
| 2527 | rules, err := nft.ListRulesscip-go gomod sigs.k8s.io/knftables v0.0.18 `sigs.k8s.io/knftables`/Interface#ListRules().(contextscip-go gomod github.com/golang/go/src go1.24.2 context/.TODOscip-go gomod github.com/golang/go/src go1.24.2 context/TODO().(), "masq_checks") |
| 2528 | 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().()) |
| 2529 | // FIXME: ListRules() doesn't return the actual rule strings, |
| 2530 | // and we can't easily compute the ipmasq plugin's comment. |
| 2531 | comments := 0 |
| 2532 | for _, r := range rules { |
| 2533 | if r.Commentscip-go gomod sigs.k8s.io/knftables v0.0.18 `sigs.k8s.io/knftables`/Rule#Comment. != nil { |
| 2534 | comments++ |
| 2535 | break |
| 2536 | } |
| 2537 | } |
| 2538 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(comments).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().(1), "expected to find exactly one Rule with a comment") |
| 2539 | } |
| 2540 | |
| 2541 | 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 { |
| 2542 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdDel().(args) |
| 2543 | }) |
| 2544 | 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().()) |
| 2545 | return nil |
| 2546 | }) |
| 2547 | 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().()) |
| 2548 | }) |
| 2549 | } |
| 2550 | |
| 2551 | for i, tc := range []testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2552 | { |
| 2553 | // IPv4 only |
| 2554 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{{ |
| 2555 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "10.1.2.0/24", |
| 2556 | }}, |
| 2557 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"10.1.2.1/24"}, |
| 2558 | }, |
| 2559 | { |
| 2560 | // IPv6 only |
| 2561 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{{ |
| 2562 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "2001:db8::0/64", |
| 2563 | }}, |
| 2564 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{"2001:db8::1/64"}, |
| 2565 | }, |
| 2566 | { |
| 2567 | // Dual-Stack |
| 2568 | rangesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#ranges.: []rangeInfoscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#{ |
| 2569 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "192.168.0.0/24"}, |
| 2570 | {subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/rangeInfo#subnet.: "fd00::0/64"}, |
| 2571 | }, |
| 2572 | expGWCIDRsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#expGWCIDRs.: []string{ |
| 2573 | "192.168.0.1/24", |
| 2574 | "fd00::1/64", |
| 2575 | }, |
| 2576 | }, |
| 2577 | } { |
| 2578 | tc := tc |
| 2579 | i := i |
| 2580 | 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] (%d) configures and deconfigures a bridge and veth with default route with ADD/DEL/CHECK", ver, i), func() { |
| 2581 | tc.cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion. = ver |
| 2582 | cmdAddDelCheckTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelCheckTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2583 | }) |
| 2584 | } |
| 2585 | } |
| 2586 | |
| 2587 | 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] configures mac spoof-check (no mac spoofing)", ver), func() { |
| 2588 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2589 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2590 | |
| 2591 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2592 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2593 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2594 | macspoofchkscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#macspoofchk.: true, |
| 2595 | } |
| 2596 | args := tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2597 | _, _, 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 { |
| 2598 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(args) |
| 2599 | }) |
| 2600 | 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().()) |
| 2601 | |
| 2602 | assertMacSpoofCheckRulesExistscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertMacSpoofCheckRulesExist().() |
| 2603 | |
| 2604 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(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 { |
| 2605 | if err := cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdDel().(args); err != nil { |
| 2606 | return err |
| 2607 | } |
| 2608 | assertMacSpoofCheckRulesMissingscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertMacSpoofCheckRulesMissing().() |
| 2609 | return nil |
| 2610 | })).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 2611 | |
| 2612 | return nil |
| 2613 | })).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 2614 | }) |
| 2615 | |
| 2616 | 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] should fail when both IPAM and DisableContainerInterface are set", ver), func() { |
| 2617 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2618 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2619 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2620 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2621 | subnetscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#subnet.: "10.1.2.0/24", |
| 2622 | disableContIfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#disableContIface.: true, |
| 2623 | } |
| 2624 | args := tc.createCmdArgsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#createCmdArgs().(targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2625 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAdd().(args)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 2626 | |
| 2627 | return nil |
| 2628 | })).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 2629 | }) |
| 2630 | |
| 2631 | 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] should set the container veth peer state down", ver), func() { |
| 2632 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2633 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2634 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2635 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2636 | disableContIfacescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#disableContIface.: true, |
| 2637 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2638 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2639 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2640 | } |
| 2641 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2642 | return nil |
| 2643 | })).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 2644 | }) |
| 2645 | |
| 2646 | 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] when port-isolation is off, should set the veth peer on node with isolation off", ver), func() { |
| 2647 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2648 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2649 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2650 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2651 | portIsolationscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#portIsolation.: false, |
| 2652 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2653 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2654 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2655 | } |
| 2656 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2657 | return nil |
| 2658 | })).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 2659 | }) |
| 2660 | |
| 2661 | 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] when port-isolation is on, should set the veth peer on node with isolation on", ver), func() { |
| 2662 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS..Doscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Do.(func(nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/.NetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#) error { |
| 2663 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 2664 | tc := testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2665 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: ver, |
| 2666 | portIsolationscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#portIsolation.: true, |
| 2667 | isLayer2scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#isLayer2.: true, |
| 2668 | AddErr020scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr020.: "cannot convert: no valid IP addresses", |
| 2669 | AddErr010scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#AddErr010.: "cannot convert: no valid IP addresses", |
| 2670 | } |
| 2671 | cmdAddDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/cmdAddDelTest().(originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:targetNS., tc, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:dataDir.) |
| 2672 | return nil |
| 2673 | })).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Succeedscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Succeed().()) |
| 2674 | }) |
| 2675 | } |
| 2676 | |
| 2677 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("check vlan id when loading net conf", func() { |
| 2678 | type vlanTC struct { |
| 2679 | testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase# |
| 2680 | err error |
| 2681 | } |
| 2682 | |
| 2683 | createCaseFn := func(verscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:ver. string, vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:vlan. int, errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:err. error) vlanTC { |
| 2684 | return vlanTC{ |
| 2685 | testCase: testCasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#{ |
| 2686 | cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#cniVersion.: verscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:ver., |
| 2687 | vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#vlan.: vlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:vlan., |
| 2688 | }, |
| 2689 | err: errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/_:err., |
| 2690 | } |
| 2691 | } |
| 2692 | |
| 2693 | tests := []vlanTC{} |
| 2694 | tests = append(tests, createCaseFn("1.0.0", 0, nil)) |
| 2695 | tests = append(tests, createCaseFn("0.4.0", 0, nil)) |
| 2696 | tests = append(tests, createCaseFn("1.0.0", -100, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("invalid VLAN ID -100 (must be between 0 and 4094)"))) |
| 2697 | tests = append(tests, createCaseFn("0.4.0", -100, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("invalid VLAN ID -100 (must be between 0 and 4094)"))) |
| 2698 | tests = append(tests, createCaseFn("1.0.0", 5000, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("invalid VLAN ID 5000 (must be between 0 and 4094)"))) |
| 2699 | tests = append(tests, createCaseFn("0.4.0", 5000, fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Errorf().("invalid VLAN ID 5000 (must be between 0 and 4094)"))) |
| 2700 | |
| 2701 | for _, test := range tests { |
| 2702 | _, _, err := loadNetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/loadNetConf().([]byte(test.netConfJSONscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/testCase#netConfJSON().("")), "") |
| 2703 | if test.err == nil { |
| 2704 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).ToNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#ToNot().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 2705 | } else { |
| 2706 | 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().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(test.err)) |
| 2707 | } |
| 2708 | } |
| 2709 | }) |
| 2710 | }) |
| 2711 | |
| 2712 | func assertMacSpoofCheckRulesExistscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertMacSpoofCheckRulesExist().() { |
| 2713 | assertMacSpoofCheckRulesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertMacSpoofCheckRules().( |
| 2714 | func(actual interface{}, expectedLen int) { |
| 2715 | ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/ExpectWithOffset().(3, actual).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().(expectedLen)) |
| 2716 | }) |
| 2717 | } |
| 2718 | |
| 2719 | func assertMacSpoofCheckRulesMissingscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertMacSpoofCheckRulesMissing().() { |
| 2720 | assertMacSpoofCheckRulesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertMacSpoofCheckRules().( |
| 2721 | func(actual interface{}, _ int) { |
| 2722 | ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/ExpectWithOffset().(3, actual).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 2723 | }) |
| 2724 | } |
| 2725 | |
| 2726 | func assertMacSpoofCheckRulesscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/bridge`/assertMacSpoofCheckRules().(assert func(actual interface{}, expectedLen int)) { |
| 2727 | c, err := nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.ReadConfigscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/ReadConfig().() |
| 2728 | ExpectWithOffsetscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/ExpectWithOffset().(2, 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().()) |
| 2729 | |
| 2730 | expectedTable := nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.NewTablescip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/NewTable().("nat", "bridge") |
| 2731 | filter := nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.TypeFilterscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/TypeFilter. |
| 2732 | hook := nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.HookPreRoutingscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/HookPreRouting. |
| 2733 | prio := -300 |
| 2734 | policy := nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.PolicyAcceptscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/PolicyAccept. |
| 2735 | expectedBaseChain := nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.NewChainscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/NewChain().(expectedTable, "PREROUTING", &filter, &hook, &prio, &policy) |
| 2736 | |
| 2737 | assert(c.LookupRulescip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft/config`/Config#LookupRule().(nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.NewRulescip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/NewRule().( |
| 2738 | expectedTable, |
| 2739 | expectedBaseChain, |
| 2740 | nil, nil, nil, |
| 2741 | "macspoofchk-dummy-0-eth0", |
| 2742 | )), 1) |
| 2743 | |
| 2744 | assert(c.LookupRulescip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft/config`/Config#LookupRule().(nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.NewRulescip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/NewRule().( |
| 2745 | expectedTable, |
| 2746 | nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.NewRegularChainscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/NewRegularChain().(expectedTable, "cni-br-iface-dummy-0-eth0"), |
| 2747 | nil, nil, nil, |
| 2748 | "macspoofchk-dummy-0-eth0", |
| 2749 | )), 1) |
| 2750 | |
| 2751 | assert(c.LookupRulescip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft/config`/Config#LookupRule().(nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.NewRulescip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/NewRule().( |
| 2752 | expectedTable, |
| 2753 | nftscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/.NewRegularChainscip-go gomod github.com/networkplumbing/go-nft v0.4.0 `github.com/networkplumbing/go-nft/nft`/NewRegularChain().(expectedTable, "cni-br-iface-dummy-0-eth0-mac"), |
| 2754 | nil, nil, nil, |
| 2755 | "macspoofchk-dummy-0-eth0", |
| 2756 | )), 2) |
| 2757 | } |