| 1 | // Copyright 2015 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/ipvlan`/ |
| 16 | |
| 17 | import ( |
| 18 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.24.2 `encoding/json`/" |
| 19 | "fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/" |
| 20 | "netscip-go gomod github.com/golang/go/src go1.24.2 net/" |
| 21 | "osscip-go gomod github.com/golang/go/src go1.24.2 os/" |
| 22 | "stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/" |
| 23 | "syscallscip-go gomod github.com/golang/go/src go1.24.2 syscall/" |
| 24 | |
| 25 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 26 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 27 | "github.com/vishvananda/netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/" |
| 28 | |
| 29 | "github.com/containernetworking/cni/pkg/skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/" |
| 30 | "github.com/containernetworking/cni/pkg/typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/" |
| 31 | types020scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/ "github.com/containernetworking/cni/pkg/types/020scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/" |
| 32 | 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`/" |
| 33 | 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`/" |
| 34 | "github.com/containernetworking/plugins/pkg/netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/" |
| 35 | "github.com/containernetworking/plugins/pkg/nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/" |
| 36 | "github.com/containernetworking/plugins/pkg/testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/" |
| 37 | "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`/" |
| 38 | ) |
| 39 | |
| 40 | const ( |
| 41 | MASTER_NAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME. = "eth0" |
| 42 | MASTER_NAME_INCONTAINERscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME_INCONTAINER. = "eth1" |
| 43 | ) |
| 44 | |
| 45 | type Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net# struct { |
| 46 | Namescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#Name. string `json:"name"` |
| 47 | CNIVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#CNIVersion. string `json:"cniVersion"` |
| 48 | Typescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#Type. string `json:"type,omitempty"` |
| 49 | Masterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#Master. string `json:"master"` |
| 50 | Modescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#Mode. string `json:"mode"` |
| 51 | IPAMscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/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"` |
| 52 | DNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/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"` |
| 53 | RawPrevResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#RawPrevResult. map[string]interface{} `json:"prevResult,omitempty"` |
| 54 | PrevResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/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:"-"` |
| 55 | LinkContNsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#LinkContNs. bool `json:"linkInContainer"` |
| 56 | } |
| 57 | |
| 58 | func buildOneConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/buildOneConfig().(cniVersion string, master string, orig *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/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/ipvlan`/Net#, error) { |
| 59 | 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) |
| 60 | if err != nil { |
| 61 | return nil, err |
| 62 | } |
| 63 | |
| 64 | config := make(map[string]interface{}) |
| 65 | 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) |
| 66 | if err != nil { |
| 67 | 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) |
| 68 | } |
| 69 | |
| 70 | inject := map[string]interface{}{ |
| 71 | "name": orig.Namescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#Name., |
| 72 | "cniVersion": orig.CNIVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#CNIVersion., |
| 73 | } |
| 74 | // Add previous plugin result |
| 75 | if prevResult != nil && 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().(cniVersion) { |
| 76 | inject["prevResult"] = prevResult |
| 77 | } |
| 78 | if master != "" { |
| 79 | inject["master"] = master |
| 80 | } |
| 81 | |
| 82 | for key, value := range inject { |
| 83 | config[key] = value |
| 84 | } |
| 85 | |
| 86 | 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) |
| 87 | if err != nil { |
| 88 | return nil, err |
| 89 | } |
| 90 | |
| 91 | conf := &Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#{} |
| 92 | 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 { |
| 93 | 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) |
| 94 | } |
| 95 | |
| 96 | return conf, nil |
| 97 | } |
| 98 | |
| 99 | func ipvlanAddCheckDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/ipvlanAddCheckDelTest().(conf, masterName string, originalNS, 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#) { |
| 100 | // Unmarshal to pull out CNI spec version |
| 101 | rawConfig := make(map[string]interface{}) |
| 102 | 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(conf), &rawConfig) |
| 103 | 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().()) |
| 104 | cniVersion := rawConfig["cniVersion"].(string) |
| 105 | |
| 106 | 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#{ |
| 107 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 108 | 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.(), |
| 109 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: "ipvl0", |
| 110 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 111 | } |
| 112 | |
| 113 | var result 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# |
| 114 | var macAddress string |
| 115 | err = 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 { |
| 116 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 117 | |
| 118 | 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().(cniVersion) { |
| 119 | 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 { |
| 120 | return cmdStatusscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/cmdStatus().(args) |
| 121 | }) |
| 122 | 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().()) |
| 123 | } |
| 124 | |
| 125 | result, _, 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 { |
| 126 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/cmdAdd().(args) |
| 127 | }) |
| 128 | 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().()) |
| 129 | |
| 130 | t := newTesterByVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/newTesterByVersion().(cniVersion) |
| 131 | macAddress = t.verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/tester#verifyResult.(result, args.IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.) |
| 132 | return nil |
| 133 | }) |
| 134 | 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().()) |
| 135 | |
| 136 | // Make sure ipvlan link exists in the target namespace |
| 137 | err = 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 { |
| 138 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 139 | |
| 140 | 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().(args.IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.) |
| 141 | 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().()) |
| 142 | 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().(args.IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.)) |
| 143 | |
| 144 | if macAddress != "" { |
| 145 | hwaddr, err := netscip-go gomod github.com/golang/go/src go1.24.2 net/.ParseMACscip-go gomod github.com/golang/go/src go1.24.2 net/ParseMAC().(macAddress) |
| 146 | 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().()) |
| 147 | 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().(hwaddr)) |
| 148 | } |
| 149 | |
| 150 | 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, syscallscip-go gomod github.com/golang/go/src go1.24.2 syscall/.AF_INETscip-go gomod github.com/golang/go/src go1.24.2 syscall/AF_INET.) |
| 151 | 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().()) |
| 152 | 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().(1)) |
| 153 | return nil |
| 154 | }) |
| 155 | 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().()) |
| 156 | |
| 157 | n := &Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#{} |
| 158 | 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(conf), &n) |
| 159 | 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().()) |
| 160 | |
| 161 | if n.IPAMscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/Net#IPAM. != nil { |
| 162 | n.IPAMscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/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(conf), "") |
| 163 | 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().()) |
| 164 | } |
| 165 | |
| 166 | // build chained/cached config for DEL |
| 167 | newConf, err := buildOneConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/buildOneConfig().(cniVersion, masterName, n, result) |
| 168 | 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().()) |
| 169 | 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().(newConf) |
| 170 | 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().()) |
| 171 | |
| 172 | args.StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData. = confBytes |
| 173 | GinkgoTscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoT().().Logfscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoTInterface#Logf().(string(confBytes)) |
| 174 | |
| 175 | if testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.SpecVersionHasCHECKscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/SpecVersionHasCHECK().(cniVersion) { |
| 176 | // CNI Check on ipvlan in the target namespace |
| 177 | err = 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 { |
| 178 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 179 | |
| 180 | return 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().(args, func() error { |
| 181 | return cmdCheckscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/cmdCheck().(args) |
| 182 | }) |
| 183 | }) |
| 184 | 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().()) |
| 185 | } |
| 186 | |
| 187 | err = 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 { |
| 188 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 189 | |
| 190 | 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 { |
| 191 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/cmdDel().(args) |
| 192 | }) |
| 193 | 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().()) |
| 194 | return nil |
| 195 | }) |
| 196 | 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().()) |
| 197 | |
| 198 | // Make sure ipvlan link has been deleted |
| 199 | err = 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 { |
| 200 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 201 | |
| 202 | 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().(args.IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.) |
| 203 | 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().()) |
| 204 | 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().()) |
| 205 | return nil |
| 206 | }) |
| 207 | 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().()) |
| 208 | } |
| 209 | |
| 210 | type testerscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/tester# interface { |
| 211 | // verifyResult minimally verifies the Result and returns the interface's MAC address |
| 212 | verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/tester#verifyResult.(result 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#, name string) string |
| 213 | } |
| 214 | |
| 215 | type testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerBase# struct{} |
| 216 | |
| 217 | type ( |
| 218 | testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV10x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerBase# |
| 219 | testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV04x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerBase# |
| 220 | testerV02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV02x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerBase# |
| 221 | ) |
| 222 | |
| 223 | func newTesterByVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/newTesterByVersion().(version string) testerscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/tester# { |
| 224 | switch { |
| 225 | 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."): |
| 226 | return &testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV10x#{} |
| 227 | 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.") || 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."): |
| 228 | return &testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV04x#{} |
| 229 | 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.1.") || 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.2."): |
| 230 | return &testerV02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV02x#{} |
| 231 | } |
| 232 | Failscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Fail().(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().("unsupported config version %s", version)) |
| 233 | return nil |
| 234 | } |
| 235 | |
| 236 | // verifyResult minimally verifies the Result and returns the interface's MAC address |
| 237 | func (t *testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV10x#) verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV10x#verifyResult().(result 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#, name string) string { |
| 238 | r, 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().(result) |
| 239 | 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().()) |
| 240 | |
| 241 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.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().(1)) |
| 242 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.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().(name)) |
| 243 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(1)) |
| 244 | |
| 245 | return r.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. |
| 246 | } |
| 247 | |
| 248 | // verifyResult minimally verifies the Result and returns the interface's MAC address |
| 249 | func (t *testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV04x#) verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV04x#verifyResult().(result 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#, name string) string { |
| 250 | r, err := types040scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/GetResult().(result) |
| 251 | 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().()) |
| 252 | |
| 253 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.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().(1)) |
| 254 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.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().(name)) |
| 255 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#IPs.).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(HaveLenscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveLen().(1)) |
| 256 | |
| 257 | return r.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. |
| 258 | } |
| 259 | |
| 260 | // verifyResult minimally verifies the Result and returns the interface's MAC address |
| 261 | func (t *testerV02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV02x#) verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/testerV02x#verifyResult().(result 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#, _ string) string { |
| 262 | r, err := types020scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/.GetResultscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/GetResult().(result) |
| 263 | 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().()) |
| 264 | |
| 265 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.IP4scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP4..IPscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/IPConfig#IP.).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().()) |
| 266 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.IP4scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP4..IPscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/IPConfig#IP..IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.).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().()) |
| 267 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.IP6scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP6.).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().()) |
| 268 | |
| 269 | // 0.2 and earlier don't return MAC address |
| 270 | return "" |
| 271 | } |
| 272 | |
| 273 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("ipvlan Operations", func() { |
| 274 | var originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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# |
| 275 | var dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:dataDir. string |
| 276 | |
| 277 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 278 | // Create a new NetNS so we don't modify the host |
| 279 | var errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:err. error |
| 280 | originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:originalNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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().() |
| 281 | 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/ipvlan`/_:err.).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 282 | |
| 283 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:targetNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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().() |
| 284 | 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/ipvlan`/_: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().()) |
| 285 | |
| 286 | dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:dataDir., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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().("", "ipvlan_test") |
| 287 | 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/ipvlan`/_: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().()) |
| 288 | |
| 289 | errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:err. = originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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 { |
| 290 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 291 | |
| 292 | 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().() |
| 293 | linkAttrs.Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name. = MASTER_NAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME. |
| 294 | // Add master |
| 295 | errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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`/.Dummyscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Dummy#{ |
| 296 | LinkAttrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Dummy#LinkAttrs.: linkAttrs, |
| 297 | }) |
| 298 | 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/ipvlan`/_: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().()) |
| 299 | _, errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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().(MASTER_NAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME.) |
| 300 | 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/ipvlan`/_: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().()) |
| 301 | return nil |
| 302 | }) |
| 303 | 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/ipvlan`/_: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().()) |
| 304 | |
| 305 | errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:err. = targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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 { |
| 306 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 307 | |
| 308 | 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().() |
| 309 | linkAttrs.Namescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkAttrs#Name. = MASTER_NAME_INCONTAINERscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME_INCONTAINER. |
| 310 | // Add master |
| 311 | errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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`/.Dummyscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Dummy#{ |
| 312 | LinkAttrsscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Dummy#LinkAttrs.: linkAttrs, |
| 313 | }) |
| 314 | 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/ipvlan`/_: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().()) |
| 315 | _, errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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().(MASTER_NAME_INCONTAINERscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME_INCONTAINER.) |
| 316 | 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/ipvlan`/_: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().()) |
| 317 | return nil |
| 318 | }) |
| 319 | 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/ipvlan`/_: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().()) |
| 320 | }) |
| 321 | |
| 322 | AfterEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/AfterEach().(func() { |
| 323 | 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/ipvlan`/_: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().()) |
| 324 | |
| 325 | 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/ipvlan`/_: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().()) |
| 326 | 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/ipvlan`/_: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().()) |
| 327 | |
| 328 | 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/ipvlan`/_: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().()) |
| 329 | 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/ipvlan`/_: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().()) |
| 330 | }) |
| 331 | |
| 332 | for _, inContainer := range []bool{false, true} { |
| 333 | masterInterface := MASTER_NAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME. |
| 334 | if inContainer { |
| 335 | masterInterface = MASTER_NAME_INCONTAINERscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/MASTER_NAME_INCONTAINER. |
| 336 | } |
| 337 | // for _, ver := range testutils.AllSpecVersions { |
| 338 | for _, ver := range [...]string{"1.0.0"} { |
| 339 | // Redefine ver inside for scope so real value is picked up by each dynamically defined It() |
| 340 | // See Gingkgo's "Patterns for dynamically generating tests" documentation. |
| 341 | ver := ver |
| 342 | isInContainer := inContainer // Tests need a local var with constant value |
| 343 | |
| 344 | 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 an ipvlan link in a non-default namespace", ver), func() { |
| 345 | conf := &NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/NetConf#{ |
| 346 | NetConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/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#{ |
| 347 | CNIVersionscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#CNIVersion.: ver, |
| 348 | Namescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#Name.: "testConfig", |
| 349 | Typescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/PluginConf#Type.: "ipvlan", |
| 350 | }, |
| 351 | Masterscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/NetConf#Master.: masterInterface, |
| 352 | Modescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/NetConf#Mode.: "l2", |
| 353 | MTUscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/NetConf#MTU.: 1500, |
| 354 | LinkContNsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/NetConf#LinkContNs.: isInContainer, |
| 355 | } |
| 356 | |
| 357 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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 { |
| 358 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 359 | |
| 360 | _, err := createIpvlanscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/createIpvlan().(conf, "foobar0", targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:targetNS.) |
| 361 | 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().()) |
| 362 | return nil |
| 363 | }) |
| 364 | |
| 365 | 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().()) |
| 366 | |
| 367 | // Make sure ipvlan link exists in the target namespace |
| 368 | err = targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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 { |
| 369 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 370 | |
| 371 | 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().("foobar0") |
| 372 | 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().()) |
| 373 | 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().("foobar0")) |
| 374 | return nil |
| 375 | }) |
| 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 | |
| 379 | 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 an iplvan link with ADD/DEL", ver), func() { |
| 380 | 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().(`{ |
| 381 | "cniVersion": "%s", |
| 382 | "name": "mynet", |
| 383 | "type": "ipvlan", |
| 384 | "master": "%s", |
| 385 | "linkInContainer": %t, |
| 386 | "ipam": { |
| 387 | "type": "host-local", |
| 388 | "subnet": "10.1.2.0/24", |
| 389 | "dataDir": "%s" |
| 390 | } |
| 391 | }`, ver, masterInterface, isInContainer, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:dataDir.) |
| 392 | |
| 393 | ipvlanAddCheckDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/ipvlanAddCheckDelTest().(conf, "", originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:targetNS.) |
| 394 | }) |
| 395 | |
| 396 | 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) { |
| 397 | 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 an iplvan link with ADD/DEL when chained", ver), func() { |
| 398 | 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().(`{ |
| 399 | "cniVersion": "%s", |
| 400 | "name": "mynet", |
| 401 | "type": "ipvlan", |
| 402 | "linkInContainer": %t, |
| 403 | "prevResult": { |
| 404 | "interfaces": [ |
| 405 | { |
| 406 | "name": "%s" |
| 407 | } |
| 408 | ], |
| 409 | "ips": [ |
| 410 | { |
| 411 | "version": "4", |
| 412 | "address": "10.1.2.2/24", |
| 413 | "gateway": "10.1.2.1", |
| 414 | "interface": 0 |
| 415 | } |
| 416 | ], |
| 417 | "routes": [] |
| 418 | } |
| 419 | }`, ver, isInContainer, masterInterface) |
| 420 | |
| 421 | ipvlanAddCheckDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/ipvlanAddCheckDelTest().(conf, masterInterface, originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:targetNS.) |
| 422 | }) |
| 423 | } |
| 424 | |
| 425 | 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] deconfigures an unconfigured ipvlan link with DEL", ver), func() { |
| 426 | 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().(`{ |
| 427 | "cniVersion": "%s", |
| 428 | "name": "mynet", |
| 429 | "type": "ipvlan", |
| 430 | "master": "%s", |
| 431 | "linkInContainer": %t, |
| 432 | "ipam": { |
| 433 | "type": "host-local", |
| 434 | "subnet": "10.1.2.0/24", |
| 435 | "dataDir": "%s" |
| 436 | } |
| 437 | }`, ver, masterInterface, isInContainer, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:dataDir.) |
| 438 | |
| 439 | 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#{ |
| 440 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 441 | Netnsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#Netns.: targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:targetNS..Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.(), |
| 442 | IfNamescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#IfName.: "ipvl0", |
| 443 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 444 | } |
| 445 | |
| 446 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_: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 { |
| 447 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 448 | |
| 449 | 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 { |
| 450 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/cmdDel().(args) |
| 451 | }) |
| 452 | 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().()) |
| 453 | return nil |
| 454 | }) |
| 455 | 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().()) |
| 456 | }) |
| 457 | |
| 458 | 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 ipvlan link with ADD/DEL, without master config", ver), func() { |
| 459 | 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().(`{ |
| 460 | "cniVersion": "%s", |
| 461 | "name": "mynet", |
| 462 | "type": "ipvlan", |
| 463 | "linkInContainer": %t, |
| 464 | "ipam": { |
| 465 | "type": "host-local", |
| 466 | "subnet": "10.1.2.0/24", |
| 467 | "dataDir": "%s" |
| 468 | } |
| 469 | }`, ver, isInContainer, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:dataDir.) |
| 470 | |
| 471 | // Make MASTER_NAME as default route interface |
| 472 | currentNs := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:originalNS. |
| 473 | if isInContainer { |
| 474 | currentNs = targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:targetNS. |
| 475 | } |
| 476 | err := currentNs.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 { |
| 477 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 478 | |
| 479 | 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().(masterInterface) |
| 480 | 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().()) |
| 481 | err = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.LinkSetUpscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/LinkSetUp().(link) |
| 482 | 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().()) |
| 483 | |
| 484 | address := &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.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPv4scip-go gomod github.com/golang/go/src go1.24.2 net/IPv4().(192, 0, 0, 1), Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.CIDRMaskscip-go gomod github.com/golang/go/src go1.24.2 net/CIDRMask().(24, 32)} |
| 485 | addr := &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#{IPNetscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Addr#IPNet.: address} |
| 486 | err = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.AddrAddscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/AddrAdd().(link, addr) |
| 487 | 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().()) |
| 488 | |
| 489 | // add default gateway into MASTER |
| 490 | dst := &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#{ |
| 491 | IPscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#IP.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPv4scip-go gomod github.com/golang/go/src go1.24.2 net/IPv4().(0, 0, 0, 0), |
| 492 | Maskscip-go gomod github.com/golang/go/src go1.24.2 net/IPNet#Mask.: netscip-go gomod github.com/golang/go/src go1.24.2 net/.CIDRMaskscip-go gomod github.com/golang/go/src go1.24.2 net/CIDRMask().(0, 0), |
| 493 | } |
| 494 | ip := netscip-go gomod github.com/golang/go/src go1.24.2 net/.IPv4scip-go gomod github.com/golang/go/src go1.24.2 net/IPv4().(192, 0, 0, 254) |
| 495 | route := netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.Routescip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#{LinkIndexscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#LinkIndex.: 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., Dstscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Dst.: dst, Gwscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/Route#Gw.: ip} |
| 496 | err = netlinkscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/.RouteAddscip-go gomod github.com/vishvananda/netlink v1.3.1 `github.com/vishvananda/netlink`/RouteAdd().(&route) |
| 497 | 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().()) |
| 498 | return nil |
| 499 | }) |
| 500 | 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().()) |
| 501 | |
| 502 | ipvlanAddCheckDelTestscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/ipvlanAddCheckDelTest().(conf, masterInterface, originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ipvlan`/_:targetNS.) |
| 503 | }) |
| 504 | } |
| 505 | } |
| 506 | }) |