From e175650fb079d085cb20d2ba35892d157115a41c Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 4 Jul 2016 17:22:54 +0200 Subject: [PATCH] Increase the number of interface for docker Fix #593 --- gns3server/modules/docker/docker_vm.py | 6 +++--- tests/modules/docker/test_docker_vm.py | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gns3server/modules/docker/docker_vm.py b/gns3server/modules/docker/docker_vm.py index 99fe4297..2c602e04 100644 --- a/gns3server/modules/docker/docker_vm.py +++ b/gns3server/modules/docker/docker_vm.py @@ -623,10 +623,10 @@ class DockerVM(BaseVM): "Adapter {adapter_number} doesn't exist on Docker container '{name}'".format(name=self.name, adapter_number=adapter_number)) for index in range(4096): - if "veth-gns3-ext{}".format(index) not in psutil.net_if_addrs(): + if "veth-gns3-e{}".format(index) not in psutil.net_if_addrs(): adapter.ifc = "eth{}".format(str(index)) - adapter.host_ifc = "veth-gns3-ext{}".format(str(index)) - adapter.guest_ifc = "veth-gns3-int{}".format(str(index)) + adapter.host_ifc = "veth-gns3-e{}".format(str(index)) + adapter.guest_ifc = "veth-gns3-i{}".format(str(index)) break if not hasattr(adapter, "ifc"): raise DockerError( diff --git a/tests/modules/docker/test_docker_vm.py b/tests/modules/docker/test_docker_vm.py index 06778576..af4ca459 100644 --- a/tests/modules/docker/test_docker_vm.py +++ b/tests/modules/docker/test_docker_vm.py @@ -692,10 +692,10 @@ def test_add_ubridge_connection(loop, vm): loop.run_until_complete(asyncio.async(vm._add_ubridge_connection(nio, 0, 42))) calls = [ - call.send("docker create_veth veth-gns3-ext0 veth-gns3-int0"), - call.send('docker move_to_ns veth-gns3-int0 42 eth0'), + call.send("docker create_veth veth-gns3-e0 veth-gns3-i0"), + call.send('docker move_to_ns veth-gns3-i0 42 eth0'), call.send('bridge create bridge0'), - call.send('bridge add_nio_linux_raw bridge0 veth-gns3-ext0'), + call.send('bridge add_nio_linux_raw bridge0 veth-gns3-e0'), call.send('bridge add_nio_udp bridge0 4242 127.0.0.1 4343'), call.send('bridge start_capture bridge0 "/tmp/capture.pcap"'), call.send('bridge start bridge0') @@ -712,8 +712,8 @@ def test_add_ubridge_connection_none_nio(loop, vm): loop.run_until_complete(asyncio.async(vm._add_ubridge_connection(nio, 0, 42))) calls = [ - call.send("docker create_veth veth-gns3-ext0 veth-gns3-int0"), - call.send('docker move_to_ns veth-gns3-int0 42 eth0'), + call.send("docker create_veth veth-gns3-e0 veth-gns3-i0"), + call.send('docker move_to_ns veth-gns3-i0 42 eth0'), ] # We need to check any_order ortherwise mock is confused by asyncio vm._ubridge_hypervisor.assert_has_calls(calls, any_order=True) @@ -740,7 +740,7 @@ def test_add_ubridge_connection_no_free_interface(loop, vm): with pytest.raises(DockerError): # We create fake ethernet interfaces for docker - interfaces = ["veth-gns3-ext{}".format(index) for index in range(4096)] + interfaces = ["veth-gns3-e{}".format(index) for index in range(4096)] with patch("psutil.net_if_addrs", return_value=interfaces): loop.run_until_complete(asyncio.async(vm._add_ubridge_connection(nio, 0, 42))) @@ -760,7 +760,7 @@ def test_delete_ubridge_connection(loop, vm): calls = [ call.send("bridge delete bridge0"), - call.send('docker delete_veth veth-gns3-ext0') + call.send('docker delete_veth veth-gns3-e0') ] vm._ubridge_hypervisor.assert_has_calls(calls, any_order=True)