VersionDecoder: versionDecoder,
}
pluginPath = "/some/plugin/path"
- netconf = []byte(`{ "some": "stdin", "cniVersion": "0.3.0" }`)
+ netconf = []byte(`{ "some": "stdin", "cniVersion": "0.3.1" }`)
cniargs = &fakes.CNIArgs{}
cniargs.AsEnvCall.Returns.Env = []string{"SOME=ENV"}
})
"CNI_PATH=/some/bin/path",
"CNI_IFNAME=some-eth0",
}
- stdin = []byte(`{"some":"stdin-json", "cniVersion": "0.3.0"}`)
+ stdin = []byte(`{"some":"stdin-json", "cniVersion": "0.3.1"}`)
execer = &invoke.RawExec{}
})
Expect(err).NotTo(HaveOccurred())
Expect(stdout).To(MatchJSON(`{
- "cniVersion": "0.3.0",
+ "cniVersion": "0.3.1",
"supportedVersions": ["9.8.7"]
}`))
})
Expect(err).NotTo(HaveOccurred())
Expect(stdout).To(MatchJSON(`{
- "cniVersion": "0.3.0",
+ "cniVersion": "0.3.1",
"supportedVersions": ["9.8.7"]
}`))
})
"github.com/containernetworking/cni/pkg/types/020"
)
-const implementedSpecVersion string = "0.3.0"
+const implementedSpecVersion string = "0.3.1"
-var SupportedVersions = []string{implementedSpecVersion}
+var SupportedVersions = []string{"0.3.0", implementedSpecVersion}
func NewResult(data []byte) (types.Result, error) {
result := &Result{}
}
}
}
- return nil, fmt.Errorf("unsupported CNI result version %q", version)
+ return nil, fmt.Errorf("unsupported CNI result22 version %q", version)
}
// Result is what gets returned from the plugin (via stdout) to the caller
func (r *Result) GetAsVersion(version string) (types.Result, error) {
switch version {
- case implementedSpecVersion:
+ case "0.3.0", implementedSpecVersion:
return r, nil
case types020.SupportedVersions[0], types020.SupportedVersions[1], types020.SupportedVersions[2]:
return r.convertTo020()
}
- return nil, fmt.Errorf("cannot convert version 0.3.0 to %q", version)
+ return nil, fmt.Errorf("cannot convert version 0.3.x to %q", version)
}
func (r *Result) Print() error {
}
var _ = Describe("Current types operations", func() {
- It("correctly encodes a 0.3.0 Result", func() {
+ It("correctly encodes a 0.3.x Result", func() {
res := testResult()
Expect(res.String()).To(Equal("Interfaces:[{Name:eth0 Mac:00:11:22:33:44:55 Sandbox:/proc/3553/ns/net}], IP:[{Version:4 Interface:0 Address:{IP:1.2.3.30 Mask:ffffff00} Gateway:1.2.3.1} {Version:6 Interface:0 Address:{IP:abcd:1234:ffff::cdde Mask:ffffffffffffffff0000000000000000} Gateway:abcd:1234:ffff::1}], Routes:[{Dst:{IP:15.5.6.0 Mask:ffffff00} GW:15.5.6.8} {Dst:{IP:1111:dddd:: Mask:ffffffffffffffffffff000000000000} GW:1111:dddd::aaaa}], DNS:{Nameservers:[1.2.3.4 1::cafe] Domain:acompany.com Search:[somedomain.com otherdomain.net] Options:[foo bar]}"))
// Current reports the version of the CNI spec implemented by this library
func Current() string {
- return "0.3.0"
+ return "0.3.1"
}
// Legacy PluginInfo describes a plugin that is backwards compatible with the
// Any future CNI spec versions which meet this definition should be added to
// this list.
var Legacy = PluginSupports("0.1.0", "0.2.0")
-var All = PluginSupports("0.1.0", "0.2.0", "0.3.0")
+var All = PluginSupports("0.1.0", "0.2.0", "0.3.0", "0.3.1")
var resultFactories = []struct {
supportedVersions []string