All `Ipvlan` related test on `DockerSuite` and `DockerNetworkSuite`
are migrated to `ipvlan_test.go`.
The end goal being to remove the `experimental` builds.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,340 +0,0 @@ |
| 1 |
-// +build !windows |
|
| 2 |
- |
|
| 3 |
-package main |
|
| 4 |
- |
|
| 5 |
-import ( |
|
| 6 |
- "strings" |
|
| 7 |
- "time" |
|
| 8 |
- |
|
| 9 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 10 |
- "github.com/docker/docker/integration-cli/cli" |
|
| 11 |
- "github.com/docker/docker/pkg/parsers/kernel" |
|
| 12 |
- "github.com/go-check/check" |
|
| 13 |
- "github.com/gotestyourself/gotestyourself/icmd" |
|
| 14 |
-) |
|
| 15 |
- |
|
| 16 |
-// ensure Kernel version is >= v3.9 for macvlan support |
|
| 17 |
-func macvlanKernelSupport() bool {
|
|
| 18 |
- return checkKernelMajorVersionGreaterOrEqualThen(3, 9) |
|
| 19 |
-} |
|
| 20 |
- |
|
| 21 |
-// ensure Kernel version is >= v4.2 for ipvlan support |
|
| 22 |
-func ipvlanKernelSupport() bool {
|
|
| 23 |
- return checkKernelMajorVersionGreaterOrEqualThen(4, 2) |
|
| 24 |
-} |
|
| 25 |
- |
|
| 26 |
-func checkKernelMajorVersionGreaterOrEqualThen(kernelVersion int, majorVersion int) bool {
|
|
| 27 |
- kv, err := kernel.GetKernelVersion() |
|
| 28 |
- if err != nil {
|
|
| 29 |
- return false |
|
| 30 |
- } |
|
| 31 |
- if kv.Kernel < kernelVersion || (kv.Kernel == kernelVersion && kv.Major < majorVersion) {
|
|
| 32 |
- return false |
|
| 33 |
- } |
|
| 34 |
- return true |
|
| 35 |
-} |
|
| 36 |
- |
|
| 37 |
-func (s *DockerNetworkSuite) TestDockerNetworkIpvlanPersistance(c *check.C) {
|
|
| 38 |
- // verify the driver automatically provisions the 802.1q link (di-dummy0.70) |
|
| 39 |
- testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon, SameHostDaemon) |
|
| 40 |
- // master dummy interface 'di' notation represent 'docker ipvlan' |
|
| 41 |
- master := "di-dummy0" |
|
| 42 |
- // simulate the master link the vlan tagged subinterface parent link will use |
|
| 43 |
- createMasterDummy(c, master) |
|
| 44 |
- // cleanup the master interface that also collects the slave dev |
|
| 45 |
- defer deleteInterface(c, master) |
|
| 46 |
- // create a network specifying the desired sub-interface name |
|
| 47 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "-o", "parent=di-dummy0.70", "di-persist") |
|
| 48 |
- assertNwIsAvailable(c, "di-persist") |
|
| 49 |
- // Restart docker daemon to test the config has persisted to disk |
|
| 50 |
- s.d.Restart(c) |
|
| 51 |
- // verify network is recreated from persistence |
|
| 52 |
- assertNwIsAvailable(c, "di-persist") |
|
| 53 |
-} |
|
| 54 |
- |
|
| 55 |
-func (s *DockerNetworkSuite) TestDockerNetworkIpvlanSubIntCreate(c *check.C) {
|
|
| 56 |
- // verify the driver automatically provisions the 802.1q link (di-dummy0.50) |
|
| 57 |
- testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon, SameHostDaemon) |
|
| 58 |
- // master dummy interface 'dm' abbreviation represents 'docker ipvlan' |
|
| 59 |
- master := "di-dummy0" |
|
| 60 |
- // simulate the master link the vlan tagged subinterface parent link will use |
|
| 61 |
- createMasterDummy(c, master) |
|
| 62 |
- // cleanup the master interface which also collects the slave dev |
|
| 63 |
- defer deleteInterface(c, master) |
|
| 64 |
- // create a network specifying the desired sub-interface name |
|
| 65 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "-o", "parent=di-dummy0.60", "di-subinterface") |
|
| 66 |
- assertNwIsAvailable(c, "di-subinterface") |
|
| 67 |
-} |
|
| 68 |
- |
|
| 69 |
-func (s *DockerNetworkSuite) TestDockerNetworkIpvlanOverlapParent(c *check.C) {
|
|
| 70 |
- // verify the same parent interface cannot be used if already in use by an existing network |
|
| 71 |
- testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon, SameHostDaemon) |
|
| 72 |
- // master dummy interface 'dm' abbreviation represents 'docker ipvlan' |
|
| 73 |
- master := "di-dummy0" |
|
| 74 |
- createMasterDummy(c, master) |
|
| 75 |
- // cleanup the master interface which also collects the slave dev |
|
| 76 |
- defer deleteInterface(c, master) |
|
| 77 |
- createVlanInterface(c, master, "di-dummy0.30", "30") |
|
| 78 |
- // create a network using an existing parent interface |
|
| 79 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "-o", "parent=di-dummy0.30", "di-subinterface") |
|
| 80 |
- assertNwIsAvailable(c, "di-subinterface") |
|
| 81 |
- // attempt to create another network using the same parent iface that should fail |
|
| 82 |
- out, _, err := dockerCmdWithError("network", "create", "--driver=ipvlan", "-o", "parent=di-dummy0.30", "di-parent-net-overlap")
|
|
| 83 |
- // verify that the overlap returns an error |
|
| 84 |
- c.Assert(err, check.NotNil, check.Commentf(out)) |
|
| 85 |
-} |
|
| 86 |
- |
|
| 87 |
-func (s *DockerNetworkSuite) TestDockerNetworkIpvlanL2MultiSubnet(c *check.C) {
|
|
| 88 |
- // create a dual stack multi-subnet Ipvlan L2 network and validate connectivity within the subnets, two on each subnet |
|
| 89 |
- testRequires(c, DaemonIsLinux, IPv6, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon) |
|
| 90 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "--ipv6", "--subnet=172.28.200.0/24", "--subnet=172.28.202.0/24", "--gateway=172.28.202.254", |
|
| 91 |
- "--subnet=2001:db8:abc8::/64", "--subnet=2001:db8:abc6::/64", "--gateway=2001:db8:abc6::254", "dualstackl2") |
|
| 92 |
- // Ensure the network was created |
|
| 93 |
- assertNwIsAvailable(c, "dualstackl2") |
|
| 94 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.200.0/24 and 2001:db8:abc8::/64 |
|
| 95 |
- dockerCmd(c, "run", "-d", "--net=dualstackl2", "--name=first", "--ip", "172.28.200.20", "--ip6", "2001:db8:abc8::20", "busybox:glibc", "top") |
|
| 96 |
- dockerCmd(c, "run", "-d", "--net=dualstackl2", "--name=second", "--ip", "172.28.200.21", "--ip6", "2001:db8:abc8::21", "busybox:glibc", "top") |
|
| 97 |
- |
|
| 98 |
- // Inspect and store the v4 address from specified container on the network dualstackl2 |
|
| 99 |
- ip := inspectField(c, "first", "NetworkSettings.Networks.dualstackl2.IPAddress") |
|
| 100 |
- // Inspect and store the v6 address from specified container on the network dualstackl2 |
|
| 101 |
- ip6 := inspectField(c, "first", "NetworkSettings.Networks.dualstackl2.GlobalIPv6Address") |
|
| 102 |
- |
|
| 103 |
- // verify ipv4 connectivity to the explicit --ipv address second to first |
|
| 104 |
- _, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", strings.TrimSpace(ip))
|
|
| 105 |
- c.Assert(err, check.IsNil) |
|
| 106 |
- // verify ipv6 connectivity to the explicit --ipv6 address second to first |
|
| 107 |
- _, _, err = dockerCmdWithError("exec", "second", "ping6", "-c", "1", strings.TrimSpace(ip6))
|
|
| 108 |
- c.Assert(err, check.IsNil) |
|
| 109 |
- |
|
| 110 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.202.0/24 and 2001:db8:abc6::/64 |
|
| 111 |
- dockerCmd(c, "run", "-d", "--net=dualstackl2", "--name=third", "--ip", "172.28.202.20", "--ip6", "2001:db8:abc6::20", "busybox:glibc", "top") |
|
| 112 |
- dockerCmd(c, "run", "-d", "--net=dualstackl2", "--name=fourth", "--ip", "172.28.202.21", "--ip6", "2001:db8:abc6::21", "busybox:glibc", "top") |
|
| 113 |
- |
|
| 114 |
- // Inspect and store the v4 address from specified container on the network dualstackl2 |
|
| 115 |
- ip = inspectField(c, "third", "NetworkSettings.Networks.dualstackl2.IPAddress") |
|
| 116 |
- // Inspect and store the v6 address from specified container on the network dualstackl2 |
|
| 117 |
- ip6 = inspectField(c, "third", "NetworkSettings.Networks.dualstackl2.GlobalIPv6Address") |
|
| 118 |
- |
|
| 119 |
- // verify ipv4 connectivity to the explicit --ipv address from third to fourth |
|
| 120 |
- _, _, err = dockerCmdWithError("exec", "fourth", "ping", "-c", "1", strings.TrimSpace(ip))
|
|
| 121 |
- c.Assert(err, check.IsNil) |
|
| 122 |
- // verify ipv6 connectivity to the explicit --ipv6 address from third to fourth |
|
| 123 |
- _, _, err = dockerCmdWithError("exec", "fourth", "ping6", "-c", "1", strings.TrimSpace(ip6))
|
|
| 124 |
- c.Assert(err, check.IsNil) |
|
| 125 |
- |
|
| 126 |
- // Inspect the v4 gateway to ensure the proper default GW was assigned |
|
| 127 |
- ip4gw := inspectField(c, "first", "NetworkSettings.Networks.dualstackl2.Gateway") |
|
| 128 |
- c.Assert(strings.TrimSpace(ip4gw), check.Equals, "172.28.200.1") |
|
| 129 |
- // Inspect the v6 gateway to ensure the proper default GW was assigned |
|
| 130 |
- ip6gw := inspectField(c, "first", "NetworkSettings.Networks.dualstackl2.IPv6Gateway") |
|
| 131 |
- c.Assert(strings.TrimSpace(ip6gw), check.Equals, "2001:db8:abc8::1") |
|
| 132 |
- |
|
| 133 |
- // Inspect the v4 gateway to ensure the proper explicitly assigned default GW was assigned |
|
| 134 |
- ip4gw = inspectField(c, "third", "NetworkSettings.Networks.dualstackl2.Gateway") |
|
| 135 |
- c.Assert(strings.TrimSpace(ip4gw), check.Equals, "172.28.202.254") |
|
| 136 |
- // Inspect the v6 gateway to ensure the proper explicitly assigned default GW was assigned |
|
| 137 |
- ip6gw = inspectField(c, "third", "NetworkSettings.Networks.dualstackl2.IPv6Gateway") |
|
| 138 |
- c.Assert(strings.TrimSpace(ip6gw), check.Equals, "2001:db8:abc6::254") |
|
| 139 |
-} |
|
| 140 |
- |
|
| 141 |
-func (s *DockerNetworkSuite) TestDockerNetworkIpvlanL3MultiSubnet(c *check.C) {
|
|
| 142 |
- // create a dual stack multi-subnet Ipvlan L3 network and validate connectivity between all four containers per L3 mode |
|
| 143 |
- testRequires(c, DaemonIsLinux, IPv6, ipvlanKernelSupport, NotUserNamespace, NotArm, IPv6, ExperimentalDaemon) |
|
| 144 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "--ipv6", "--subnet=172.28.10.0/24", "--subnet=172.28.12.0/24", "--gateway=172.28.12.254", |
|
| 145 |
- "--subnet=2001:db8:abc9::/64", "--subnet=2001:db8:abc7::/64", "--gateway=2001:db8:abc7::254", "-o", "ipvlan_mode=l3", "dualstackl3") |
|
| 146 |
- // Ensure the network was created |
|
| 147 |
- assertNwIsAvailable(c, "dualstackl3") |
|
| 148 |
- |
|
| 149 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.10.0/24 and 2001:db8:abc9::/64 |
|
| 150 |
- dockerCmd(c, "run", "-d", "--net=dualstackl3", "--name=first", "--ip", "172.28.10.20", "--ip6", "2001:db8:abc9::20", "busybox:glibc", "top") |
|
| 151 |
- dockerCmd(c, "run", "-d", "--net=dualstackl3", "--name=second", "--ip", "172.28.10.21", "--ip6", "2001:db8:abc9::21", "busybox:glibc", "top") |
|
| 152 |
- |
|
| 153 |
- // Inspect and store the v4 address from specified container on the network dualstackl3 |
|
| 154 |
- ip := inspectField(c, "first", "NetworkSettings.Networks.dualstackl3.IPAddress") |
|
| 155 |
- // Inspect and store the v6 address from specified container on the network dualstackl3 |
|
| 156 |
- ip6 := inspectField(c, "first", "NetworkSettings.Networks.dualstackl3.GlobalIPv6Address") |
|
| 157 |
- |
|
| 158 |
- // verify ipv4 connectivity to the explicit --ipv address second to first |
|
| 159 |
- _, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", strings.TrimSpace(ip))
|
|
| 160 |
- c.Assert(err, check.IsNil) |
|
| 161 |
- // verify ipv6 connectivity to the explicit --ipv6 address second to first |
|
| 162 |
- _, _, err = dockerCmdWithError("exec", "second", "ping6", "-c", "1", strings.TrimSpace(ip6))
|
|
| 163 |
- c.Assert(err, check.IsNil) |
|
| 164 |
- |
|
| 165 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.12.0/24 and 2001:db8:abc7::/64 |
|
| 166 |
- dockerCmd(c, "run", "-d", "--net=dualstackl3", "--name=third", "--ip", "172.28.12.20", "--ip6", "2001:db8:abc7::20", "busybox:glibc", "top") |
|
| 167 |
- dockerCmd(c, "run", "-d", "--net=dualstackl3", "--name=fourth", "--ip", "172.28.12.21", "--ip6", "2001:db8:abc7::21", "busybox:glibc", "top") |
|
| 168 |
- |
|
| 169 |
- // Inspect and store the v4 address from specified container on the network dualstackl3 |
|
| 170 |
- ip = inspectField(c, "third", "NetworkSettings.Networks.dualstackl3.IPAddress") |
|
| 171 |
- // Inspect and store the v6 address from specified container on the network dualstackl3 |
|
| 172 |
- ip6 = inspectField(c, "third", "NetworkSettings.Networks.dualstackl3.GlobalIPv6Address") |
|
| 173 |
- |
|
| 174 |
- // verify ipv4 connectivity to the explicit --ipv address from third to fourth |
|
| 175 |
- _, _, err = dockerCmdWithError("exec", "fourth", "ping", "-c", "1", strings.TrimSpace(ip))
|
|
| 176 |
- c.Assert(err, check.IsNil) |
|
| 177 |
- // verify ipv6 connectivity to the explicit --ipv6 address from third to fourth |
|
| 178 |
- _, _, err = dockerCmdWithError("exec", "fourth", "ping6", "-c", "1", strings.TrimSpace(ip6))
|
|
| 179 |
- c.Assert(err, check.IsNil) |
|
| 180 |
- |
|
| 181 |
- // Inspect and store the v4 address from specified container on the network dualstackl3 |
|
| 182 |
- ip = inspectField(c, "second", "NetworkSettings.Networks.dualstackl3.IPAddress") |
|
| 183 |
- // Inspect and store the v6 address from specified container on the network dualstackl3 |
|
| 184 |
- ip6 = inspectField(c, "second", "NetworkSettings.Networks.dualstackl3.GlobalIPv6Address") |
|
| 185 |
- |
|
| 186 |
- // Verify connectivity across disparate subnets which is unique to L3 mode only |
|
| 187 |
- _, _, err = dockerCmdWithError("exec", "third", "ping", "-c", "1", strings.TrimSpace(ip))
|
|
| 188 |
- c.Assert(err, check.IsNil) |
|
| 189 |
- _, _, err = dockerCmdWithError("exec", "third", "ping6", "-c", "1", strings.TrimSpace(ip6))
|
|
| 190 |
- c.Assert(err, check.IsNil) |
|
| 191 |
- |
|
| 192 |
- // Inspect the v4 gateway to ensure no next hop is assigned in L3 mode |
|
| 193 |
- ip4gw := inspectField(c, "first", "NetworkSettings.Networks.dualstackl3.Gateway") |
|
| 194 |
- c.Assert(strings.TrimSpace(ip4gw), check.Equals, "") |
|
| 195 |
- // Inspect the v6 gateway to ensure the explicitly specified default GW is ignored per L3 mode enabled |
|
| 196 |
- ip6gw := inspectField(c, "third", "NetworkSettings.Networks.dualstackl3.IPv6Gateway") |
|
| 197 |
- c.Assert(strings.TrimSpace(ip6gw), check.Equals, "") |
|
| 198 |
-} |
|
| 199 |
- |
|
| 200 |
-func (s *DockerNetworkSuite) TestDockerNetworkIpvlanAddressing(c *check.C) {
|
|
| 201 |
- // Ensure the default gateways, next-hops and default dev devices are properly set |
|
| 202 |
- testRequires(c, DaemonIsLinux, IPv6, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon) |
|
| 203 |
- dockerCmd(c, "network", "create", "--driver=macvlan", "--ipv6", "--subnet=172.28.130.0/24", |
|
| 204 |
- "--subnet=2001:db8:abca::/64", "--gateway=2001:db8:abca::254", "-o", "macvlan_mode=bridge", "dualstackbridge") |
|
| 205 |
- assertNwIsAvailable(c, "dualstackbridge") |
|
| 206 |
- dockerCmd(c, "run", "-d", "--net=dualstackbridge", "--name=first", "busybox", "top") |
|
| 207 |
- // Validate macvlan bridge mode defaults gateway sets the default IPAM next-hop inferred from the subnet |
|
| 208 |
- out, _, err := dockerCmdWithError("exec", "first", "ip", "route")
|
|
| 209 |
- c.Assert(err, check.IsNil) |
|
| 210 |
- c.Assert(out, checker.Contains, "default via 172.28.130.1 dev eth0") |
|
| 211 |
- // Validate macvlan bridge mode sets the v6 gateway to the user specified default gateway/next-hop |
|
| 212 |
- out, _, err = dockerCmdWithError("exec", "first", "ip", "-6", "route")
|
|
| 213 |
- c.Assert(err, check.IsNil) |
|
| 214 |
- c.Assert(out, checker.Contains, "default via 2001:db8:abca::254 dev eth0") |
|
| 215 |
- |
|
| 216 |
- // Verify ipvlan l2 mode sets the proper default gateway routes via netlink |
|
| 217 |
- // for either an explicitly set route by the user or inferred via default IPAM |
|
| 218 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "--ipv6", "--subnet=172.28.140.0/24", "--gateway=172.28.140.254", |
|
| 219 |
- "--subnet=2001:db8:abcb::/64", "-o", "ipvlan_mode=l2", "dualstackl2") |
|
| 220 |
- assertNwIsAvailable(c, "dualstackl2") |
|
| 221 |
- dockerCmd(c, "run", "-d", "--net=dualstackl2", "--name=second", "busybox", "top") |
|
| 222 |
- // Validate ipvlan l2 mode defaults gateway sets the default IPAM next-hop inferred from the subnet |
|
| 223 |
- out, _, err = dockerCmdWithError("exec", "second", "ip", "route")
|
|
| 224 |
- c.Assert(err, check.IsNil) |
|
| 225 |
- c.Assert(out, checker.Contains, "default via 172.28.140.254 dev eth0") |
|
| 226 |
- // Validate ipvlan l2 mode sets the v6 gateway to the user specified default gateway/next-hop |
|
| 227 |
- out, _, err = dockerCmdWithError("exec", "second", "ip", "-6", "route")
|
|
| 228 |
- c.Assert(err, check.IsNil) |
|
| 229 |
- c.Assert(out, checker.Contains, "default via 2001:db8:abcb::1 dev eth0") |
|
| 230 |
- |
|
| 231 |
- // Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops |
|
| 232 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "--ipv6", "--subnet=172.28.160.0/24", "--gateway=172.28.160.254", |
|
| 233 |
- "--subnet=2001:db8:abcd::/64", "--gateway=2001:db8:abcd::254", "-o", "ipvlan_mode=l3", "dualstackl3") |
|
| 234 |
- assertNwIsAvailable(c, "dualstackl3") |
|
| 235 |
- dockerCmd(c, "run", "-d", "--net=dualstackl3", "--name=third", "busybox", "top") |
|
| 236 |
- // Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops |
|
| 237 |
- out, _, err = dockerCmdWithError("exec", "third", "ip", "route")
|
|
| 238 |
- c.Assert(err, check.IsNil) |
|
| 239 |
- c.Assert(out, checker.Contains, "default dev eth0") |
|
| 240 |
- // Validate ipvlan l3 mode sets the v6 gateway to dev eth0 and disregards any explicit or inferred next-hops |
|
| 241 |
- out, _, err = dockerCmdWithError("exec", "third", "ip", "-6", "route")
|
|
| 242 |
- c.Assert(err, check.IsNil) |
|
| 243 |
- c.Assert(out, checker.Contains, "default dev eth0") |
|
| 244 |
-} |
|
| 245 |
- |
|
| 246 |
-func (s *DockerSuite) TestDockerNetworkIpvlanL2NilParent(c *check.C) {
|
|
| 247 |
- // ipvlan l2 mode - dummy parent interface is provisioned dynamically |
|
| 248 |
- testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon) |
|
| 249 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "di-nil-parent") |
|
| 250 |
- assertNwIsAvailable(c, "di-nil-parent") |
|
| 251 |
- |
|
| 252 |
- // start two containers on the same subnet |
|
| 253 |
- dockerCmd(c, "run", "-d", "--net=di-nil-parent", "--name=first", "busybox:glibc", "top") |
|
| 254 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 255 |
- dockerCmd(c, "run", "-d", "--net=di-nil-parent", "--name=second", "busybox:glibc", "top") |
|
| 256 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 257 |
- |
|
| 258 |
- // intra-network communications should succeed |
|
| 259 |
- _, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
|
| 260 |
- c.Assert(err, check.IsNil) |
|
| 261 |
-} |
|
| 262 |
- |
|
| 263 |
-func (s *DockerSuite) TestDockerNetworkIpvlanL2InternalMode(c *check.C) {
|
|
| 264 |
- // ipvlan l2 mode --internal containers can communicate inside the network but not externally |
|
| 265 |
- testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon) |
|
| 266 |
- cli.DockerCmd(c, "network", "create", "--driver=ipvlan", "--internal", "di-internal") |
|
| 267 |
- assertNwIsAvailable(c, "di-internal") |
|
| 268 |
- nr := getNetworkResource(c, "di-internal") |
|
| 269 |
- c.Assert(nr.Internal, checker.True) |
|
| 270 |
- |
|
| 271 |
- // start two containers on the same subnet |
|
| 272 |
- cli.DockerCmd(c, "run", "-d", "--net=di-internal", "--name=first", "busybox:glibc", "top") |
|
| 273 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 274 |
- cli.DockerCmd(c, "run", "-d", "--net=di-internal", "--name=second", "busybox:glibc", "top") |
|
| 275 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 276 |
- |
|
| 277 |
- // access outside of the network should fail |
|
| 278 |
- result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
|
|
| 279 |
- result.Assert(c, icmd.Expected{Timeout: true})
|
|
| 280 |
- // intra-network communications should succeed |
|
| 281 |
- cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first") |
|
| 282 |
-} |
|
| 283 |
- |
|
| 284 |
-func (s *DockerSuite) TestDockerNetworkIpvlanL3NilParent(c *check.C) {
|
|
| 285 |
- // ipvlan l3 mode - dummy parent interface is provisioned dynamically |
|
| 286 |
- testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon) |
|
| 287 |
- dockerCmd(c, "network", "create", "--driver=ipvlan", "--subnet=172.28.230.0/24", |
|
| 288 |
- "--subnet=172.28.220.0/24", "-o", "ipvlan_mode=l3", "di-nil-parent-l3") |
|
| 289 |
- assertNwIsAvailable(c, "di-nil-parent-l3") |
|
| 290 |
- |
|
| 291 |
- // start two containers on separate subnets |
|
| 292 |
- dockerCmd(c, "run", "-d", "--ip=172.28.220.10", "--net=di-nil-parent-l3", "--name=first", "busybox:glibc", "top") |
|
| 293 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 294 |
- dockerCmd(c, "run", "-d", "--ip=172.28.230.10", "--net=di-nil-parent-l3", "--name=second", "busybox:glibc", "top") |
|
| 295 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 296 |
- |
|
| 297 |
- // intra-network communications should succeed |
|
| 298 |
- _, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
|
| 299 |
- c.Assert(err, check.IsNil) |
|
| 300 |
-} |
|
| 301 |
- |
|
| 302 |
-func (s *DockerSuite) TestDockerNetworkIpvlanL3InternalMode(c *check.C) {
|
|
| 303 |
- // ipvlan l3 mode --internal containers can communicate inside the network but not externally |
|
| 304 |
- testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon) |
|
| 305 |
- cli.DockerCmd(c, "network", "create", "--driver=ipvlan", "--subnet=172.28.230.0/24", |
|
| 306 |
- "--subnet=172.28.220.0/24", "-o", "ipvlan_mode=l3", "--internal", "di-internal-l3") |
|
| 307 |
- assertNwIsAvailable(c, "di-internal-l3") |
|
| 308 |
- nr := getNetworkResource(c, "di-internal-l3") |
|
| 309 |
- c.Assert(nr.Internal, checker.True) |
|
| 310 |
- |
|
| 311 |
- // start two containers on separate subnets |
|
| 312 |
- cli.DockerCmd(c, "run", "-d", "--ip=172.28.220.10", "--net=di-internal-l3", "--name=first", "busybox:glibc", "top") |
|
| 313 |
- c.Assert(waitRun("first"), check.IsNil)
|
|
| 314 |
- cli.DockerCmd(c, "run", "-d", "--ip=172.28.230.10", "--net=di-internal-l3", "--name=second", "busybox:glibc", "top") |
|
| 315 |
- c.Assert(waitRun("second"), check.IsNil)
|
|
| 316 |
- |
|
| 317 |
- // access outside of the network should fail |
|
| 318 |
- result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
|
|
| 319 |
- result.Assert(c, icmd.Expected{Timeout: true})
|
|
| 320 |
- // intra-network communications should succeed |
|
| 321 |
- cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first") |
|
| 322 |
-} |
|
| 323 |
- |
|
| 324 |
-func createMasterDummy(c *check.C, master string) {
|
|
| 325 |
- // ip link add <dummy_name> type dummy |
|
| 326 |
- icmd.RunCommand("ip", "link", "add", master, "type", "dummy").Assert(c, icmd.Success)
|
|
| 327 |
- icmd.RunCommand("ip", "link", "set", master, "up").Assert(c, icmd.Success)
|
|
| 328 |
-} |
|
| 329 |
- |
|
| 330 |
-func createVlanInterface(c *check.C, master, slave, id string) {
|
|
| 331 |
- // ip link add link <master> name <master>.<VID> type vlan id <VID> |
|
| 332 |
- icmd.RunCommand("ip", "link", "add", "link", master, "name", slave, "type", "vlan", "id", id).Assert(c, icmd.Success)
|
|
| 333 |
- // ip link set <sub_interface_name> up |
|
| 334 |
- icmd.RunCommand("ip", "link", "set", slave, "up").Assert(c, icmd.Success)
|
|
| 335 |
-} |
|
| 336 |
- |
|
| 337 |
-func linkExists(c *check.C, master string) {
|
|
| 338 |
- // verify the specified link exists, ip link show <link_name> |
|
| 339 |
- icmd.RunCommand("ip", "link", "show", master).Assert(c, icmd.Success)
|
|
| 340 |
-} |
| ... | ... |
@@ -88,6 +88,9 @@ func WithBind(src, target string) func(*TestContainerConfig) {
|
| 88 | 88 |
// WithIPv4 sets the specified ip for the specified network of the container |
| 89 | 89 |
func WithIPv4(network, ip string) func(*TestContainerConfig) {
|
| 90 | 90 |
return func(c *TestContainerConfig) {
|
| 91 |
+ if c.NetworkingConfig.EndpointsConfig == nil {
|
|
| 92 |
+ c.NetworkingConfig.EndpointsConfig = map[string]*networktypes.EndpointSettings{}
|
|
| 93 |
+ } |
|
| 91 | 94 |
if v, ok := c.NetworkingConfig.EndpointsConfig[network]; !ok || v == nil {
|
| 92 | 95 |
c.NetworkingConfig.EndpointsConfig[network] = &networktypes.EndpointSettings{}
|
| 93 | 96 |
} |
| ... | ... |
@@ -101,6 +104,9 @@ func WithIPv4(network, ip string) func(*TestContainerConfig) {
|
| 101 | 101 |
// WithIPv6 sets the specified ip6 for the specified network of the container |
| 102 | 102 |
func WithIPv6(network, ip string) func(*TestContainerConfig) {
|
| 103 | 103 |
return func(c *TestContainerConfig) {
|
| 104 |
+ if c.NetworkingConfig.EndpointsConfig == nil {
|
|
| 105 |
+ c.NetworkingConfig.EndpointsConfig = map[string]*networktypes.EndpointSettings{}
|
|
| 106 |
+ } |
|
| 104 | 107 |
if v, ok := c.NetworkingConfig.EndpointsConfig[network]; !ok || v == nil {
|
| 105 | 108 |
c.NetworkingConfig.EndpointsConfig[network] = &networktypes.EndpointSettings{}
|
| 106 | 109 |
} |
| 107 | 110 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,543 @@ |
| 0 |
+package network |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "strings" |
|
| 4 |
+ "testing" |
|
| 5 |
+ "time" |
|
| 6 |
+ |
|
| 7 |
+ "github.com/docker/docker/api/types" |
|
| 8 |
+ "github.com/docker/docker/api/types/network" |
|
| 9 |
+ dclient "github.com/docker/docker/client" |
|
| 10 |
+ "github.com/docker/docker/integration-cli/daemon" |
|
| 11 |
+ "github.com/docker/docker/integration/internal/container" |
|
| 12 |
+ "github.com/gotestyourself/gotestyourself/assert" |
|
| 13 |
+ "github.com/gotestyourself/gotestyourself/skip" |
|
| 14 |
+ "golang.org/x/net/context" |
|
| 15 |
+) |
|
| 16 |
+ |
|
| 17 |
+func TestDockerNetworkIpvlanPersistance(t *testing.T) {
|
|
| 18 |
+ // verify the driver automatically provisions the 802.1q link (di-dummy0.70) |
|
| 19 |
+ skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
|
| 20 |
+ skip.If(t, testEnv.IsRemoteDaemon()) |
|
| 21 |
+ skip.If(t, !ipvlanKernelSupport(), "Kernel doesn't support ipvlan") |
|
| 22 |
+ |
|
| 23 |
+ d := daemon.New(t, "", "dockerd", daemon.Config{
|
|
| 24 |
+ Experimental: true, |
|
| 25 |
+ }) |
|
| 26 |
+ d.StartWithBusybox(t) |
|
| 27 |
+ defer d.Stop(t) |
|
| 28 |
+ |
|
| 29 |
+ // master dummy interface 'di' notation represent 'docker ipvlan' |
|
| 30 |
+ master := "di-dummy0" |
|
| 31 |
+ createMasterDummy(t, master) |
|
| 32 |
+ defer deleteInterface(t, master) |
|
| 33 |
+ |
|
| 34 |
+ client, err := d.NewClient() |
|
| 35 |
+ assert.NilError(t, err) |
|
| 36 |
+ |
|
| 37 |
+ // create a network specifying the desired sub-interface name |
|
| 38 |
+ _, err = client.NetworkCreate(context.Background(), "di-persist", types.NetworkCreate{
|
|
| 39 |
+ Driver: "ipvlan", |
|
| 40 |
+ Options: map[string]string{
|
|
| 41 |
+ "parent": "di-dummy0.70", |
|
| 42 |
+ }, |
|
| 43 |
+ }) |
|
| 44 |
+ assert.NilError(t, err) |
|
| 45 |
+ assert.Check(t, isNetworkAvailable(client, "di-persist")) |
|
| 46 |
+ // Restart docker daemon to test the config has persisted to disk |
|
| 47 |
+ d.Restart(t) |
|
| 48 |
+ assert.Check(t, isNetworkAvailable(client, "di-persist")) |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+func TestDockerNetworkIpvlan(t *testing.T) {
|
|
| 52 |
+ skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
|
| 53 |
+ skip.If(t, testEnv.IsRemoteDaemon()) |
|
| 54 |
+ skip.If(t, !ipvlanKernelSupport(), "Kernel doesn't support ipvlan") |
|
| 55 |
+ |
|
| 56 |
+ for _, tc := range []struct {
|
|
| 57 |
+ name string |
|
| 58 |
+ test func(dclient.APIClient) func(*testing.T) |
|
| 59 |
+ }{
|
|
| 60 |
+ {
|
|
| 61 |
+ name: "Subinterface", |
|
| 62 |
+ test: testIpvlanSubinterface, |
|
| 63 |
+ }, {
|
|
| 64 |
+ name: "OverlapParent", |
|
| 65 |
+ test: testIpvlanOverlapParent, |
|
| 66 |
+ }, {
|
|
| 67 |
+ name: "L2NilParent", |
|
| 68 |
+ test: testIpvlanL2NilParent, |
|
| 69 |
+ }, {
|
|
| 70 |
+ name: "L2InternalMode", |
|
| 71 |
+ test: testIpvlanL2InternalMode, |
|
| 72 |
+ }, {
|
|
| 73 |
+ name: "L3NilParent", |
|
| 74 |
+ test: testIpvlanL3NilParent, |
|
| 75 |
+ }, {
|
|
| 76 |
+ name: "L3InternalMode", |
|
| 77 |
+ test: testIpvlanL3InternalMode, |
|
| 78 |
+ }, {
|
|
| 79 |
+ name: "L2MultiSubnet", |
|
| 80 |
+ test: testIpvlanL2MultiSubnet, |
|
| 81 |
+ }, {
|
|
| 82 |
+ name: "L3MultiSubnet", |
|
| 83 |
+ test: testIpvlanL3MultiSubnet, |
|
| 84 |
+ }, {
|
|
| 85 |
+ name: "Addressing", |
|
| 86 |
+ test: testIpvlanAddressing, |
|
| 87 |
+ }, |
|
| 88 |
+ } {
|
|
| 89 |
+ d := daemon.New(t, "", "dockerd", daemon.Config{
|
|
| 90 |
+ Experimental: true, |
|
| 91 |
+ }) |
|
| 92 |
+ d.StartWithBusybox(t) |
|
| 93 |
+ |
|
| 94 |
+ client, err := d.NewClient() |
|
| 95 |
+ assert.NilError(t, err) |
|
| 96 |
+ |
|
| 97 |
+ t.Run(tc.name, tc.test(client)) |
|
| 98 |
+ |
|
| 99 |
+ d.Stop(t) |
|
| 100 |
+ // FIXME(vdemeester) clean network |
|
| 101 |
+ } |
|
| 102 |
+} |
|
| 103 |
+ |
|
| 104 |
+func testIpvlanSubinterface(client dclient.APIClient) func(*testing.T) {
|
|
| 105 |
+ return func(t *testing.T) {
|
|
| 106 |
+ master := "di-dummy0" |
|
| 107 |
+ createMasterDummy(t, master) |
|
| 108 |
+ defer deleteInterface(t, master) |
|
| 109 |
+ |
|
| 110 |
+ _, err := client.NetworkCreate(context.Background(), "di-subinterface", types.NetworkCreate{
|
|
| 111 |
+ Driver: "ipvlan", |
|
| 112 |
+ Options: map[string]string{
|
|
| 113 |
+ "parent": "di-dummy0.60", |
|
| 114 |
+ }, |
|
| 115 |
+ }) |
|
| 116 |
+ assert.NilError(t, err) |
|
| 117 |
+ assert.Check(t, isNetworkAvailable(client, "di-subinterface")) |
|
| 118 |
+ |
|
| 119 |
+ // delete the network while preserving the parent link |
|
| 120 |
+ err = client.NetworkRemove(context.Background(), "di-subinterface") |
|
| 121 |
+ assert.NilError(t, err) |
|
| 122 |
+ |
|
| 123 |
+ assert.Check(t, isNetworkNotAvailable(client, "di-subinterface")) |
|
| 124 |
+ // verify the network delete did not delete the predefined link |
|
| 125 |
+ linkExists(t, "di-dummy0") |
|
| 126 |
+ } |
|
| 127 |
+} |
|
| 128 |
+ |
|
| 129 |
+func testIpvlanOverlapParent(client dclient.APIClient) func(*testing.T) {
|
|
| 130 |
+ return func(t *testing.T) {
|
|
| 131 |
+ // verify the same parent interface cannot be used if already in use by an existing network |
|
| 132 |
+ master := "di-dummy0" |
|
| 133 |
+ createMasterDummy(t, master) |
|
| 134 |
+ defer deleteInterface(t, master) |
|
| 135 |
+ createVlanInterface(t, master, "di-dummy0.30", "30") |
|
| 136 |
+ |
|
| 137 |
+ _, err := client.NetworkCreate(context.Background(), "di-subinterface", types.NetworkCreate{
|
|
| 138 |
+ Driver: "ipvlan", |
|
| 139 |
+ Options: map[string]string{
|
|
| 140 |
+ "parent": "di-dummy0.30", |
|
| 141 |
+ }, |
|
| 142 |
+ }) |
|
| 143 |
+ assert.NilError(t, err) |
|
| 144 |
+ assert.Check(t, isNetworkAvailable(client, "di-subinterface")) |
|
| 145 |
+ |
|
| 146 |
+ _, err = client.NetworkCreate(context.Background(), "di-subinterface", types.NetworkCreate{
|
|
| 147 |
+ Driver: "ipvlan", |
|
| 148 |
+ Options: map[string]string{
|
|
| 149 |
+ "parent": "di-dummy0.30", |
|
| 150 |
+ }, |
|
| 151 |
+ }) |
|
| 152 |
+ // verify that the overlap returns an error |
|
| 153 |
+ assert.Check(t, err != nil) |
|
| 154 |
+ } |
|
| 155 |
+} |
|
| 156 |
+ |
|
| 157 |
+func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
|
|
| 158 |
+ return func(t *testing.T) {
|
|
| 159 |
+ // ipvlan l2 mode - dummy parent interface is provisioned dynamically |
|
| 160 |
+ _, err := client.NetworkCreate(context.Background(), "di-nil-parent", types.NetworkCreate{
|
|
| 161 |
+ Driver: "ipvlan", |
|
| 162 |
+ }) |
|
| 163 |
+ assert.NilError(t, err) |
|
| 164 |
+ assert.Check(t, isNetworkAvailable(client, "di-nil-parent")) |
|
| 165 |
+ |
|
| 166 |
+ ctx := context.Background() |
|
| 167 |
+ id1 := container.Run(t, ctx, client, container.WithNetworkMode("di-nil-parent"))
|
|
| 168 |
+ id2 := container.Run(t, ctx, client, container.WithNetworkMode("di-nil-parent"))
|
|
| 169 |
+ |
|
| 170 |
+ t.Log(time.Now()) |
|
| 171 |
+ |
|
| 172 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
|
|
| 173 |
+ assert.NilError(t, err) |
|
| 174 |
+ t.Log(time.Now()) |
|
| 175 |
+ } |
|
| 176 |
+} |
|
| 177 |
+ |
|
| 178 |
+func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
|
|
| 179 |
+ return func(t *testing.T) {
|
|
| 180 |
+ _, err := client.NetworkCreate(context.Background(), "di-internal", types.NetworkCreate{
|
|
| 181 |
+ Driver: "ipvlan", |
|
| 182 |
+ Internal: true, |
|
| 183 |
+ }) |
|
| 184 |
+ assert.NilError(t, err) |
|
| 185 |
+ assert.Check(t, isNetworkAvailable(client, "di-internal")) |
|
| 186 |
+ |
|
| 187 |
+ ctx := context.Background() |
|
| 188 |
+ id1 := container.Run(t, ctx, client, container.WithNetworkMode("di-internal"))
|
|
| 189 |
+ id2 := container.Run(t, ctx, client, container.WithNetworkMode("di-internal"))
|
|
| 190 |
+ |
|
| 191 |
+ timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second) |
|
| 192 |
+ defer cancel() |
|
| 193 |
+ _, err = container.Exec(timeoutCtx, client, id1, []string{"ping", "-c", "1", "-w", "1", "8.8.8.8"})
|
|
| 194 |
+ // FIXME(vdemeester) check the time of error ? |
|
| 195 |
+ assert.Check(t, err != nil) |
|
| 196 |
+ assert.Check(t, timeoutCtx.Err() == context.DeadlineExceeded) |
|
| 197 |
+ |
|
| 198 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
|
|
| 199 |
+ assert.NilError(t, err) |
|
| 200 |
+ } |
|
| 201 |
+} |
|
| 202 |
+ |
|
| 203 |
+func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
|
|
| 204 |
+ return func(t *testing.T) {
|
|
| 205 |
+ _, err := client.NetworkCreate(context.Background(), "di-nil-parent-l3", types.NetworkCreate{
|
|
| 206 |
+ Driver: "ipvlan", |
|
| 207 |
+ Options: map[string]string{
|
|
| 208 |
+ "ipvlan_mode": "l3", |
|
| 209 |
+ }, |
|
| 210 |
+ IPAM: &network.IPAM{
|
|
| 211 |
+ Config: []network.IPAMConfig{
|
|
| 212 |
+ {
|
|
| 213 |
+ Subnet: "172.28.230.0/24", |
|
| 214 |
+ AuxAddress: map[string]string{},
|
|
| 215 |
+ }, |
|
| 216 |
+ {
|
|
| 217 |
+ Subnet: "172.28.220.0/24", |
|
| 218 |
+ AuxAddress: map[string]string{},
|
|
| 219 |
+ }, |
|
| 220 |
+ }, |
|
| 221 |
+ }, |
|
| 222 |
+ }) |
|
| 223 |
+ assert.NilError(t, err) |
|
| 224 |
+ assert.Check(t, isNetworkAvailable(client, "di-nil-parent-l3")) |
|
| 225 |
+ |
|
| 226 |
+ ctx := context.Background() |
|
| 227 |
+ id1 := container.Run(t, ctx, client, |
|
| 228 |
+ container.WithNetworkMode("di-nil-parent-l3"),
|
|
| 229 |
+ container.WithIPv4("di-nil-parent-l3", "172.28.220.10"),
|
|
| 230 |
+ ) |
|
| 231 |
+ id2 := container.Run(t, ctx, client, |
|
| 232 |
+ container.WithNetworkMode("di-nil-parent-l3"),
|
|
| 233 |
+ container.WithIPv4("di-nil-parent-l3", "172.28.230.10"),
|
|
| 234 |
+ ) |
|
| 235 |
+ |
|
| 236 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
|
|
| 237 |
+ assert.NilError(t, err) |
|
| 238 |
+ } |
|
| 239 |
+} |
|
| 240 |
+ |
|
| 241 |
+func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
|
|
| 242 |
+ return func(t *testing.T) {
|
|
| 243 |
+ _, err := client.NetworkCreate(context.Background(), "di-internal-l3", types.NetworkCreate{
|
|
| 244 |
+ Driver: "ipvlan", |
|
| 245 |
+ Internal: true, |
|
| 246 |
+ Options: map[string]string{
|
|
| 247 |
+ "ipvlan_mode": "l3", |
|
| 248 |
+ }, |
|
| 249 |
+ IPAM: &network.IPAM{
|
|
| 250 |
+ Config: []network.IPAMConfig{
|
|
| 251 |
+ {
|
|
| 252 |
+ Subnet: "172.28.230.0/24", |
|
| 253 |
+ AuxAddress: map[string]string{},
|
|
| 254 |
+ }, |
|
| 255 |
+ {
|
|
| 256 |
+ Subnet: "172.28.220.0/24", |
|
| 257 |
+ AuxAddress: map[string]string{},
|
|
| 258 |
+ }, |
|
| 259 |
+ }, |
|
| 260 |
+ }, |
|
| 261 |
+ }) |
|
| 262 |
+ assert.NilError(t, err) |
|
| 263 |
+ assert.Check(t, isNetworkAvailable(client, "di-internal-l3")) |
|
| 264 |
+ |
|
| 265 |
+ ctx := context.Background() |
|
| 266 |
+ id1 := container.Run(t, ctx, client, |
|
| 267 |
+ container.WithNetworkMode("di-internal-l3"),
|
|
| 268 |
+ container.WithIPv4("di-internal-l3", "172.28.220.10"),
|
|
| 269 |
+ ) |
|
| 270 |
+ id2 := container.Run(t, ctx, client, |
|
| 271 |
+ container.WithNetworkMode("di-internal-l3"),
|
|
| 272 |
+ container.WithIPv4("di-internal-l3", "172.28.230.10"),
|
|
| 273 |
+ ) |
|
| 274 |
+ |
|
| 275 |
+ timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second) |
|
| 276 |
+ defer cancel() |
|
| 277 |
+ _, err = container.Exec(timeoutCtx, client, id1, []string{"ping", "-c", "1", "-w", "1", "8.8.8.8"})
|
|
| 278 |
+ // FIXME(vdemeester) check the time of error ? |
|
| 279 |
+ assert.Check(t, err != nil) |
|
| 280 |
+ assert.Check(t, timeoutCtx.Err() == context.DeadlineExceeded) |
|
| 281 |
+ |
|
| 282 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
|
|
| 283 |
+ assert.NilError(t, err) |
|
| 284 |
+ } |
|
| 285 |
+} |
|
| 286 |
+ |
|
| 287 |
+func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
| 288 |
+ return func(t *testing.T) {
|
|
| 289 |
+ _, err := client.NetworkCreate(context.Background(), "dualstackl2", types.NetworkCreate{
|
|
| 290 |
+ Driver: "ipvlan", |
|
| 291 |
+ EnableIPv6: true, |
|
| 292 |
+ IPAM: &network.IPAM{
|
|
| 293 |
+ Config: []network.IPAMConfig{
|
|
| 294 |
+ {
|
|
| 295 |
+ Subnet: "172.28.200.0/24", |
|
| 296 |
+ AuxAddress: map[string]string{},
|
|
| 297 |
+ }, |
|
| 298 |
+ {
|
|
| 299 |
+ Subnet: "172.28.202.0/24", |
|
| 300 |
+ Gateway: "172.28.202.254", |
|
| 301 |
+ AuxAddress: map[string]string{},
|
|
| 302 |
+ }, |
|
| 303 |
+ {
|
|
| 304 |
+ Subnet: "2001:db8:abc8::/64", |
|
| 305 |
+ AuxAddress: map[string]string{},
|
|
| 306 |
+ }, |
|
| 307 |
+ {
|
|
| 308 |
+ Subnet: "2001:db8:abc6::/64", |
|
| 309 |
+ Gateway: "2001:db8:abc6::254", |
|
| 310 |
+ AuxAddress: map[string]string{},
|
|
| 311 |
+ }, |
|
| 312 |
+ }, |
|
| 313 |
+ }, |
|
| 314 |
+ }) |
|
| 315 |
+ assert.NilError(t, err) |
|
| 316 |
+ assert.Check(t, isNetworkAvailable(client, "dualstackl2")) |
|
| 317 |
+ |
|
| 318 |
+ // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 319 |
+ ctx := context.Background() |
|
| 320 |
+ id1 := container.Run(t, ctx, client, |
|
| 321 |
+ container.WithNetworkMode("dualstackl2"),
|
|
| 322 |
+ container.WithIPv4("dualstackl2", "172.28.200.20"),
|
|
| 323 |
+ container.WithIPv6("dualstackl2", "2001:db8:abc8::20"),
|
|
| 324 |
+ ) |
|
| 325 |
+ id2 := container.Run(t, ctx, client, |
|
| 326 |
+ container.WithNetworkMode("dualstackl2"),
|
|
| 327 |
+ container.WithIPv4("dualstackl2", "172.28.200.21"),
|
|
| 328 |
+ container.WithIPv6("dualstackl2", "2001:db8:abc8::21"),
|
|
| 329 |
+ ) |
|
| 330 |
+ c1, err := client.ContainerInspect(ctx, id1) |
|
| 331 |
+ assert.NilError(t, err) |
|
| 332 |
+ |
|
| 333 |
+ // verify ipv4 connectivity to the explicit --ipv address second to first |
|
| 334 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping", "-c", "1", c1.NetworkSettings.Networks["dualstackl2"].IPAddress})
|
|
| 335 |
+ assert.NilError(t, err) |
|
| 336 |
+ // verify ipv6 connectivity to the explicit --ipv6 address second to first |
|
| 337 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping6", "-c", "1", c1.NetworkSettings.Networks["dualstackl2"].GlobalIPv6Address})
|
|
| 338 |
+ assert.NilError(t, err) |
|
| 339 |
+ |
|
| 340 |
+ // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 341 |
+ id3 := container.Run(t, ctx, client, |
|
| 342 |
+ container.WithNetworkMode("dualstackl2"),
|
|
| 343 |
+ container.WithIPv4("dualstackl2", "172.28.202.20"),
|
|
| 344 |
+ container.WithIPv6("dualstackl2", "2001:db8:abc6::20"),
|
|
| 345 |
+ ) |
|
| 346 |
+ id4 := container.Run(t, ctx, client, |
|
| 347 |
+ container.WithNetworkMode("dualstackl2"),
|
|
| 348 |
+ container.WithIPv4("dualstackl2", "172.28.202.21"),
|
|
| 349 |
+ container.WithIPv6("dualstackl2", "2001:db8:abc6::21"),
|
|
| 350 |
+ ) |
|
| 351 |
+ c3, err := client.ContainerInspect(ctx, id3) |
|
| 352 |
+ assert.NilError(t, err) |
|
| 353 |
+ |
|
| 354 |
+ // verify ipv4 connectivity to the explicit --ipv address from third to fourth |
|
| 355 |
+ _, err = container.Exec(ctx, client, id4, []string{"ping", "-c", "1", c3.NetworkSettings.Networks["dualstackl2"].IPAddress})
|
|
| 356 |
+ assert.NilError(t, err) |
|
| 357 |
+ // verify ipv6 connectivity to the explicit --ipv6 address from third to fourth |
|
| 358 |
+ _, err = container.Exec(ctx, client, id4, []string{"ping6", "-c", "1", c3.NetworkSettings.Networks["dualstackl2"].GlobalIPv6Address})
|
|
| 359 |
+ assert.NilError(t, err) |
|
| 360 |
+ |
|
| 361 |
+ // Inspect the v4 gateway to ensure the proper default GW was assigned |
|
| 362 |
+ assert.Equal(t, c1.NetworkSettings.Networks["dualstackl2"].Gateway, "172.28.200.1") |
|
| 363 |
+ // Inspect the v6 gateway to ensure the proper default GW was assigned |
|
| 364 |
+ assert.Equal(t, c1.NetworkSettings.Networks["dualstackl2"].IPv6Gateway, "2001:db8:abc8::1") |
|
| 365 |
+ // Inspect the v4 gateway to ensure the proper explicitly assigned default GW was assigned |
|
| 366 |
+ assert.Equal(t, c3.NetworkSettings.Networks["dualstackl2"].Gateway, "172.28.202.254") |
|
| 367 |
+ // Inspect the v6 gateway to ensure the proper explicitly assigned default GW was assigned |
|
| 368 |
+ assert.Equal(t, c3.NetworkSettings.Networks["dualstackl2"].IPv6Gateway, "2001:db8:abc6::254") |
|
| 369 |
+ } |
|
| 370 |
+} |
|
| 371 |
+ |
|
| 372 |
+func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
| 373 |
+ return func(t *testing.T) {
|
|
| 374 |
+ _, err := client.NetworkCreate(context.Background(), "dualstackl3", types.NetworkCreate{
|
|
| 375 |
+ Driver: "ipvlan", |
|
| 376 |
+ EnableIPv6: true, |
|
| 377 |
+ Options: map[string]string{
|
|
| 378 |
+ "ipvlan_mode": "l3", |
|
| 379 |
+ }, |
|
| 380 |
+ IPAM: &network.IPAM{
|
|
| 381 |
+ Config: []network.IPAMConfig{
|
|
| 382 |
+ {
|
|
| 383 |
+ Subnet: "172.28.10.0/24", |
|
| 384 |
+ AuxAddress: map[string]string{},
|
|
| 385 |
+ }, |
|
| 386 |
+ {
|
|
| 387 |
+ Subnet: "172.28.12.0/24", |
|
| 388 |
+ Gateway: "172.28.12.254", |
|
| 389 |
+ AuxAddress: map[string]string{},
|
|
| 390 |
+ }, |
|
| 391 |
+ {
|
|
| 392 |
+ Subnet: "2001:db8:abc9::/64", |
|
| 393 |
+ AuxAddress: map[string]string{},
|
|
| 394 |
+ }, |
|
| 395 |
+ {
|
|
| 396 |
+ Subnet: "2001:db8:abc7::/64", |
|
| 397 |
+ Gateway: "2001:db8:abc7::254", |
|
| 398 |
+ AuxAddress: map[string]string{},
|
|
| 399 |
+ }, |
|
| 400 |
+ }, |
|
| 401 |
+ }, |
|
| 402 |
+ }) |
|
| 403 |
+ assert.NilError(t, err) |
|
| 404 |
+ assert.Check(t, isNetworkAvailable(client, "dualstackl3")) |
|
| 405 |
+ |
|
| 406 |
+ // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 407 |
+ ctx := context.Background() |
|
| 408 |
+ id1 := container.Run(t, ctx, client, |
|
| 409 |
+ container.WithNetworkMode("dualstackl3"),
|
|
| 410 |
+ container.WithIPv4("dualstackl3", "172.28.10.20"),
|
|
| 411 |
+ container.WithIPv6("dualstackl3", "2001:db8:abc9::20"),
|
|
| 412 |
+ ) |
|
| 413 |
+ id2 := container.Run(t, ctx, client, |
|
| 414 |
+ container.WithNetworkMode("dualstackl3"),
|
|
| 415 |
+ container.WithIPv4("dualstackl3", "172.28.10.21"),
|
|
| 416 |
+ container.WithIPv6("dualstackl3", "2001:db8:abc9::21"),
|
|
| 417 |
+ ) |
|
| 418 |
+ c1, err := client.ContainerInspect(ctx, id1) |
|
| 419 |
+ assert.NilError(t, err) |
|
| 420 |
+ |
|
| 421 |
+ // verify ipv4 connectivity to the explicit --ipv address second to first |
|
| 422 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping", "-c", "1", c1.NetworkSettings.Networks["dualstackl3"].IPAddress})
|
|
| 423 |
+ assert.NilError(t, err) |
|
| 424 |
+ // verify ipv6 connectivity to the explicit --ipv6 address second to first |
|
| 425 |
+ _, err = container.Exec(ctx, client, id2, []string{"ping6", "-c", "1", c1.NetworkSettings.Networks["dualstackl3"].GlobalIPv6Address})
|
|
| 426 |
+ assert.NilError(t, err) |
|
| 427 |
+ |
|
| 428 |
+ // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 429 |
+ id3 := container.Run(t, ctx, client, |
|
| 430 |
+ container.WithNetworkMode("dualstackl3"),
|
|
| 431 |
+ container.WithIPv4("dualstackl3", "172.28.12.20"),
|
|
| 432 |
+ container.WithIPv6("dualstackl3", "2001:db8:abc7::20"),
|
|
| 433 |
+ ) |
|
| 434 |
+ id4 := container.Run(t, ctx, client, |
|
| 435 |
+ container.WithNetworkMode("dualstackl3"),
|
|
| 436 |
+ container.WithIPv4("dualstackl3", "172.28.12.21"),
|
|
| 437 |
+ container.WithIPv6("dualstackl3", "2001:db8:abc7::21"),
|
|
| 438 |
+ ) |
|
| 439 |
+ c3, err := client.ContainerInspect(ctx, id3) |
|
| 440 |
+ assert.NilError(t, err) |
|
| 441 |
+ |
|
| 442 |
+ // verify ipv4 connectivity to the explicit --ipv address from third to fourth |
|
| 443 |
+ _, err = container.Exec(ctx, client, id4, []string{"ping", "-c", "1", c3.NetworkSettings.Networks["dualstackl3"].IPAddress})
|
|
| 444 |
+ assert.NilError(t, err) |
|
| 445 |
+ // verify ipv6 connectivity to the explicit --ipv6 address from third to fourth |
|
| 446 |
+ _, err = container.Exec(ctx, client, id4, []string{"ping6", "-c", "1", c3.NetworkSettings.Networks["dualstackl3"].GlobalIPv6Address})
|
|
| 447 |
+ assert.NilError(t, err) |
|
| 448 |
+ |
|
| 449 |
+ // Inspect the v4 gateway to ensure no next hop is assigned in L3 mode |
|
| 450 |
+ assert.Equal(t, c1.NetworkSettings.Networks["dualstackl3"].Gateway, "") |
|
| 451 |
+ // Inspect the v6 gateway to ensure the explicitly specified default GW is ignored per L3 mode enabled |
|
| 452 |
+ assert.Equal(t, c1.NetworkSettings.Networks["dualstackl3"].IPv6Gateway, "") |
|
| 453 |
+ // Inspect the v4 gateway to ensure no next hop is assigned in L3 mode |
|
| 454 |
+ assert.Equal(t, c3.NetworkSettings.Networks["dualstackl3"].Gateway, "") |
|
| 455 |
+ // Inspect the v6 gateway to ensure the explicitly specified default GW is ignored per L3 mode enabled |
|
| 456 |
+ assert.Equal(t, c3.NetworkSettings.Networks["dualstackl3"].IPv6Gateway, "") |
|
| 457 |
+ } |
|
| 458 |
+} |
|
| 459 |
+ |
|
| 460 |
+func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
|
| 461 |
+ return func(t *testing.T) {
|
|
| 462 |
+ // Verify ipvlan l2 mode sets the proper default gateway routes via netlink |
|
| 463 |
+ // for either an explicitly set route by the user or inferred via default IPAM |
|
| 464 |
+ _, err := client.NetworkCreate(context.Background(), "dualstackl2", types.NetworkCreate{
|
|
| 465 |
+ Driver: "ipvlan", |
|
| 466 |
+ EnableIPv6: true, |
|
| 467 |
+ Options: map[string]string{
|
|
| 468 |
+ "ipvlan_mode": "l2", |
|
| 469 |
+ }, |
|
| 470 |
+ IPAM: &network.IPAM{
|
|
| 471 |
+ Config: []network.IPAMConfig{
|
|
| 472 |
+ {
|
|
| 473 |
+ Subnet: "172.28.140.0/24", |
|
| 474 |
+ Gateway: "172.28.140.254", |
|
| 475 |
+ AuxAddress: map[string]string{},
|
|
| 476 |
+ }, |
|
| 477 |
+ {
|
|
| 478 |
+ Subnet: "2001:db8:abcb::/64", |
|
| 479 |
+ AuxAddress: map[string]string{},
|
|
| 480 |
+ }, |
|
| 481 |
+ }, |
|
| 482 |
+ }, |
|
| 483 |
+ }) |
|
| 484 |
+ assert.NilError(t, err) |
|
| 485 |
+ assert.Check(t, isNetworkAvailable(client, "dualstackl2")) |
|
| 486 |
+ |
|
| 487 |
+ ctx := context.Background() |
|
| 488 |
+ id1 := container.Run(t, ctx, client, |
|
| 489 |
+ container.WithNetworkMode("dualstackl2"),
|
|
| 490 |
+ ) |
|
| 491 |
+ // Validate ipvlan l2 mode defaults gateway sets the default IPAM next-hop inferred from the subnet |
|
| 492 |
+ result, err := container.Exec(ctx, client, id1, []string{"ip", "route"})
|
|
| 493 |
+ assert.NilError(t, err) |
|
| 494 |
+ assert.Check(t, strings.Contains(result.Combined(), "default via 172.28.140.254 dev eth0")) |
|
| 495 |
+ // Validate ipvlan l2 mode sets the v6 gateway to the user specified default gateway/next-hop |
|
| 496 |
+ result, err = container.Exec(ctx, client, id1, []string{"ip", "-6", "route"})
|
|
| 497 |
+ assert.NilError(t, err) |
|
| 498 |
+ assert.Check(t, strings.Contains(result.Combined(), "default via 2001:db8:abcb::1 dev eth0")) |
|
| 499 |
+ |
|
| 500 |
+ // Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops |
|
| 501 |
+ _, err = client.NetworkCreate(context.Background(), "dualstackl3", types.NetworkCreate{
|
|
| 502 |
+ Driver: "ipvlan", |
|
| 503 |
+ EnableIPv6: true, |
|
| 504 |
+ Options: map[string]string{
|
|
| 505 |
+ "ipvlan_mode": "l3", |
|
| 506 |
+ }, |
|
| 507 |
+ IPAM: &network.IPAM{
|
|
| 508 |
+ Config: []network.IPAMConfig{
|
|
| 509 |
+ {
|
|
| 510 |
+ Subnet: "172.28.160.0/24", |
|
| 511 |
+ Gateway: "172.28.160.254", |
|
| 512 |
+ AuxAddress: map[string]string{},
|
|
| 513 |
+ }, |
|
| 514 |
+ {
|
|
| 515 |
+ Subnet: "2001:db8:abcd::/64", |
|
| 516 |
+ Gateway: "2001:db8:abcd::254", |
|
| 517 |
+ AuxAddress: map[string]string{},
|
|
| 518 |
+ }, |
|
| 519 |
+ }, |
|
| 520 |
+ }, |
|
| 521 |
+ }) |
|
| 522 |
+ assert.NilError(t, err) |
|
| 523 |
+ assert.Check(t, isNetworkAvailable(client, "dualstackl3")) |
|
| 524 |
+ |
|
| 525 |
+ id2 := container.Run(t, ctx, client, |
|
| 526 |
+ container.WithNetworkMode("dualstackl3"),
|
|
| 527 |
+ ) |
|
| 528 |
+ // Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops |
|
| 529 |
+ result, err = container.Exec(ctx, client, id2, []string{"ip", "route"})
|
|
| 530 |
+ assert.NilError(t, err) |
|
| 531 |
+ assert.Check(t, strings.Contains(result.Combined(), "default dev eth0")) |
|
| 532 |
+ // Validate ipvlan l3 mode sets the v6 gateway to dev eth0 and disregards any explicit or inferred next-hops |
|
| 533 |
+ result, err = container.Exec(ctx, client, id2, []string{"ip", "-6", "route"})
|
|
| 534 |
+ assert.NilError(t, err) |
|
| 535 |
+ assert.Check(t, strings.Contains(result.Combined(), "default dev eth0")) |
|
| 536 |
+ } |
|
| 537 |
+} |
|
| 538 |
+ |
|
| 539 |
+// ensure Kernel version is >= v4.2 for ipvlan support |
|
| 540 |
+func ipvlanKernelSupport() bool {
|
|
| 541 |
+ return checkKernelMajorVersionGreaterOrEqualThen(4, 2) |
|
| 542 |
+} |
| ... | ... |
@@ -3,6 +3,7 @@ package network |
| 3 | 3 |
import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"fmt" |
| 6 |
+ "strings" |
|
| 6 | 7 |
"testing" |
| 7 | 8 |
"time" |
| 8 | 9 |
|
| ... | ... |
@@ -163,6 +164,8 @@ func TestDockerNetworkMacvlanBridgeInternal(t *testing.T) {
|
| 163 | 163 |
client, err := d.NewClient() |
| 164 | 164 |
assert.NilError(t, err) |
| 165 | 165 |
|
| 166 |
+ t.Log(icmd.RunCommand("ip", "addr").Combined())
|
|
| 167 |
+ |
|
| 166 | 168 |
_, err = client.NetworkCreate(context.Background(), "dm-internal", types.NetworkCreate{
|
| 167 | 169 |
Driver: "macvlan", |
| 168 | 170 |
Internal: true, |
| ... | ... |
@@ -189,7 +192,7 @@ func TestDockerNetworkMacvlanMultiSubnet(t *testing.T) {
|
| 189 | 189 |
skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
| 190 | 190 |
skip.If(t, testEnv.IsRemoteDaemon()) |
| 191 | 191 |
skip.If(t, !macvlanKernelSupport(), "Kernel doesn't support macvlan") |
| 192 |
- t.Skip("Temporarily skipping while investigating sporadic v6 CI issues")
|
|
| 192 |
+ // t.Skip("Temporarily skipping while investigating sporadic v6 CI issues")
|
|
| 193 | 193 |
|
| 194 | 194 |
d := daemon.New(t) |
| 195 | 195 |
d.StartWithBusybox(t) |
| ... | ... |
@@ -283,6 +286,56 @@ func TestDockerNetworkMacvlanMultiSubnet(t *testing.T) {
|
| 283 | 283 |
assert.Equal(t, c3.NetworkSettings.Networks["dualstackbridge"].IPv6Gateway, "2001:db8.abc4::254") |
| 284 | 284 |
} |
| 285 | 285 |
|
| 286 |
+func TestDockerNetworkMacvlanAddressing(t *testing.T) {
|
|
| 287 |
+ // Ensure the default gateways, next-hops and default dev devices are properly set |
|
| 288 |
+ skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
|
| 289 |
+ skip.If(t, testEnv.IsRemoteDaemon()) |
|
| 290 |
+ skip.If(t, !macvlanKernelSupport(), "Kernel doesn't support macvlan") |
|
| 291 |
+ |
|
| 292 |
+ d := daemon.New(t, "", "dockerd", daemon.Config{})
|
|
| 293 |
+ d.StartWithBusybox(t) |
|
| 294 |
+ defer d.Stop(t) |
|
| 295 |
+ client, err := d.NewClient() |
|
| 296 |
+ assert.NilError(t, err) |
|
| 297 |
+ _, err = client.NetworkCreate(context.Background(), "dualstackbridge", types.NetworkCreate{
|
|
| 298 |
+ Driver: "macvlan", |
|
| 299 |
+ EnableIPv6: true, |
|
| 300 |
+ Options: map[string]string{
|
|
| 301 |
+ "macvlan_mode": "bridge", |
|
| 302 |
+ }, |
|
| 303 |
+ IPAM: &network.IPAM{
|
|
| 304 |
+ Config: []network.IPAMConfig{
|
|
| 305 |
+ {
|
|
| 306 |
+ Subnet: "172.28.130.0/24", |
|
| 307 |
+ AuxAddress: map[string]string{},
|
|
| 308 |
+ }, |
|
| 309 |
+ {
|
|
| 310 |
+ Subnet: "2001:db8:abca::/64", |
|
| 311 |
+ Gateway: "2001:db8:abca::254", |
|
| 312 |
+ AuxAddress: map[string]string{},
|
|
| 313 |
+ }, |
|
| 314 |
+ }, |
|
| 315 |
+ }, |
|
| 316 |
+ }) |
|
| 317 |
+ assert.NilError(t, err) |
|
| 318 |
+ assert.Check(t, isNetworkAvailable(client, "dualstackbridge")) |
|
| 319 |
+ |
|
| 320 |
+ ctx := context.Background() |
|
| 321 |
+ id1 := container.Run(t, ctx, client, |
|
| 322 |
+ container.WithNetworkMode("dualstackbridge"),
|
|
| 323 |
+ container.WithName(t.Name()+"first"), |
|
| 324 |
+ ) |
|
| 325 |
+ |
|
| 326 |
+ // Validate macvlan bridge mode defaults gateway sets the default IPAM next-hop inferred from the subnet |
|
| 327 |
+ result, err := container.Exec(ctx, client, id1, []string{"ip", "route"})
|
|
| 328 |
+ assert.NilError(t, err) |
|
| 329 |
+ assert.Check(t, strings.Contains(result.Combined(), "default via 172.28.130.1 dev eth0")) |
|
| 330 |
+ // Validate macvlan bridge mode sets the v6 gateway to the user specified default gateway/next-hop |
|
| 331 |
+ result, err = container.Exec(ctx, client, id1, []string{"ip", "-6", "route"})
|
|
| 332 |
+ assert.NilError(t, err) |
|
| 333 |
+ assert.Check(t, strings.Contains(result.Combined(), "default via 2001:db8:abca::254 dev eth0")) |
|
| 334 |
+} |
|
| 335 |
+ |
|
| 286 | 336 |
func isNetworkAvailable(c client.NetworkAPIClient, name string) cmp.Comparison {
|
| 287 | 337 |
return func() cmp.Result {
|
| 288 | 338 |
networks, err := c.NetworkList(context.Background(), types.NetworkListOptions{})
|