|
@@ -39,7 +39,7 @@ func TestDockerNetworkIpvlanPersistance(t *testing.T) {
|
|
|
|
|
|
// create a network specifying the desired sub-interface name
|
|
|
netName := "di-persist"
|
|
|
- net.CreateNoError(t, context.Background(), c, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, c, netName,
|
|
|
net.WithIPvlan("di-dummy0.70", ""),
|
|
|
)
|
|
|
|
|
@@ -105,7 +105,7 @@ func testIpvlanSubinterface(client dclient.APIClient) func(*testing.T) {
|
|
|
defer n.DeleteInterface(t, master)
|
|
|
|
|
|
netName := "di-subinterface"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan("di-dummy0.60", ""),
|
|
|
)
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netName))
|
|
@@ -130,7 +130,7 @@ func testIpvlanOverlapParent(client dclient.APIClient) func(*testing.T) {
|
|
|
n.CreateVlanInterface(t, master, parent, "30")
|
|
|
|
|
|
netName := "di-subinterface"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan(parent, ""),
|
|
|
)
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netName))
|
|
@@ -147,14 +147,14 @@ func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
|
|
|
return func(t *testing.T) {
|
|
|
// ipvlan l2 mode - dummy parent interface is provisioned dynamically
|
|
|
netName := "di-nil-parent"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan("", ""),
|
|
|
)
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netName))
|
|
|
|
|
|
ctx := context.Background()
|
|
|
- id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
|
|
|
- id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
|
|
|
+ id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
|
|
|
+ id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
|
|
|
|
|
|
_, err := container.Exec(ctx, client, id2, []string{"ping", "-c", "1", id1})
|
|
|
assert.NilError(t, err)
|
|
@@ -164,15 +164,15 @@ func testIpvlanL2NilParent(client dclient.APIClient) func(*testing.T) {
|
|
|
func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
|
|
|
return func(t *testing.T) {
|
|
|
netName := "di-internal"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan("", ""),
|
|
|
net.WithInternal(),
|
|
|
)
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netName))
|
|
|
|
|
|
ctx := context.Background()
|
|
|
- id1 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
|
|
|
- id2 := container.Run(t, ctx, client, container.WithNetworkMode(netName))
|
|
|
+ id1 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
|
|
|
+ id2 := container.Run(ctx, t, client, container.WithNetworkMode(netName))
|
|
|
|
|
|
timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
|
|
defer cancel()
|
|
@@ -189,7 +189,7 @@ func testIpvlanL2InternalMode(client dclient.APIClient) func(*testing.T) {
|
|
|
func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
|
|
|
return func(t *testing.T) {
|
|
|
netName := "di-nil-parent-l3"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan("", "l3"),
|
|
|
net.WithIPAM("172.28.230.0/24", ""),
|
|
|
net.WithIPAM("172.28.220.0/24", ""),
|
|
@@ -197,11 +197,11 @@ func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netName))
|
|
|
|
|
|
ctx := context.Background()
|
|
|
- id1 := container.Run(t, ctx, client,
|
|
|
+ id1 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.220.10"),
|
|
|
)
|
|
|
- id2 := container.Run(t, ctx, client,
|
|
|
+ id2 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.230.10"),
|
|
|
)
|
|
@@ -214,7 +214,7 @@ func testIpvlanL3NilParent(client dclient.APIClient) func(*testing.T) {
|
|
|
func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
|
|
|
return func(t *testing.T) {
|
|
|
netName := "di-internal-l3"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan("", "l3"),
|
|
|
net.WithInternal(),
|
|
|
net.WithIPAM("172.28.230.0/24", ""),
|
|
@@ -223,11 +223,11 @@ func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netName))
|
|
|
|
|
|
ctx := context.Background()
|
|
|
- id1 := container.Run(t, ctx, client,
|
|
|
+ id1 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.220.10"),
|
|
|
)
|
|
|
- id2 := container.Run(t, ctx, client,
|
|
|
+ id2 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.230.10"),
|
|
|
)
|
|
@@ -247,7 +247,7 @@ func testIpvlanL3InternalMode(client dclient.APIClient) func(*testing.T) {
|
|
|
func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
|
return func(t *testing.T) {
|
|
|
netName := "dualstackl2"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan("", ""),
|
|
|
net.WithIPv6(),
|
|
|
net.WithIPAM("172.28.200.0/24", ""),
|
|
@@ -259,12 +259,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
|
|
|
|
// 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
|
|
|
ctx := context.Background()
|
|
|
- id1 := container.Run(t, ctx, client,
|
|
|
+ id1 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.200.20"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc8::20"),
|
|
|
)
|
|
|
- id2 := container.Run(t, ctx, client,
|
|
|
+ id2 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.200.21"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc8::21"),
|
|
@@ -280,12 +280,12 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
|
assert.NilError(t, err)
|
|
|
|
|
|
// 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
|
|
|
- id3 := container.Run(t, ctx, client,
|
|
|
+ id3 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.202.20"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc6::20"),
|
|
|
)
|
|
|
- id4 := container.Run(t, ctx, client,
|
|
|
+ id4 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.202.21"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc6::21"),
|
|
@@ -314,7 +314,7 @@ func testIpvlanL2MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
|
func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
|
return func(t *testing.T) {
|
|
|
netName := "dualstackl3"
|
|
|
- net.CreateNoError(t, context.Background(), client, netName,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netName,
|
|
|
net.WithIPvlan("", "l3"),
|
|
|
net.WithIPv6(),
|
|
|
net.WithIPAM("172.28.10.0/24", ""),
|
|
@@ -326,12 +326,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
|
|
|
|
// 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
|
|
|
ctx := context.Background()
|
|
|
- id1 := container.Run(t, ctx, client,
|
|
|
+ id1 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.10.20"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc9::20"),
|
|
|
)
|
|
|
- id2 := container.Run(t, ctx, client,
|
|
|
+ id2 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.10.21"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc9::21"),
|
|
@@ -347,12 +347,12 @@ func testIpvlanL3MultiSubnet(client dclient.APIClient) func(*testing.T) {
|
|
|
assert.NilError(t, err)
|
|
|
|
|
|
// 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
|
|
|
- id3 := container.Run(t, ctx, client,
|
|
|
+ id3 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.12.20"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc7::20"),
|
|
|
)
|
|
|
- id4 := container.Run(t, ctx, client,
|
|
|
+ id4 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netName),
|
|
|
container.WithIPv4(netName, "172.28.12.21"),
|
|
|
container.WithIPv6(netName, "2001:db8:abc7::21"),
|
|
@@ -383,7 +383,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
|
|
// Verify ipvlan l2 mode sets the proper default gateway routes via netlink
|
|
|
// for either an explicitly set route by the user or inferred via default IPAM
|
|
|
netNameL2 := "dualstackl2"
|
|
|
- net.CreateNoError(t, context.Background(), client, netNameL2,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netNameL2,
|
|
|
net.WithIPvlan("", "l2"),
|
|
|
net.WithIPv6(),
|
|
|
net.WithIPAM("172.28.140.0/24", "172.28.140.254"),
|
|
@@ -392,7 +392,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netNameL2))
|
|
|
|
|
|
ctx := context.Background()
|
|
|
- id1 := container.Run(t, ctx, client,
|
|
|
+ id1 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netNameL2),
|
|
|
)
|
|
|
// Validate ipvlan l2 mode defaults gateway sets the default IPAM next-hop inferred from the subnet
|
|
@@ -406,7 +406,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
|
|
|
|
|
// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops
|
|
|
netNameL3 := "dualstackl3"
|
|
|
- net.CreateNoError(t, context.Background(), client, netNameL3,
|
|
|
+ net.CreateNoError(context.Background(), t, client, netNameL3,
|
|
|
net.WithIPvlan("", "l3"),
|
|
|
net.WithIPv6(),
|
|
|
net.WithIPAM("172.28.160.0/24", "172.28.160.254"),
|
|
@@ -414,7 +414,7 @@ func testIpvlanAddressing(client dclient.APIClient) func(*testing.T) {
|
|
|
)
|
|
|
assert.Check(t, n.IsNetworkAvailable(client, netNameL3))
|
|
|
|
|
|
- id2 := container.Run(t, ctx, client,
|
|
|
+ id2 := container.Run(ctx, t, client,
|
|
|
container.WithNetworkMode(netNameL3),
|
|
|
)
|
|
|
// Validate ipvlan l3 mode sets the v4 gateway to dev eth0 and disregards any explicit or inferred next-hops
|