diff --git a/.travis.yml b/.travis.yml index 664583a3..7567504d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,8 @@ install: - python setup.py install - pip install -rdev-requirements.txt script: -- py.test -v -s tests +- mkdir ‡ +- py.test -v -s tests --basetemp=‡ deploy: provider: pypi user: noplay diff --git a/CHANGELOG b/CHANGELOG index 120f8721..5a860c6c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,13 @@ # Change Log +## 2.0.0 02/05/2017 + +* Fix connection to websocket with last docker release +* Lower docker requirements in tests also +* Docker minimum api is 1.25 +* Handling server disconnect error when docker daemon die +* Handle some invalid SVG images + ## 2.0.0rc4 20/04/2017 * Fix a race condition when handling error at project opening diff --git a/dev-requirements.txt b/dev-requirements.txt index 7e3a31c6..0d474df5 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ -rrequirements.txt -sphinx==1.5.5 +sphinx==1.5.6 pytest==3.0.7 pep8==1.7.0 pytest-catchlog==1.2.2 diff --git a/gns3server/compute/base_manager.py b/gns3server/compute/base_manager.py index 857c9c80..18dffa26 100644 --- a/gns3server/compute/base_manager.py +++ b/gns3server/compute/base_manager.py @@ -344,7 +344,7 @@ class BaseManager: # test the 2nd byte and check if the 13th bit (CAP_NET_RAW) is set if struct.unpack(" 0: stream_handler = logging.FileHandler(logfile) @@ -111,5 +121,7 @@ def init_logger(level, logfile=None, quiet=False): if quiet: stream_handler.addFilter(logging.Filter(name="user_facing")) logging.getLogger('user_facing').propagate = False + if level > logging.DEBUG: + stream_handler.addFilter(LogFilter) logging.basicConfig(level=level, handlers=[stream_handler]) return logging.getLogger('user_facing') diff --git a/init/gns3.conf.upstart b/init/gns3.conf.upstart index 1a7c925f..8ae7e86e 100644 --- a/init/gns3.conf.upstart +++ b/init/gns3.conf.upstart @@ -1,5 +1,6 @@ description "GNS3 server" author "GNS3 Team" +env LANG=en_US.UTF-8 start on filesystem or runlevel [2345] stop on shutdown diff --git a/requirements.txt b/requirements.txt index 775d220d..648cf5f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ Jinja2>=2.7.3 raven>=5.23.0 psutil>=3.0.0 zipstream>=1.1.4 +typing>=3.5.3.0 # Otherwise yarl fail with python 3.4 diff --git a/setup.py b/setup.py index fd19894f..02663755 100644 --- a/setup.py +++ b/setup.py @@ -40,9 +40,6 @@ class PyTest(TestCommand): dependencies = open("requirements.txt", "r").read().splitlines() -if sys.version_info <= (3, 4): - dependencies.append('typing>=3.5.3.0 # Otherwise yarl fail with python 3.4') - setup( name="gns3-server", version=__import__("gns3server").__version__, diff --git a/tests/compute/docker/test_docker_vm.py b/tests/compute/docker/test_docker_vm.py index 70517b5b..3d28f11a 100644 --- a/tests/compute/docker/test_docker_vm.py +++ b/tests/compute/docker/test_docker_vm.py @@ -879,7 +879,7 @@ def test_start_aux(vm, loop): with asyncio_patch("asyncio.subprocess.create_subprocess_exec", return_value=MagicMock()) as mock_exec: loop.run_until_complete(asyncio.async(vm._start_aux())) - mock_exec.assert_called_with('docker', 'exec', '-i', 'e90e34656842', '/gns3/bin/busybox', 'script', '-qfc', 'while true; do /gns3/bin/busybox sh; done', '/dev/null', stderr=asyncio.subprocess.STDOUT, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE) + mock_exec.assert_called_with('docker', 'exec', '-i', 'e90e34656842', '/gns3/bin/busybox', 'script', '-qfc', 'while true; do TERM=vt100 /gns3/bin/busybox sh; done', '/dev/null', stderr=asyncio.subprocess.STDOUT, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE) def test_create_network_interfaces(vm): diff --git a/tests/controller/test_compute.py b/tests/controller/test_compute.py index c8b90c09..07b926cb 100644 --- a/tests/controller/test_compute.py +++ b/tests/controller/test_compute.py @@ -360,8 +360,10 @@ def test_images(compute, async_run, images_dir): images = async_run(compute.images("qemu")) mock.assert_called_with("GET", "https://example.com:84/v2/compute/qemu/images", auth=None, data=None, headers={'content-type': 'application/json'}, chunked=False, timeout=None) - assert images == [{"filename": "linux.qcow2", "path": "linux.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0}, - {"filename": "asa.qcow2", "path": "asa.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0}] + assert images == [ + {"filename": "asa.qcow2", "path": "asa.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0}, + {"filename": "linux.qcow2", "path": "linux.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0} + ] def test_list_files(project, async_run, compute): diff --git a/tests/controller/test_import_project.py b/tests/controller/test_import_project.py index 23d09457..e61e1ed8 100644 --- a/tests/controller/test_import_project.py +++ b/tests/controller/test_import_project.py @@ -252,6 +252,50 @@ def test_import_iou_linux_with_vm(linux_platform, async_run, tmpdir, controller) assert topo["topology"]["nodes"][0]["compute_id"] == "vm" +def test_import_nat_non_linux(windows_platform, async_run, tmpdir, controller): + """ + On non linux host NAT should be moved to the GNS3 VM + """ + project_id = str(uuid.uuid4()) + controller._computes["vm"] = AsyncioMagicMock() + + topology = { + "project_id": str(uuid.uuid4()), + "name": "test", + "type": "topology", + "topology": { + "nodes": [ + { + "compute_id": "local", + "node_id": "0fd3dd4d-dc93-4a04-a9b9-7396a9e22e8b", + "node_type": "nat", + "name": "test", + "properties": {} + } + ], + "links": [], + "computes": [], + "drawings": [] + }, + "revision": 5, + "version": "2.0.0" + } + + with open(str(tmpdir / "project.gns3"), 'w+') as f: + json.dump(topology, f) + + zip_path = str(tmpdir / "project.zip") + with zipfile.ZipFile(zip_path, 'w') as myzip: + myzip.write(str(tmpdir / "project.gns3"), "project.gns3") + + with open(zip_path, "rb") as f: + project = async_run(import_project(controller, project_id, f)) + + with open(os.path.join(project.path, "test.gns3")) as f: + topo = json.load(f) + assert topo["topology"]["nodes"][0]["compute_id"] == "vm" + + def test_import_iou_non_linux(windows_platform, async_run, tmpdir, controller): """ On non linux host IOU should be moved to the GNS3 VM diff --git a/tests/controller/test_node_port_name.py b/tests/controller/test_node_port_name.py index 8d0ccc64..5da90dc8 100644 --- a/tests/controller/test_node_port_name.py +++ b/tests/controller/test_node_port_name.py @@ -548,8 +548,8 @@ def test_list_ports_dynamips(project, compute): "link_type": "ethernet" }, { - "name": "Serial0/16", - "short_name": "s0/16", + "name": "Serial0/0", + "short_name": "s0/0", "data_link_types": { "Cisco HDLC": "DLT_C_HDLC", "Cisco PPP": "DLT_PPP_SERIAL", @@ -559,8 +559,8 @@ def test_list_ports_dynamips(project, compute): "link_type": "serial" }, { - "name": "Serial0/17", - "short_name": "s0/17", + "name": "Serial0/1", + "short_name": "s0/1", "data_link_types": { "Cisco HDLC": "DLT_C_HDLC", "Cisco PPP": "DLT_PPP_SERIAL", @@ -570,24 +570,24 @@ def test_list_ports_dynamips(project, compute): "link_type": "serial" }, { - "name": "Serial0/18", - "short_name": "s0/18", + "name": "Serial0/2", + "short_name": "s0/2", "data_link_types": { "Cisco HDLC": "DLT_C_HDLC", "Cisco PPP": "DLT_PPP_SERIAL", "Frame Relay": "DLT_FRELAY"}, - "port_number": 18, + "port_number": 32, "adapter_number": 0, "link_type": "serial" }, { - "name": "Serial0/19", - "short_name": "s0/19", + "name": "Serial0/3", + "short_name": "s0/3", "data_link_types": { "Cisco HDLC": "DLT_C_HDLC", "Cisco PPP": "DLT_PPP_SERIAL", "Frame Relay": "DLT_FRELAY"}, - "port_number": 19, + "port_number": 33, "adapter_number": 0, "link_type": "serial" }