mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #560 from mavenugo/adb
Flip the default for the flag AllowNonDefaultBridge in bridge driver
This commit is contained in:
commit
51699b91aa
12 changed files with 80 additions and 103 deletions
|
@ -291,9 +291,6 @@ func processCreateDefaults(c libnetwork.NetworkController, nc *networkCreate) {
|
||||||
if _, ok := gData["BridgeName"]; !ok {
|
if _, ok := gData["BridgeName"]; !ok {
|
||||||
gData["BridgeName"] = nc.Name
|
gData["BridgeName"] = nc.Name
|
||||||
}
|
}
|
||||||
if _, ok := gData["AllowNonDefaultBridge"]; !ok {
|
|
||||||
gData["AllowNonDefaultBridge"] = "true"
|
|
||||||
}
|
|
||||||
nc.Options[netlabel.GenericData] = genericData
|
nc.Options[netlabel.GenericData] = genericData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,7 @@ func createTestNetwork(t *testing.T, network string) (libnetwork.NetworkControll
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": network,
|
"BridgeName": network,
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
netGeneric := libnetwork.NetworkOptionGeneric(netOption)
|
netGeneric := libnetwork.NetworkOptionGeneric(netOption)
|
||||||
|
@ -212,10 +211,9 @@ func TestCreateDeleteNetwork(t *testing.T) {
|
||||||
ops := options.Generic{
|
ops := options.Generic{
|
||||||
netlabel.EnableIPv6: true,
|
netlabel.EnableIPv6: true,
|
||||||
netlabel.GenericData: map[string]string{
|
netlabel.GenericData: map[string]string{
|
||||||
"BridgeName": "abc",
|
"BridgeName": "abc",
|
||||||
"AllowNonDefaultBridge": "true",
|
"FixedCIDRv6": "fe80::1/64",
|
||||||
"FixedCIDRv6": "fe80::1/64",
|
"AddressIP": "172.28.30.254/24",
|
||||||
"AddressIP": "172.28.30.254/24",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
nc := networkCreate{Name: "network_1", NetworkType: bridgeNetType, Options: ops}
|
nc := networkCreate{Name: "network_1", NetworkType: bridgeNetType, Options: ops}
|
||||||
|
@ -259,8 +257,7 @@ func TestGetNetworksAndEndpoints(t *testing.T) {
|
||||||
|
|
||||||
ops := options.Generic{
|
ops := options.Generic{
|
||||||
netlabel.GenericData: map[string]string{
|
netlabel.GenericData: map[string]string{
|
||||||
"BridgeName": "api_test_nw",
|
"BridgeName": "api_test_nw",
|
||||||
"AllowNonDefaultBridge": "true",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,8 +528,7 @@ func TestProcGetServices(t *testing.T) {
|
||||||
netName1 := "production"
|
netName1 := "production"
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": netName1,
|
"BridgeName": netName1,
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
nw1, err := c.NewNetwork(bridgeNetType, netName1, libnetwork.NetworkOptionGeneric(netOption))
|
nw1, err := c.NewNetwork(bridgeNetType, netName1, libnetwork.NetworkOptionGeneric(netOption))
|
||||||
|
@ -543,8 +539,7 @@ func TestProcGetServices(t *testing.T) {
|
||||||
netName2 := "work-dev"
|
netName2 := "work-dev"
|
||||||
netOption = options.Generic{
|
netOption = options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": netName2,
|
"BridgeName": netName2,
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
nw2, err := c.NewNetwork(bridgeNetType, netName2, libnetwork.NetworkOptionGeneric(netOption))
|
nw2, err := c.NewNetwork(bridgeNetType, netName2, libnetwork.NetworkOptionGeneric(netOption))
|
||||||
|
@ -1781,14 +1776,13 @@ func TestEndToEnd(t *testing.T) {
|
||||||
ops := options.Generic{
|
ops := options.Generic{
|
||||||
netlabel.EnableIPv6: true,
|
netlabel.EnableIPv6: true,
|
||||||
netlabel.GenericData: map[string]string{
|
netlabel.GenericData: map[string]string{
|
||||||
"BridgeName": "cdef",
|
"BridgeName": "cdef",
|
||||||
"FixedCIDRv6": "fe80:2000::1/64",
|
"FixedCIDRv6": "fe80:2000::1/64",
|
||||||
"EnableIPv6": "true",
|
"EnableIPv6": "true",
|
||||||
"Mtu": "1460",
|
"Mtu": "1460",
|
||||||
"EnableIPTables": "true",
|
"EnableIPTables": "true",
|
||||||
"AddressIP": "172.28.30.254/16",
|
"AddressIP": "172.28.30.254/16",
|
||||||
"EnableUserlandProxy": "true",
|
"EnableUserlandProxy": "true",
|
||||||
"AllowNonDefaultBridge": "true",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,7 @@ func createDefaultNetwork(c libnetwork.NetworkController) {
|
||||||
// Bridge driver is special due to legacy reasons
|
// Bridge driver is special due to legacy reasons
|
||||||
if d == "bridge" {
|
if d == "bridge" {
|
||||||
genericOption[netlabel.GenericData] = map[string]interface{}{
|
genericOption[netlabel.GenericData] = map[string]interface{}{
|
||||||
"BridgeName": nw,
|
"BridgeName": nw,
|
||||||
"AllowNonDefaultBridge": "true",
|
|
||||||
}
|
}
|
||||||
networkOption := libnetwork.NetworkOptionGeneric(genericOption)
|
networkOption := libnetwork.NetworkOptionGeneric(genericOption)
|
||||||
createOptions = append(createOptions, networkOption)
|
createOptions = append(createOptions, networkOption)
|
||||||
|
|
|
@ -94,10 +94,9 @@ func (sb *sandbox) clearDefaultGW() error {
|
||||||
|
|
||||||
func (c *controller) createGWNetwork() (Network, error) {
|
func (c *controller) createGWNetwork() (Network, error) {
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
"BridgeName": libnGWNetwork,
|
"BridgeName": libnGWNetwork,
|
||||||
"EnableICC": false,
|
"EnableICC": false,
|
||||||
"AllowNonDefaultBridge": true,
|
"EnableIPMasquerade": true,
|
||||||
"EnableIPMasquerade": true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n, err := c.NewNetwork("bridge", libnGWNetwork,
|
n, err := c.NewNetwork("bridge", libnGWNetwork,
|
||||||
|
|
|
@ -59,7 +59,7 @@ type networkConfiguration struct {
|
||||||
DefaultGatewayIPv4 net.IP
|
DefaultGatewayIPv4 net.IP
|
||||||
DefaultGatewayIPv6 net.IP
|
DefaultGatewayIPv6 net.IP
|
||||||
DefaultBindingIP net.IP
|
DefaultBindingIP net.IP
|
||||||
AllowNonDefaultBridge bool
|
DisableBridgeCreation bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// endpointConfiguration represents the user specified configuration for the sandbox endpoint
|
// endpointConfiguration represents the user specified configuration for the sandbox endpoint
|
||||||
|
@ -249,13 +249,13 @@ func (c *networkConfiguration) fromMap(data map[string]interface{}) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if i, ok := data["AllowNonDefaultBridge"]; ok && i != nil {
|
if i, ok := data["DisableBridgeCreation"]; ok && i != nil {
|
||||||
if s, ok := i.(string); ok {
|
if s, ok := i.(string); ok {
|
||||||
if c.AllowNonDefaultBridge, err = strconv.ParseBool(s); err != nil {
|
if c.DisableBridgeCreation, err = strconv.ParseBool(s); err != nil {
|
||||||
return types.BadRequestErrorf("failed to parse AllowNonDefaultBridge value: %s", err.Error())
|
return types.BadRequestErrorf("failed to parse DisableBridgeCreation value: %s", err.Error())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return types.BadRequestErrorf("invalid type for AllowNonDefaultBridge value")
|
return types.BadRequestErrorf("invalid type for DisableBridgeCreation value")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ func TestCreateFail(t *testing.T) {
|
||||||
t.Fatalf("Failed to setup driver config: %v", err)
|
t.Fatalf("Failed to setup driver config: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
netconfig := &networkConfiguration{BridgeName: "dummy0"}
|
netconfig := &networkConfiguration{BridgeName: "dummy0", DisableBridgeCreation: true}
|
||||||
genericOption := make(map[string]interface{})
|
genericOption := make(map[string]interface{})
|
||||||
genericOption[netlabel.GenericData] = netconfig
|
genericOption[netlabel.GenericData] = netconfig
|
||||||
|
|
||||||
|
@ -146,20 +146,20 @@ func TestCreateMultipleNetworks(t *testing.T) {
|
||||||
t.Fatalf("Failed to setup driver config: %v", err)
|
t.Fatalf("Failed to setup driver config: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
config1 := &networkConfiguration{BridgeName: "net_test_1", AllowNonDefaultBridge: true}
|
config1 := &networkConfiguration{BridgeName: "net_test_1"}
|
||||||
genericOption = make(map[string]interface{})
|
genericOption = make(map[string]interface{})
|
||||||
genericOption[netlabel.GenericData] = config1
|
genericOption[netlabel.GenericData] = config1
|
||||||
if err := d.CreateNetwork("1", genericOption); err != nil {
|
if err := d.CreateNetwork("1", genericOption); err != nil {
|
||||||
t.Fatalf("Failed to create bridge: %v", err)
|
t.Fatalf("Failed to create bridge: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
config2 := &networkConfiguration{BridgeName: "net_test_2", AllowNonDefaultBridge: true}
|
config2 := &networkConfiguration{BridgeName: "net_test_2"}
|
||||||
genericOption[netlabel.GenericData] = config2
|
genericOption[netlabel.GenericData] = config2
|
||||||
if err := d.CreateNetwork("2", genericOption); err != nil {
|
if err := d.CreateNetwork("2", genericOption); err != nil {
|
||||||
t.Fatalf("Failed to create bridge: %v", err)
|
t.Fatalf("Failed to create bridge: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
config3 := &networkConfiguration{BridgeName: "net_test_3", AllowNonDefaultBridge: true}
|
config3 := &networkConfiguration{BridgeName: "net_test_3"}
|
||||||
genericOption[netlabel.GenericData] = config3
|
genericOption[netlabel.GenericData] = config3
|
||||||
if err := d.CreateNetwork("3", genericOption); err != nil {
|
if err := d.CreateNetwork("3", genericOption); err != nil {
|
||||||
t.Fatalf("Failed to create bridge: %v", err)
|
t.Fatalf("Failed to create bridge: %v", err)
|
||||||
|
@ -168,7 +168,7 @@ func TestCreateMultipleNetworks(t *testing.T) {
|
||||||
// Verify the network isolation rules are installed, each network subnet should appear 4 times
|
// Verify the network isolation rules are installed, each network subnet should appear 4 times
|
||||||
verifyV4INCEntries(d.networks, 4, t)
|
verifyV4INCEntries(d.networks, 4, t)
|
||||||
|
|
||||||
config4 := &networkConfiguration{BridgeName: "net_test_4", AllowNonDefaultBridge: true}
|
config4 := &networkConfiguration{BridgeName: "net_test_4"}
|
||||||
genericOption[netlabel.GenericData] = config4
|
genericOption[netlabel.GenericData] = config4
|
||||||
if err := d.CreateNetwork("4", genericOption); err != nil {
|
if err := d.CreateNetwork("4", genericOption); err != nil {
|
||||||
t.Fatalf("Failed to create bridge: %v", err)
|
t.Fatalf("Failed to create bridge: %v", err)
|
||||||
|
|
|
@ -211,6 +211,17 @@ func (ndbee NonDefaultBridgeExistError) Error() string {
|
||||||
// Forbidden denotes the type of this error
|
// Forbidden denotes the type of this error
|
||||||
func (ndbee NonDefaultBridgeExistError) Forbidden() {}
|
func (ndbee NonDefaultBridgeExistError) Forbidden() {}
|
||||||
|
|
||||||
|
// NonDefaultBridgeNeedsIPError is returned when a non-default
|
||||||
|
// bridge config is passed but it has no ip configured
|
||||||
|
type NonDefaultBridgeNeedsIPError string
|
||||||
|
|
||||||
|
func (ndbee NonDefaultBridgeNeedsIPError) Error() string {
|
||||||
|
return fmt.Sprintf("bridge device with non default name %s must have a valid IP address", string(ndbee))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forbidden denotes the type of this error
|
||||||
|
func (ndbee NonDefaultBridgeNeedsIPError) Forbidden() {}
|
||||||
|
|
||||||
// FixedCIDRv4Error is returned when fixed-cidrv4 configuration
|
// FixedCIDRv4Error is returned when fixed-cidrv4 configuration
|
||||||
// failed.
|
// failed.
|
||||||
type FixedCIDRv4Error struct {
|
type FixedCIDRv4Error struct {
|
||||||
|
|
|
@ -15,7 +15,7 @@ func setupDevice(config *networkConfiguration, i *bridgeInterface) error {
|
||||||
|
|
||||||
// We only attempt to create the bridge when the requested device name is
|
// We only attempt to create the bridge when the requested device name is
|
||||||
// the default one.
|
// the default one.
|
||||||
if config.BridgeName != DefaultBridgeName && !config.AllowNonDefaultBridge {
|
if config.BridgeName != DefaultBridgeName && config.DisableBridgeCreation {
|
||||||
return NonDefaultBridgeExistError(config.BridgeName)
|
return NonDefaultBridgeExistError(config.BridgeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ func TestSetupNewBridge(t *testing.T) {
|
||||||
func TestSetupNewNonDefaultBridge(t *testing.T) {
|
func TestSetupNewNonDefaultBridge(t *testing.T) {
|
||||||
defer testutils.SetupTestOSContext(t)()
|
defer testutils.SetupTestOSContext(t)()
|
||||||
|
|
||||||
config := &networkConfiguration{BridgeName: "test0"}
|
config := &networkConfiguration{BridgeName: "test0", DisableBridgeCreation: true}
|
||||||
br := &bridgeInterface{}
|
br := &bridgeInterface{}
|
||||||
|
|
||||||
err := setupDevice(config, br)
|
err := setupDevice(config, br)
|
||||||
|
|
|
@ -53,8 +53,8 @@ func setupBridgeIPv4(config *networkConfiguration, i *bridgeInterface) error {
|
||||||
|
|
||||||
// Do not try to configure IPv4 on a non-default bridge unless you are
|
// Do not try to configure IPv4 on a non-default bridge unless you are
|
||||||
// specifically asked to do so.
|
// specifically asked to do so.
|
||||||
if config.BridgeName != DefaultBridgeName && !config.AllowNonDefaultBridge {
|
if config.BridgeName != DefaultBridgeName && config.DisableBridgeCreation {
|
||||||
return NonDefaultBridgeExistError(config.BridgeName)
|
return NonDefaultBridgeNeedsIPError(config.BridgeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
bridgeIPv4, err := electBridgeIPv4(config)
|
bridgeIPv4, err := electBridgeIPv4(config)
|
||||||
|
|
|
@ -290,14 +290,13 @@ func TestBridge(t *testing.T) {
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AddressIPv4": subnet,
|
"AddressIPv4": subnet,
|
||||||
"FixedCIDR": cidr,
|
"FixedCIDR": cidr,
|
||||||
"FixedCIDRv6": cidrv6,
|
"FixedCIDRv6": cidrv6,
|
||||||
"EnableIPv6": true,
|
"EnableIPv6": true,
|
||||||
"EnableICC": true,
|
"EnableICC": true,
|
||||||
"AllowNonDefaultBridge": true,
|
"EnableIPMasquerade": true,
|
||||||
"EnableIPMasquerade": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,8 +390,7 @@ func TestNetworkName(t *testing.T) {
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,8 +426,7 @@ func TestNetworkType(t *testing.T) {
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,8 +452,7 @@ func TestNetworkID(t *testing.T) {
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,8 +477,8 @@ func TestDeleteNetworkWithActiveEndpoints(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true}
|
}
|
||||||
option := options.Generic{
|
option := options.Generic{
|
||||||
netlabel.GenericData: netOption,
|
netlabel.GenericData: netOption,
|
||||||
}
|
}
|
||||||
|
@ -522,8 +518,8 @@ func TestUnknownNetwork(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true}
|
}
|
||||||
option := options.Generic{
|
option := options.Generic{
|
||||||
netlabel.GenericData: netOption,
|
netlabel.GenericData: netOption,
|
||||||
}
|
}
|
||||||
|
@ -560,9 +556,9 @@ func TestUnknownEndpoint(t *testing.T) {
|
||||||
subnet.IP = ip
|
subnet.IP = ip
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AddressIPv4": subnet,
|
"AddressIPv4": subnet,
|
||||||
"AllowNonDefaultBridge": true}
|
}
|
||||||
option := options.Generic{
|
option := options.Generic{
|
||||||
netlabel.GenericData: netOption,
|
netlabel.GenericData: netOption,
|
||||||
}
|
}
|
||||||
|
@ -604,8 +600,7 @@ func TestNetworkEndpointsWalkers(t *testing.T) {
|
||||||
// Create network 1 and add 2 endpoint: ep11, ep12
|
// Create network 1 and add 2 endpoint: ep11, ep12
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "network1",
|
"BridgeName": "network1",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,8 +672,7 @@ func TestNetworkEndpointsWalkers(t *testing.T) {
|
||||||
// Create network 2
|
// Create network 2
|
||||||
netOption = options.Generic{
|
netOption = options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "network2",
|
"BridgeName": "network2",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,8 +729,7 @@ func TestDuplicateEndpoint(t *testing.T) {
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
n, err := createTestNetwork(bridgeNetType, "testnetwork", netOption)
|
n, err := createTestNetwork(bridgeNetType, "testnetwork", netOption)
|
||||||
|
@ -786,8 +779,7 @@ func TestControllerQuery(t *testing.T) {
|
||||||
// Create network 1
|
// Create network 1
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "network1",
|
"BridgeName": "network1",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
net1, err := createTestNetwork(bridgeNetType, "network1", netOption)
|
net1, err := createTestNetwork(bridgeNetType, "network1", netOption)
|
||||||
|
@ -803,8 +795,7 @@ func TestControllerQuery(t *testing.T) {
|
||||||
// Create network 2
|
// Create network 2
|
||||||
netOption = options.Generic{
|
netOption = options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "network2",
|
"BridgeName": "network2",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
net2, err := createTestNetwork(bridgeNetType, "network2", netOption)
|
net2, err := createTestNetwork(bridgeNetType, "network2", netOption)
|
||||||
|
@ -890,8 +881,7 @@ func TestNetworkQuery(t *testing.T) {
|
||||||
// Create network 1 and add 2 endpoint: ep11, ep12
|
// Create network 1 and add 2 endpoint: ep11, ep12
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "network1",
|
"BridgeName": "network1",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
net1, err := createTestNetwork(bridgeNetType, "network1", netOption)
|
net1, err := createTestNetwork(bridgeNetType, "network1", netOption)
|
||||||
|
@ -1012,8 +1002,7 @@ func TestEndpointJoin(t *testing.T) {
|
||||||
// Create network 1 and add 2 endpoint: ep11, ep12
|
// Create network 1 and add 2 endpoint: ep11, ep12
|
||||||
n1, err := createTestNetwork(bridgeNetType, "testnetwork1", options.Generic{
|
n1, err := createTestNetwork(bridgeNetType, "testnetwork1", options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork1",
|
"BridgeName": "testnetwork1",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1123,8 +1112,7 @@ func TestEndpointJoin(t *testing.T) {
|
||||||
n2, err := createTestNetwork(bridgeNetType, "testnetwork2",
|
n2, err := createTestNetwork(bridgeNetType, "testnetwork2",
|
||||||
options.Generic{
|
options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork2",
|
"BridgeName": "testnetwork2",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1215,8 +1203,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
|
||||||
|
|
||||||
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1365,8 +1352,7 @@ func TestEndpointDeleteWithActiveContainer(t *testing.T) {
|
||||||
|
|
||||||
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1429,8 +1415,7 @@ func TestEndpointMultipleJoins(t *testing.T) {
|
||||||
|
|
||||||
n, err := createTestNetwork(bridgeNetType, "testmultiple", options.Generic{
|
n, err := createTestNetwork(bridgeNetType, "testmultiple", options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testmultiple",
|
"BridgeName": "testmultiple",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1501,8 +1486,7 @@ func TestLeaveAll(t *testing.T) {
|
||||||
|
|
||||||
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1565,8 +1549,7 @@ func TestontainerInvalidLeave(t *testing.T) {
|
||||||
|
|
||||||
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
n, err := createTestNetwork(bridgeNetType, "testnetwork", options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1632,8 +1615,7 @@ func TestEndpointUpdateParent(t *testing.T) {
|
||||||
|
|
||||||
n, err := createTestNetwork("bridge", "testnetwork", options.Generic{
|
n, err := createTestNetwork("bridge", "testnetwork", options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1738,9 +1720,8 @@ func TestEnableIPv6(t *testing.T) {
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.EnableIPv6: true,
|
netlabel.EnableIPv6: true,
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"FixedCIDRv6": cidrv6,
|
"FixedCIDRv6": cidrv6,
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1911,8 +1892,7 @@ func TestResolvConf(t *testing.T) {
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "testnetwork",
|
"BridgeName": "testnetwork",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
n, err := createTestNetwork("bridge", "testnetwork", netOption)
|
n, err := createTestNetwork("bridge", "testnetwork", netOption)
|
||||||
|
@ -2181,8 +2161,7 @@ func createGlobalInstance(t *testing.T) {
|
||||||
|
|
||||||
netOption := options.Generic{
|
netOption := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": "network",
|
"BridgeName": "network",
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ func getTestEnv(t *testing.T) (NetworkController, Network, Network) {
|
||||||
name1 := "test_nw_1"
|
name1 := "test_nw_1"
|
||||||
netOption1 := options.Generic{
|
netOption1 := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": name1,
|
"BridgeName": name1,
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
n1, err := c.NewNetwork(netType, name1, NetworkOptionGeneric(netOption1))
|
n1, err := c.NewNetwork(netType, name1, NetworkOptionGeneric(netOption1))
|
||||||
|
@ -47,8 +46,7 @@ func getTestEnv(t *testing.T) (NetworkController, Network, Network) {
|
||||||
name2 := "test_nw_2"
|
name2 := "test_nw_2"
|
||||||
netOption2 := options.Generic{
|
netOption2 := options.Generic{
|
||||||
netlabel.GenericData: options.Generic{
|
netlabel.GenericData: options.Generic{
|
||||||
"BridgeName": name2,
|
"BridgeName": name2,
|
||||||
"AllowNonDefaultBridge": true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
n2, err := c.NewNetwork(netType, name2, NetworkOptionGeneric(netOption2))
|
n2, err := c.NewNetwork(netType, name2, NetworkOptionGeneric(netOption2))
|
||||||
|
|
Loading…
Reference in a new issue