| 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/ptp`/ |
| 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 | "osscip-go gomod github.com/golang/go/src go1.24.2 os/" |
| 21 | "stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/" |
| 22 | |
| 23 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 24 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 25 | |
| 26 | "github.com/containernetworking/cni/pkg/skelscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/" |
| 27 | "github.com/containernetworking/cni/pkg/typesscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/" |
| 28 | 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`/" |
| 29 | 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`/" |
| 30 | 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`/" |
| 31 | "github.com/containernetworking/plugins/pkg/netlinksafescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/netlinksafe`/" |
| 32 | "github.com/containernetworking/plugins/pkg/nsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/" |
| 33 | "github.com/containernetworking/plugins/pkg/testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/" |
| 34 | "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`/" |
| 35 | ) |
| 36 | |
| 37 | type Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net# struct { |
| 38 | Namescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#Name. string `json:"name"` |
| 39 | CNIVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#CNIVersion. string `json:"cniVersion"` |
| 40 | Typescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#Type. string `json:"type,omitempty"` |
| 41 | IPMasqscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#IPMasq. bool `json:"ipMasq"` |
| 42 | IPMasqBackendscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#IPMasqBackend. *string `json:"ipMasqBackend,omitempty"` |
| 43 | MTUscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#MTU. int `json:"mtu"` |
| 44 | IPAMscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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"` |
| 45 | DNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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"` |
| 46 | RawPrevResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#RawPrevResult. map[string]interface{} `json:"prevResult,omitempty"` |
| 47 | PrevResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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:"-"` |
| 48 | } |
| 49 | |
| 50 | func buildOneConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/buildOneConfig().(netName string, cniVersion string, orig *Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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/ptp`/Net#, error) { |
| 51 | var err error |
| 52 | |
| 53 | inject := map[string]interface{}{ |
| 54 | "name": netName, |
| 55 | "cniVersion": cniVersion, |
| 56 | } |
| 57 | // Add previous plugin result |
| 58 | if prevResult != nil { |
| 59 | inject["prevResult"] = prevResult |
| 60 | } |
| 61 | |
| 62 | // Ensure every config uses the same name and version |
| 63 | config := make(map[string]interface{}) |
| 64 | |
| 65 | 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) |
| 66 | if err != nil { |
| 67 | return nil, err |
| 68 | } |
| 69 | |
| 70 | 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) |
| 71 | if err != nil { |
| 72 | 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) |
| 73 | } |
| 74 | |
| 75 | for key, value := range inject { |
| 76 | config[key] = value |
| 77 | } |
| 78 | |
| 79 | 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) |
| 80 | if err != nil { |
| 81 | return nil, err |
| 82 | } |
| 83 | |
| 84 | conf := &Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#{} |
| 85 | 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 { |
| 86 | 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) |
| 87 | } |
| 88 | |
| 89 | return conf, nil |
| 90 | } |
| 91 | |
| 92 | type testerscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/tester# interface { |
| 93 | // verifyResult minimally verifies the Result and returns the interface's IP addresses and MAC address |
| 94 | verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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#, expectedIfName, expectedSandbox string, expectedDNS 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#) ([]resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#, string) |
| 95 | } |
| 96 | |
| 97 | type testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerBase# struct{} |
| 98 | |
| 99 | type ( |
| 100 | testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV10x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerBase# |
| 101 | testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV04x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerBase# |
| 102 | testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV03x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerBase# |
| 103 | testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV01xOr02x# testerBasescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerBase# |
| 104 | ) |
| 105 | |
| 106 | func newTesterByVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/newTesterByVersion().(version string) testerscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/tester# { |
| 107 | switch { |
| 108 | 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."): |
| 109 | return &testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV10x#{} |
| 110 | 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."): |
| 111 | return &testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV04x#{} |
| 112 | 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."): |
| 113 | return &testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV03x#{} |
| 114 | default: |
| 115 | return &testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV01xOr02x#{} |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | type resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP# struct { |
| 120 | ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip. string |
| 121 | gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw. string |
| 122 | } |
| 123 | |
| 124 | // verifyResult minimally verifies the Result and returns the interface's IP addresses and MAC address |
| 125 | func (t *testerV10xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV10x#) verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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#, expectedIfName, expectedSandbox string, expectedDNS 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#) ([]resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#, string) { |
| 126 | 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) |
| 127 | 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().()) |
| 128 | |
| 129 | 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().(2)) |
| 130 | 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().(HavePrefixscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HavePrefix().("veth")) |
| 131 | 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].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)) |
| 132 | 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].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().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 133 | 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.[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().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(expectedIfName)) |
| 134 | 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.[1].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().(expectedSandbox)) |
| 135 | |
| 136 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.DNSscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#DNS.).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().(expectedDNS)) |
| 137 | |
| 138 | // Grab IPs from container interface |
| 139 | ips := []resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#{} |
| 140 | for _, ipc := range r.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/Result#IPs. { |
| 141 | if *ipc.Interfacescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Interface. == 1 { |
| 142 | ips = append(ips, resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#{ |
| 143 | ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip.: ipc.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().(), |
| 144 | gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw.: ipc.Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/100`/IPConfig#Gateway..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().(), |
| 145 | }) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | return ips, r.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. |
| 150 | } |
| 151 | |
| 152 | func verify0403scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/verify0403().(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#, expectedIfName, expectedSandbox string, expectedDNS 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#) ([]resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#, string) { |
| 153 | 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) |
| 154 | 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().()) |
| 155 | |
| 156 | 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().(2)) |
| 157 | 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().(HavePrefixscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HavePrefix().("veth")) |
| 158 | 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].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)) |
| 159 | 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].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().(BeEmptyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 160 | 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.[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().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().(expectedIfName)) |
| 161 | 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.[1].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().(expectedSandbox)) |
| 162 | |
| 163 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(r.DNSscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#DNS.).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().(expectedDNS)) |
| 164 | |
| 165 | // Grab IPs from container interface |
| 166 | ips := []resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#{} |
| 167 | for _, ipc := range r.IPsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/Result#IPs. { |
| 168 | if *ipc.Interfacescip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/IPConfig#Interface. == 1 { |
| 169 | ips = append(ips, resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#{ |
| 170 | ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip.: ipc.Addressscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/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().(), |
| 171 | gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw.: ipc.Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/040`/IPConfig#Gateway..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().(), |
| 172 | }) |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | return ips, r.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. |
| 177 | } |
| 178 | |
| 179 | // verifyResult minimally verifies the Result and returns the interface's IP addresses and MAC address |
| 180 | func (t *testerV04xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV04x#) verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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#, expectedIfName, expectedSandbox string, expectedDNS 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#) ([]resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#, string) { |
| 181 | return verify0403scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/verify0403().(result, expectedIfName, expectedSandbox, expectedDNS) |
| 182 | } |
| 183 | |
| 184 | // verifyResult minimally verifies the Result and returns the interface's IP addresses and MAC address |
| 185 | func (t *testerV03xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV03x#) verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV03x#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#, expectedIfName, expectedSandbox string, expectedDNS 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#) ([]resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#, string) { |
| 186 | return verify0403scip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/verify0403().(result, expectedIfName, expectedSandbox, expectedDNS) |
| 187 | } |
| 188 | |
| 189 | // verifyResult minimally verifies the Result and returns the interface's IP addresses and MAC address |
| 190 | func (t *testerV01xOr02xscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV01xOr02x#) verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/testerV01xOr02x#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, _ 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#) ([]resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#, string) { |
| 191 | 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) |
| 192 | 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().()) |
| 193 | |
| 194 | ips := []resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#{} |
| 195 | if r.IP4scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP4. != nil && 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. != nil { |
| 196 | ips = append(ips, resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#{ |
| 197 | ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip.: 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..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().(), |
| 198 | gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw.: r.IP4scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP4..Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/IPConfig#Gateway..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().(), |
| 199 | }) |
| 200 | } |
| 201 | if r.IP6scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP6. != nil && r.IP6scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP6..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. != nil { |
| 202 | ips = append(ips, resultIPscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#{ |
| 203 | ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip.: r.IP6scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP6..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..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().(), |
| 204 | gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw.: r.IP6scip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/Result#IP6..Gatewayscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types/020`/IPConfig#Gateway..Stringscip-go gomod github.com/golang/go/src go1.24.2 net/IP#String().(), |
| 205 | }) |
| 206 | } |
| 207 | |
| 208 | // 0.2 and earlier don't return MAC address |
| 209 | return ips, "" |
| 210 | } |
| 211 | |
| 212 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("ptp Operations", func() { |
| 213 | var originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:originalNS., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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# |
| 214 | var dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir. string |
| 215 | |
| 216 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 217 | // Create a new NetNS so we don't modify the host |
| 218 | var errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:err. error |
| 219 | originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:originalNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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().() |
| 220 | 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/ptp`/_:err.).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 221 | targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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().() |
| 222 | 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/ptp`/_: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().()) |
| 223 | |
| 224 | dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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().("", "ptp_test") |
| 225 | 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/ptp`/_: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().()) |
| 226 | }) |
| 227 | |
| 228 | AfterEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/AfterEach().(func() { |
| 229 | 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/ptp`/_: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().()) |
| 230 | 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/ptp`/_: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().()) |
| 231 | 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/ptp`/_: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().()) |
| 232 | 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/ptp`/_: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().()) |
| 233 | 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/ptp`/_: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().()) |
| 234 | }) |
| 235 | |
| 236 | doTest := func(confscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:conf., cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:cniVersion. string, numIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:numIPs. int, expectedDNSConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:expectedDNSConf. 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#, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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#) { |
| 237 | const IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:IFNAME. = "ptp0" |
| 238 | |
| 239 | 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#{ |
| 240 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 241 | 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/ptp`/_:targetNS..Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.(), |
| 242 | 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/ptp`/_:IFNAME., |
| 243 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(confscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:conf.), |
| 244 | } |
| 245 | |
| 246 | var resultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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# |
| 247 | |
| 248 | // Execute the plugin with the ADD command, creating the veth endpoints |
| 249 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 250 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 251 | |
| 252 | var errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:err. error |
| 253 | 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().(cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:cniVersion.) { |
| 254 | Byscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/By().("Doing a cni STATUS") |
| 255 | errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 256 | return cmdStatusscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/cmdStatus().(args) |
| 257 | }) |
| 258 | 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/ptp`/_: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().()) |
| 259 | } |
| 260 | |
| 261 | resultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:result., _, errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 262 | return cmdAddscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/cmdAdd().(args) |
| 263 | }) |
| 264 | 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/ptp`/_: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().()) |
| 265 | return nil |
| 266 | }) |
| 267 | 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().()) |
| 268 | |
| 269 | t := newTesterByVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/newTesterByVersion().(cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:cniVersion.) |
| 270 | ips, mac := t.verifyResultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/tester#verifyResult.(resultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:result., IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:IFNAME., targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS..Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.(), expectedDNSConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:expectedDNSConf.) |
| 271 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(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().(numIPsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:numIPs.)) |
| 272 | |
| 273 | // Make sure ptp link exists in the target namespace |
| 274 | // Then, ping the gateway |
| 275 | err = targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 276 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 277 | |
| 278 | 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/ptp`/_:IFNAME.) |
| 279 | 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().()) |
| 280 | if mac != "" { |
| 281 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(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().(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().())) |
| 282 | } |
| 283 | |
| 284 | for _, ipc := range ips { |
| 285 | fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Fprintlnscip-go gomod github.com/golang/go/src go1.24.2 fmt/Fprintln().(GinkgoWriterscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoWriter., "ping", ipc.ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip., "->", ipc.gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw.) |
| 286 | if err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.Pingscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/Ping().(ipc.ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip., ipc.gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw., 30); err != nil { |
| 287 | return 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().("ping %s -> %s failed: %s", ipc.ipscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#ip., ipc.gwscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/resultIP#gw., err) |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | return nil |
| 292 | }) |
| 293 | 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().()) |
| 294 | |
| 295 | // call CmdCheck |
| 296 | n := &Netscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#{} |
| 297 | 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(confscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:conf.), &n) |
| 298 | 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().()) |
| 299 | |
| 300 | n.IPAMscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/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(confscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:conf.), "") |
| 301 | 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().()) |
| 302 | |
| 303 | newConf, err := buildOneConfigscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/buildOneConfig().(n.Namescip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/Net#Name., cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:cniVersion., n, resultscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:result.) |
| 304 | 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().()) |
| 305 | |
| 306 | confString, 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) |
| 307 | 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().()) |
| 308 | |
| 309 | args.StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData. = confString |
| 310 | |
| 311 | // CNI Check host-device in the target namespace |
| 312 | err = originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 313 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 314 | 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 { return cmdCheckscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/cmdCheck().(args) }) |
| 315 | }) |
| 316 | 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().(cniVersionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:cniVersion.) { |
| 317 | 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().()) |
| 318 | } else { |
| 319 | 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().("config version does not allow CHECK")) |
| 320 | } |
| 321 | |
| 322 | args.StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData. = []byte(confscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:conf.) |
| 323 | |
| 324 | // Call the plugins with the DEL command, deleting the veth endpoints |
| 325 | err = originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 326 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 327 | |
| 328 | 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 { |
| 329 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/cmdDel().(args) |
| 330 | }) |
| 331 | 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().()) |
| 332 | return nil |
| 333 | }) |
| 334 | 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().()) |
| 335 | |
| 336 | // Make sure ptp link has been deleted |
| 337 | err = targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 338 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 339 | |
| 340 | 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/ptp`/_:IFNAME.) |
| 341 | 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().()) |
| 342 | 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().()) |
| 343 | return nil |
| 344 | }) |
| 345 | 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().()) |
| 346 | } |
| 347 | |
| 348 | 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. { |
| 349 | // Redefine ver inside for scope so real value is picked up by each dynamically defined It() |
| 350 | // See Gingkgo's "Patterns for dynamically generating tests" documentation. |
| 351 | ver := ver |
| 352 | |
| 353 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().(fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Sprintf().("[%s] configures and deconfigures a ptp link with ADD/DEL", ver), func() { |
| 354 | dnsConf := 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#{ |
| 355 | Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.: []string{"10.1.2.123"}, |
| 356 | Domainscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Domain.: "some.domain.test", |
| 357 | Searchscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Search.: []string{"search.test"}, |
| 358 | Optionsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Options.: []string{"option1:foo"}, |
| 359 | } |
| 360 | dnsConfBytes, 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().(dnsConf) |
| 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 | |
| 363 | 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().(`{ |
| 364 | "cniVersion": "%s", |
| 365 | "name": "mynet", |
| 366 | "type": "ptp", |
| 367 | "ipMasq": true, |
| 368 | "mtu": 5000, |
| 369 | "ipam": { |
| 370 | "type": "host-local", |
| 371 | "subnet": "10.1.2.0/24", |
| 372 | "dataDir": "%s" |
| 373 | }, |
| 374 | "dns": %s |
| 375 | }`, ver, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir., string(dnsConfBytes)) |
| 376 | |
| 377 | doTest(conf, ver, 1, dnsConf, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS.) |
| 378 | }) |
| 379 | |
| 380 | 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 ptp link when specifying ipMasqBackend: iptables", ver), func() { |
| 381 | dnsConf := 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#{ |
| 382 | Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.: []string{"10.1.2.123"}, |
| 383 | Domainscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Domain.: "some.domain.test", |
| 384 | Searchscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Search.: []string{"search.test"}, |
| 385 | Optionsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Options.: []string{"option1:foo"}, |
| 386 | } |
| 387 | dnsConfBytes, 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().(dnsConf) |
| 388 | 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().()) |
| 389 | |
| 390 | 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().(`{ |
| 391 | "cniVersion": "%s", |
| 392 | "name": "mynet", |
| 393 | "type": "ptp", |
| 394 | "ipMasq": true, |
| 395 | "ipMasqBackend": "iptables", |
| 396 | "mtu": 5000, |
| 397 | "ipam": { |
| 398 | "type": "host-local", |
| 399 | "subnet": "10.1.2.0/24", |
| 400 | "dataDir": "%s" |
| 401 | }, |
| 402 | "dns": %s |
| 403 | }`, ver, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir., string(dnsConfBytes)) |
| 404 | |
| 405 | doTest(conf, ver, 1, dnsConf, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS.) |
| 406 | }) |
| 407 | |
| 408 | 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 ptp link when specifying ipMasqBackend: nftables", ver), func() { |
| 409 | dnsConf := 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#{ |
| 410 | Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.: []string{"10.1.2.123"}, |
| 411 | Domainscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Domain.: "some.domain.test", |
| 412 | Searchscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Search.: []string{"search.test"}, |
| 413 | Optionsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Options.: []string{"option1:foo"}, |
| 414 | } |
| 415 | dnsConfBytes, 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().(dnsConf) |
| 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 | |
| 418 | 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().(`{ |
| 419 | "cniVersion": "%s", |
| 420 | "name": "mynet", |
| 421 | "type": "ptp", |
| 422 | "ipMasq": true, |
| 423 | "ipMasqBackend": "nftables", |
| 424 | "mtu": 5000, |
| 425 | "ipam": { |
| 426 | "type": "host-local", |
| 427 | "subnet": "10.1.2.0/24", |
| 428 | "dataDir": "%s" |
| 429 | }, |
| 430 | "dns": %s |
| 431 | }`, ver, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir., string(dnsConfBytes)) |
| 432 | |
| 433 | doTest(conf, ver, 1, dnsConf, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS.) |
| 434 | }) |
| 435 | |
| 436 | 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 dual-stack ptp link + routes with ADD/DEL", ver), func() { |
| 437 | 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().(`{ |
| 438 | "cniVersion": "%s", |
| 439 | "name": "mynet", |
| 440 | "type": "ptp", |
| 441 | "ipMasq": true, |
| 442 | "mtu": 5000, |
| 443 | "ipam": { |
| 444 | "type": "host-local", |
| 445 | "ranges": [ |
| 446 | [{ "subnet": "10.1.2.0/24"}], |
| 447 | [{ "subnet": "2001:db8:1::0/66"}] |
| 448 | ], |
| 449 | "routes": [ |
| 450 | { "dst": "0.0.0.0/0" }, |
| 451 | { "dst": "192.168.0.0/16" }, |
| 452 | { "dst": "1.2.3.4/32" } |
| 453 | ], |
| 454 | "dataDir": "%s" |
| 455 | } |
| 456 | }`, ver, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir.) |
| 457 | |
| 458 | doTest(conf, ver, 2, 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#{}, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS.) |
| 459 | }) |
| 460 | |
| 461 | 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] does not override IPAM DNS settings if no DNS settings provided", ver), func() { |
| 462 | ipamDNSConf := 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#{ |
| 463 | Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.: []string{"10.1.2.123"}, |
| 464 | Domainscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Domain.: "some.domain.test", |
| 465 | Searchscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Search.: []string{"search.test"}, |
| 466 | Optionsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Options.: []string{"option1:foo"}, |
| 467 | } |
| 468 | resolvConfPath, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.TmpResolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/TmpResolvConf().(ipamDNSConf) |
| 469 | 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().()) |
| 470 | defer 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().(resolvConfPath) |
| 471 | |
| 472 | 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().(`{ |
| 473 | "cniVersion": "%s", |
| 474 | "name": "mynet", |
| 475 | "type": "ptp", |
| 476 | "ipMasq": true, |
| 477 | "mtu": 5000, |
| 478 | "ipam": { |
| 479 | "type": "host-local", |
| 480 | "subnet": "10.1.2.0/24", |
| 481 | "resolvConf": "%s", |
| 482 | "dataDir": "%s" |
| 483 | } |
| 484 | }`, ver, resolvConfPath, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir.) |
| 485 | |
| 486 | doTest(conf, ver, 1, ipamDNSConf, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS.) |
| 487 | }) |
| 488 | |
| 489 | 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] overrides IPAM DNS settings if any DNS settings provided", ver), func() { |
| 490 | ipamDNSConf := 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#{ |
| 491 | Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.: []string{"10.1.2.123"}, |
| 492 | Domainscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Domain.: "some.domain.test", |
| 493 | Searchscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Search.: []string{"search.test"}, |
| 494 | Optionsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Options.: []string{"option1:foo"}, |
| 495 | } |
| 496 | resolvConfPath, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.TmpResolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/TmpResolvConf().(ipamDNSConf) |
| 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 | defer 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().(resolvConfPath) |
| 499 | |
| 500 | for _, ptpDNSConf := range []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#{ |
| 501 | { |
| 502 | Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.: []string{"10.1.2.234"}, |
| 503 | }, |
| 504 | { |
| 505 | Domainscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Domain.: "someother.domain.test", |
| 506 | }, |
| 507 | { |
| 508 | Searchscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Search.: []string{"search.elsewhere.test"}, |
| 509 | }, |
| 510 | { |
| 511 | Optionsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Options.: []string{"option2:bar"}, |
| 512 | }, |
| 513 | } { |
| 514 | dnsConfBytes, 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().(ptpDNSConf) |
| 515 | 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().()) |
| 516 | |
| 517 | 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().(`{ |
| 518 | "cniVersion": "%s", |
| 519 | "name": "mynet", |
| 520 | "type": "ptp", |
| 521 | "ipMasq": true, |
| 522 | "mtu": 5000, |
| 523 | "ipam": { |
| 524 | "type": "host-local", |
| 525 | "subnet": "10.1.2.0/24", |
| 526 | "resolvConf": "%s", |
| 527 | "dataDir": "%s" |
| 528 | }, |
| 529 | "dns": %s |
| 530 | }`, ver, resolvConfPath, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir., string(dnsConfBytes)) |
| 531 | |
| 532 | doTest(conf, ver, 1, ptpDNSConf, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS.) |
| 533 | } |
| 534 | }) |
| 535 | |
| 536 | 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] overrides IPAM DNS settings if any empty list DNS settings provided", ver), func() { |
| 537 | ipamDNSConf := 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#{ |
| 538 | Nameserversscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Nameservers.: []string{"10.1.2.123"}, |
| 539 | Domainscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Domain.: "some.domain.test", |
| 540 | Searchscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Search.: []string{"search.test"}, |
| 541 | Optionsscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/types`/DNS#Options.: []string{"option1:foo"}, |
| 542 | } |
| 543 | resolvConfPath, err := testutilsscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/.TmpResolvConfscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils`/TmpResolvConf().(ipamDNSConf) |
| 544 | 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().()) |
| 545 | defer 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().(resolvConfPath) |
| 546 | |
| 547 | 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().(`{ |
| 548 | "cniVersion": "%s", |
| 549 | "name": "mynet", |
| 550 | "type": "ptp", |
| 551 | "ipMasq": true, |
| 552 | "mtu": 5000, |
| 553 | "ipam": { |
| 554 | "type": "host-local", |
| 555 | "subnet": "10.1.2.0/24", |
| 556 | "dataDir": "%s", |
| 557 | "resolvConf": "%s" |
| 558 | }, |
| 559 | "dns": { |
| 560 | "nameservers": [], |
| 561 | "search": [], |
| 562 | "options": [] |
| 563 | } |
| 564 | }`, ver, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir., resolvConfPath) |
| 565 | |
| 566 | doTest(conf, ver, 1, 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#{}, targetNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:targetNS.) |
| 567 | }) |
| 568 | |
| 569 | 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 ptp link with DEL", ver), func() { |
| 570 | const IFNAMEscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:IFNAME. = "ptp0" |
| 571 | |
| 572 | 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().(`{ |
| 573 | "cniVersion": "%s", |
| 574 | "name": "mynet", |
| 575 | "type": "ptp", |
| 576 | "ipMasq": true, |
| 577 | "mtu": 5000, |
| 578 | "ipam": { |
| 579 | "type": "host-local", |
| 580 | "dataDir": "%s", |
| 581 | "subnet": "10.1.2.0/24" |
| 582 | } |
| 583 | }`, ver, dataDirscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_:dataDir.) |
| 584 | |
| 585 | 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#{ |
| 586 | ContainerIDscip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#ContainerID.: "dummy", |
| 587 | 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/ptp`/_:targetNS..Pathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/ns`/NetNS#Path.(), |
| 588 | 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/ptp`/_:IFNAME., |
| 589 | StdinDatascip-go gomod github.com/containernetworking/cni v1.3.0 `github.com/containernetworking/cni/pkg/skel`/CmdArgs#StdinData.: []byte(conf), |
| 590 | } |
| 591 | |
| 592 | // Call the plugins with the DEL command. It should not error even though the veth doesn't exist. |
| 593 | err := originalNSscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/_: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 { |
| 594 | defer GinkgoRecoverscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoRecover().() |
| 595 | |
| 596 | 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 { |
| 597 | return cmdDelscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/plugins/main/ptp`/cmdDel().(args) |
| 598 | }) |
| 599 | 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().()) |
| 600 | return nil |
| 601 | }) |
| 602 | 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().()) |
| 603 | }) |
| 604 | } |
| 605 | }) |