Dan Williams [Tue, 22 Nov 2016 16:02:39 +0000 (10:02 -0600)]
testutils: pass netConf in for version operations; pass raw result out for tests
Gabe Rosenhouse [Mon, 23 Jan 2017 00:39:15 +0000 (16:39 -0800)]
skel: adds PluginMainWithError which returns a *types.Error
Enables plugins to do their own error-handling and cleanup logic
Dan Williams [Sat, 17 Dec 2016 00:56:39 +0000 (18:56 -0600)]
api,libcni: add network config list-based plugin chaining
Using a new ".configlist" file format that allows specifying
a list of CNI network configurations to run, add new libcni
helper functions to call each plugin in the list, injecting
the overall name, CNI version, and previous plugin's Result
structure into the configuration of the next plugin.
Dan Williams [Wed, 14 Dec 2016 23:09:01 +0000 (17:09 -0600)]
all: assert internal objects implement interfaces
Bryan Boreham [Thu, 17 Nov 2016 15:45:38 +0000 (15:45 +0000)]
Expand description of goroutine+netns problems
Casey Callendrello [Fri, 14 Oct 2016 14:38:32 +0000 (16:38 +0200)]
testing: test invocation of newer plugins with an older libcni
Gabe Rosenhouse [Mon, 17 Oct 2016 00:18:57 +0000 (17:18 -0700)]
skel tests: correct name of CNI_CONTAINERID in tests of env vars
Gabe Rosenhouse [Mon, 3 Oct 2016 04:43:51 +0000 (21:43 -0700)]
testing: adds basic test of backwards compatibility
Gabe Rosenhouse [Mon, 19 Sep 2016 20:14:02 +0000 (13:14 -0700)]
skel: use named constant for Incompatible CNI Version error code
Gabe Rosenhouse [Mon, 19 Sep 2016 20:00:49 +0000 (13:00 -0700)]
versioning: plugins require version match with config
infer version 0.1.0 when config is missing an explicit "cniVersion" field
Gabe Rosenhouse [Mon, 19 Sep 2016 04:56:17 +0000 (21:56 -0700)]
versioning: add basic version decode for network config
Gabe Rosenhouse [Wed, 7 Sep 2016 00:19:26 +0000 (20:19 -0400)]
skel: Plugins require a cniVersion in the NetConf
Gabe Rosenhouse [Tue, 6 Sep 2016 19:24:12 +0000 (15:24 -0400)]
versioning: revert spec version to 0.2.0
Gabe Rosenhouse [Tue, 6 Sep 2016 15:22:27 +0000 (11:22 -0400)]
versioning: misc cleanups
highlights:
- NetConf struct finally includes cniVersion field
- improve test coverage of current version report behavior
- godoc a few key functions
- allow tests to control version list reported by no-op plugin
Gabe Rosenhouse [Fri, 2 Sep 2016 20:39:01 +0000 (16:39 -0400)]
invoke: better name and unit test coverage for GetVersionInfo
Gabe Rosenhouse [Fri, 2 Sep 2016 20:01:22 +0000 (16:01 -0400)]
invoke: correctly infer version for 0.1.0-vintage plugins
Older plugins return a known error when issued the VERSION command.
Capture this error and report it as a 0.1.0 version plugin.
Gabe Rosenhouse [Wed, 24 Aug 2016 05:57:00 +0000 (22:57 -0700)]
versioning: adds tooling to compile a program against a given old CNI version
Allows us to write tests that cover interactions between components of
differing versions
Gabe Rosenhouse [Fri, 2 Sep 2016 17:12:14 +0000 (13:12 -0400)]
pkg/invoke: refactor plugin exec and backfill unit tests
Gabe Rosenhouse [Mon, 29 Aug 2016 23:20:18 +0000 (19:20 -0400)]
versioning: document meaning of 'Legacy' version support
Gabe Rosenhouse [Mon, 22 Aug 2016 06:48:04 +0000 (23:48 -0700)]
versioning: plugins report a list of supported versions
Further progress on versioning support (Issue #266).
Bump CNI spec version to 0.3.0
Gabe Rosenhouse [Thu, 1 Sep 2016 00:49:08 +0000 (20:49 -0400)]
Merge pull request #293 from rosenhouse/backfill-invoke-exec-tests
Backfill tests for plugin execution
Dan Williams [Wed, 31 Aug 2016 23:19:02 +0000 (18:19 -0500)]
Merge pull request #290 from asridharan/dcos
Fixed the check for network namespace path.
Avinash Sridharan [Wed, 24 Aug 2016 23:49:50 +0000 (23:49 +0000)]
pkg/ns: fixed the check for network namespace path.
The expectation on older kernels (< 3.19) was to have the network
namespace always be a directory. This is not true if the network
namespace is bind mounted to a file, and will make the plugin fail
erroneously in such cases. The fix is to remove this assumption
completely and just do a basic check on the file system types being
returned.
Fixes #288
Tom Denham [Mon, 29 Aug 2016 21:10:36 +0000 (14:10 -0700)]
pkg/ip: Ensure that SetupVeth returns correct hostVeth
The veth is moved from the container NS to the host NS.
This is handled by the code that sets the link to UP but the wrong
hostVeth is returned to the calling code.
Gabe Rosenhouse [Wed, 31 Aug 2016 03:52:47 +0000 (23:52 -0400)]
invoke: backfill tests for plugin execution
Tom Denham [Fri, 12 Aug 2016 22:06:22 +0000 (15:06 -0700)]
Merge pull request #267 from rosenhouse/version-cmd
Adds VERSION command
Prateek Gogia [Sun, 7 Aug 2016 19:24:56 +0000 (19:24 +0000)]
pkg/ip: Return correct error if container name provided exists, and test cases
If interface name for a container provided by a user is already present,
Veth creation fails with incorrect error.
If os.IsExist error is returned by makeVethPair:
* Check for peer name, if exists generate another random peer name,
* else, IsExist error is due to container interface present, return error.
Fixes #155
Stefan Junker [Mon, 1 Aug 2016 23:50:40 +0000 (16:50 -0700)]
pkg/utils/hwaddr tests: cover v4 in v6 addr
Stefan Junker [Wed, 29 Jun 2016 19:13:37 +0000 (12:13 -0700)]
pkg/ip link_test: ensure SetHWAddrByIP has an effect
Stefan Junker [Wed, 29 Jun 2016 19:13:05 +0000 (12:13 -0700)]
pkg/ip: use iface name in SetHWAddrByIP
Stefan Junker [Wed, 29 Jun 2016 02:52:08 +0000 (19:52 -0700)]
pkg/ip tests: cover SetupVeth and DelLinkByName*
Stefan Junker [Wed, 29 Jun 2016 00:46:17 +0000 (17:46 -0700)]
plugins: set MAC addresses based on IP
This will give deterministic MAC addresses for all interfaces CNI
creates and manages the IP for:
* bridge: container veth and host bridge
* macvlan: container veth
* ptp: container veth and host veth
Stefan Junker [Tue, 28 Jun 2016 19:51:58 +0000 (12:51 -0700)]
pkg/utils/hwaddr: migrate code from IPAM pkg
Stefan Junker [Tue, 21 Jun 2016 23:28:38 +0000 (16:28 -0700)]
pkg/ipam{,test}: improve error handling and tests
* _suite.go and _test.go file should be in the same package, using the
_test package for that, which requires some fields and methods to be
exported
* Introduce error type for cleaner error handling
* test adaptions for error type checking
Minhan Xia [Tue, 3 May 2016 22:47:28 +0000 (15:47 -0700)]
add tests for generateHardwardAddr
Minhan Xia [Tue, 3 May 2016 19:03:05 +0000 (12:03 -0700)]
configure mac address based on assigned ip
Gabe Rosenhouse [Thu, 14 Jul 2016 20:59:10 +0000 (13:59 -0700)]
plugins: adds new no-op plugin that may be used as a test-double
Plugin can be configured to record all inputs and to respond with
arbitrary stdout or error message. Will support upcoming integration
testing.
Gabe Rosenhouse [Thu, 14 Jul 2016 23:09:27 +0000 (16:09 -0700)]
misc: fix up copyright dates
Gabe Rosenhouse [Thu, 14 Jul 2016 03:50:54 +0000 (23:50 -0400)]
pkg/skel: plugins now respond to VERSION command
To support CNI spec versioning, plugins must be able to report version
information to container runtimes.
Gabe Rosenhouse [Thu, 14 Jul 2016 02:54:22 +0000 (22:54 -0400)]
pkg/skel: improve error message for missing CNI_COMMAND env var
This makes the error message for missing CNI_COMMAND consistent with
that of other required environment variables.
Gabe Rosenhouse [Thu, 14 Jul 2016 02:24:34 +0000 (22:24 -0400)]
pkg/skel: missing env var log lines appear in stderr
Previously, the log lines appeared in stdout before the JSON encoding of
the error message. That would break JSON parsing of stdout. Instead, we use
stderr for these unstructured logs, consistent with the CNI spec.
Gabe Rosenhouse [Thu, 14 Jul 2016 02:12:06 +0000 (22:12 -0400)]
pkg/skel: refactor to use dependency injection
Extract dependencies on os to enable more complete unit test coverage
Pengfei Ni [Tue, 14 Jun 2016 16:52:58 +0000 (00:52 +0800)]
pkg/ns: fix misspelling in comment
Stefan Junker [Mon, 6 Jun 2016 17:50:42 +0000 (19:50 +0200)]
pkg/types: cover string for unmarshal tests
Tom Denham [Wed, 1 Jun 2016 00:12:40 +0000 (17:12 -0700)]
pkg/types: Add UnmarshallableString type
Allow strings to be unmarshalled for CNI_ARGS
CNI_ARGS uses types.LoadArgs to populate a struct.
The fields in the struct must meet the TextUnmarshaler interface.
This code adds a UnmarshallableString type to assist with this.
Stefan Junker [Fri, 27 May 2016 09:52:44 +0000 (11:52 +0200)]
pkg/ns: introduce error types indicate NS verification
Stefan Junker [Fri, 27 May 2016 10:26:42 +0000 (12:26 +0200)]
skel/test: add case for empty NETNS
Stefan Junker [Fri, 27 May 2016 08:57:39 +0000 (10:57 +0200)]
plugins: don't require CNI_NETNS for DEL command
This will allow to free up the IPAM allocations when the caller doesn't
have access to the network namespace anymore, e.g. due to a reboot.
Stefan Junker [Fri, 27 May 2016 08:56:24 +0000 (10:56 +0200)]
pkg/skel: allow arg requriements specified by CMD
Stefan Junker [Wed, 25 May 2016 21:49:25 +0000 (23:49 +0200)]
pkg/ns: consider PROCFS during NS verification
This is an attempt to bring compatibility with Kernel <3.19, where NSFS
where PROCFS was used for network namespaces.
Stefan Junker [Tue, 24 May 2016 20:30:01 +0000 (22:30 +0200)]
pkg/ns: test IsNSFS()
Stefan Junker [Tue, 24 May 2016 20:21:57 +0000 (22:21 +0200)]
pkg/ns: test case for rejecting a non-ns nspath
Stefan Junker [Tue, 24 May 2016 16:16:34 +0000 (18:16 +0200)]
pkg/ns: verify netns when initialized with GetNS
Stefan Junker [Tue, 24 May 2016 18:48:12 +0000 (20:48 +0200)]
pkg/ns: add tests cases for Close()'d NS
Stefan Junker [Tue, 24 May 2016 18:27:18 +0000 (20:27 +0200)]
pkg/ns: don't allow operations after Close()
Dan Williams [Tue, 29 Mar 2016 22:45:46 +0000 (17:45 -0500)]
testutils: add e2e testing helper code
Dan Williams [Tue, 5 Apr 2016 16:10:31 +0000 (11:10 -0500)]
ns: add interface, use it, and fix thread-related namespace switch issues
Add a namespace object interface for somewhat cleaner code when
creating and switching between network namespaces. All created
namespaces are now mounted in /var/run/netns to ensure they
have persistent inodes and paths that can be passed around
between plugin components without relying on the current namespace
being correct.
Also remove the thread-locking arguments from the ns package
per https://github.com/appc/cni/issues/183 by doing all the namespace
changes in a separate goroutine that locks/unlocks itself, instead of
the caller having to track OS thread locking.
Stefan Junker [Thu, 19 May 2016 21:05:08 +0000 (23:05 +0200)]
Merge pull request #199 from dcbw/fix-bridge-tx-queue-length
bridge: leave TX queue length as kernel default, not 0
Michael Bridgen [Thu, 19 May 2016 12:21:40 +0000 (13:21 +0100)]
Merge pull request #200 from squaremo/simplify-readme
Simplify README preamble
Angus Lees [Fri, 13 May 2016 07:32:40 +0000 (17:32 +1000)]
pkg/ns: evaluate syscall number at compile-time
Previously this code used a run-time map lookup keyed by
runtime.GOOS/GOARCH. This version uses conditional compilation to make
this choice at compile time, giving immediate feedback for unsupported
platforms.
Angus Lees [Fri, 13 May 2016 07:18:39 +0000 (17:18 +1000)]
pkg/ns: use correct syscall number on arm
Stefan Junker [Wed, 4 May 2016 14:06:05 +0000 (16:06 +0200)]
*: appc/cni -> containernetworking/cni
The project has been moved so internally we simply rename everything.
Consumers are recommended to update their vendored version of cni.
Piotr Skamruk [Mon, 7 Mar 2016 15:40:27 +0000 (16:40 +0100)]
pkg/utils: add functions to work with sysctl
Gabe Rosenhouse [Mon, 18 Apr 2016 03:27:02 +0000 (20:27 -0700)]
Document use of goroutine and lockosthread in test helpers
Dan Williams [Wed, 6 Apr 2016 16:03:31 +0000 (11:03 -0500)]
ns: fix reading net namespace in multi-threaded processes
/proc/self/ns/net gives the main thread's namespace, not necessarily
the namespace of the thread that's running the testcases. This causes
sporadic failures of the tests.
For example, with a testcase reading inodes after switching netns:
/proc/27686/task/27689/ns/net
4026532565
/proc/self/ns/net
4026531969
/proc/27686/task/27689/ns/net
4026532565
See also:
https://github.com/vishvananda/netns/commit/
008d17ae001344769b031375bdb38a86219154c6
Running Suite: pkg/ns Suite
===========================
Random Seed:
1459953577
Will run 6 of 6 specs
• Failure [0.028 seconds]
Linux namespace operations
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:167
WithNetNS
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:166
executes the callback within the target network namespace [It]
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:97
Expected
<uint64>:
4026531969
to equal
<uint64>:
4026532565
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96
------------------------------
•••••
Summarizing 1 Failure:
[Fail] Linux namespace operations WithNetNS [It] executes the callback within the target network namespace
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96
Ran 6 of 6 Specs in 0.564 seconds
FAIL! -- 5 Passed | 1 Failed | 0 Pending | 0 Skipped --- FAIL: TestNs (0.56s)
FAIL
Gabe Rosenhouse [Mon, 18 Apr 2016 02:44:00 +0000 (19:44 -0700)]
Fix issues with MakeNetworkNS test helper
Gabe Rosenhouse [Mon, 18 Apr 2016 01:48:50 +0000 (18:48 -0700)]
Add basic unit tests of testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:35:49 +0000 (18:35 -0700)]
Extract inode inspection functions into testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:28:10 +0000 (18:28 -0700)]
Extract testhelpers from loopback test suite
Stefan Junker [Wed, 4 May 2016 14:06:05 +0000 (16:06 +0200)]
*: appc/cni -> containernetworking/cni
The project has been moved so internally we simply rename everything.
Consumers are recommended to update their vendored version of cni.
Stefan Junker [Fri, 22 Apr 2016 17:25:54 +0000 (19:25 +0200)]
Merge pull request #187 from appc/v0.3.0
merge unneeded branch v0.3.0 into master
Zach Gershman [Mon, 18 Apr 2016 17:45:46 +0000 (10:45 -0700)]
Merge pull request #182 from rosenhouse/document-lockosthread
Document use of goroutine and LockOSThread in test helpers
Dan Williams [Wed, 6 Apr 2016 16:03:31 +0000 (11:03 -0500)]
ns: fix reading net namespace in multi-threaded processes
/proc/self/ns/net gives the main thread's namespace, not necessarily
the namespace of the thread that's running the testcases. This causes
sporadic failures of the tests.
For example, with a testcase reading inodes after switching netns:
/proc/27686/task/27689/ns/net
4026532565
/proc/self/ns/net
4026531969
/proc/27686/task/27689/ns/net
4026532565
See also:
https://github.com/vishvananda/netns/commit/
008d17ae001344769b031375bdb38a86219154c6
Running Suite: pkg/ns Suite
===========================
Random Seed:
1459953577
Will run 6 of 6 specs
• Failure [0.028 seconds]
Linux namespace operations
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:167
WithNetNS
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:166
executes the callback within the target network namespace [It]
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:97
Expected
<uint64>:
4026531969
to equal
<uint64>:
4026532565
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96
------------------------------
•••••
Summarizing 1 Failure:
[Fail] Linux namespace operations WithNetNS [It] executes the callback within the target network namespace
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96
Ran 6 of 6 Specs in 0.564 seconds
FAIL! -- 5 Passed | 1 Failed | 0 Pending | 0 Skipped --- FAIL: TestNs (0.56s)
FAIL
Gabe Rosenhouse [Mon, 18 Apr 2016 03:27:02 +0000 (20:27 -0700)]
Document use of goroutine and lockosthread in test helpers
Gabe Rosenhouse [Mon, 18 Apr 2016 02:44:00 +0000 (19:44 -0700)]
Fix issues with MakeNetworkNS test helper
Gabe Rosenhouse [Mon, 18 Apr 2016 01:48:50 +0000 (18:48 -0700)]
Add basic unit tests of testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:35:49 +0000 (18:35 -0700)]
Extract inode inspection functions into testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:28:10 +0000 (18:28 -0700)]
Extract testhelpers from loopback test suite
Piotr Skamruk [Mon, 7 Mar 2016 15:40:27 +0000 (16:40 +0100)]
pkg/utils: add functions to work with sysctl
Jonathan Boulle [Fri, 1 Apr 2016 13:35:21 +0000 (15:35 +0200)]
*: add missing license headers + check
Stefan Junker [Thu, 31 Mar 2016 15:11:11 +0000 (17:11 +0200)]
pkg/utils: correct the test's expected chain names
Stefan Junker [Thu, 31 Mar 2016 13:44:54 +0000 (15:44 +0200)]
*: add comment to iptables rules for ipmasq
Stefan Junker [Thu, 31 Mar 2016 09:55:46 +0000 (11:55 +0200)]
pkg/utils: remove unneeded condition in tests
Stefan Junker [Thu, 31 Mar 2016 09:50:18 +0000 (11:50 +0200)]
pkg/utils: fix docstring
Stefan Junker [Thu, 31 Mar 2016 08:08:52 +0000 (10:08 +0200)]
pkg/utils: split and unexport constants
Stefan Junker [Wed, 30 Mar 2016 17:40:31 +0000 (19:40 +0200)]
pkg/utils: fix docstring
Stefan Junker [Wed, 30 Mar 2016 17:40:20 +0000 (19:40 +0200)]
pkg/utils: use constant for chain prefix
Stefan Junker [Wed, 30 Mar 2016 17:17:37 +0000 (19:17 +0200)]
pkg/utils: use name+id for hash and extend tests
Abhishek Chanda [Wed, 23 Mar 2016 00:16:59 +0000 (17:16 -0700)]
pkg: add a function to generate chain names
Adds a function to generate chain names for use in iptables and
ports all drivers to use that function. Also adds tests for the
said function.
Stefan Junker [Thu, 17 Mar 2016 13:09:54 +0000 (14:09 +0100)]
pkg/types: add tests for args
Stefan Junker [Thu, 17 Mar 2016 13:08:29 +0000 (14:08 +0100)]
pkg/types: add IgnoreUnknown arg and logic
This commit adds a struct type CommonArgs that is to be embedded in
every plugin's argument struct. It contains a field named
"IgnoreUnknown" which will be parsed as a boolean and can be provided to
ignore unknown arguments passed to the plugin.
Stefan Junker [Fri, 18 Mar 2016 21:28:14 +0000 (22:28 +0100)]
pkg/skel: add rudimentary unit tests
This is an attempt to testing the PluginMain() function of the skel pkg.
We should be able to do better by using a mockable interface for the
plugins, but this is a start.
Gabe Rosenhouse [Tue, 15 Mar 2016 15:37:00 +0000 (08:37 -0700)]
Update docstring on WithNetNS
Gabe Rosenhouse [Tue, 15 Mar 2016 01:57:16 +0000 (18:57 -0700)]
WithNetNS restores original namespace when callback errors
- adds test coverage of WithNetNS in BDD-style
Michael Bridgen [Wed, 2 Mar 2016 17:02:52 +0000 (17:02 +0000)]
Add invoke.Delegate{Add,Del} for use by meta-plugins
The 'flannel' meta plugin delegates to other plugins to do the actual
OS-level work. It used the ipam.Exec{Add,Del} procedures for this
delegation, since those do precisely what's needed.
However this is a bit misleading, since the flannel plugin _isn't_
doing this for IPAM, and the ipam.Exec* procedures aren't doing
something specific to IPAM plugins.
So: anticipating that there may be more meta plugins that want to
delegate in the same way, this commit moves generic delegation
procedures to `pkg/invoke`, and makes the `pkg/ipam` procedures (still
used, accurately, in the non-meta plugins) shims.
Stefan Junker [Wed, 2 Mar 2016 10:14:50 +0000 (11:14 +0100)]
Merge pull request #120 from zachgersh/find-better-error
Better error messages when plugin is not found
André Martins [Sun, 31 Jan 2016 03:18:33 +0000 (03:18 +0000)]
added the String method to Result type
Signed-off-by: André Martins <aanm90@gmail.com>
Zachary Gershman [Wed, 10 Feb 2016 21:42:10 +0000 (13:42 -0800)]
Better error message when plugin cannot be found
Stefan Junker [Wed, 27 Jan 2016 11:12:16 +0000 (12:12 +0100)]
*: reflect SPEC's DNS changes in implementation
* DNS is now a type which will result in a JSON dictionary in
configurations and results
* Minor refactoring, making use of type embedding
Alban Crequy [Tue, 26 Jan 2016 17:54:56 +0000 (18:54 +0100)]
*: add "dns" field to the configuration
appc/cni#76 added a "dns" field in the result JSON. But before this
patch, the plugins had no way of knowing which name server to return.
There could be two ways of knowing which name server to return:
1. add it as an extra argument ("CNI_ARGS")
2. add it in the network configuration as a convenience (received via
stdin)
I chose the second way because it is easier. In the case of rkt, it
means the user could just add the DNS name servers in
/etc/rkt/net.d/mynetwork.conf.