mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
PEP8 + documentation.
This commit is contained in:
parent
8a00d30e23
commit
334835c985
@ -5,9 +5,9 @@ DELETE /project/{uuid} HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 204
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 0
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /project/{uuid}
|
||||
|
||||
|
@ -5,48 +5,36 @@ GET /interfaces HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: keep-alive
|
||||
CONTENT-LENGTH: 520
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 364
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /interfaces
|
||||
|
||||
[
|
||||
{
|
||||
"id": "lo0",
|
||||
"name": "lo0"
|
||||
"id": "lo",
|
||||
"name": "lo"
|
||||
},
|
||||
{
|
||||
"id": "gif0",
|
||||
"name": "gif0"
|
||||
"id": "eth0",
|
||||
"name": "eth0"
|
||||
},
|
||||
{
|
||||
"id": "stf0",
|
||||
"name": "stf0"
|
||||
"id": "wlan0",
|
||||
"name": "wlan0"
|
||||
},
|
||||
{
|
||||
"id": "en0",
|
||||
"name": "en0"
|
||||
"id": "vmnet1",
|
||||
"name": "vmnet1"
|
||||
},
|
||||
{
|
||||
"id": "en1",
|
||||
"name": "en1"
|
||||
"id": "vmnet8",
|
||||
"name": "vmnet8"
|
||||
},
|
||||
{
|
||||
"id": "fw0",
|
||||
"name": "fw0"
|
||||
},
|
||||
{
|
||||
"id": "en2",
|
||||
"name": "en2"
|
||||
},
|
||||
{
|
||||
"id": "p2p0",
|
||||
"name": "p2p0"
|
||||
},
|
||||
{
|
||||
"id": "bridge0",
|
||||
"name": "bridge0"
|
||||
"id": "vboxnet0",
|
||||
"name": "vboxnet0"
|
||||
}
|
||||
]
|
||||
|
@ -5,11 +5,11 @@ GET /project/{uuid} HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 102
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /project/{uuid}
|
||||
|
||||
{
|
||||
|
@ -5,11 +5,11 @@ GET /version HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 29
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /version
|
||||
|
||||
{
|
||||
|
@ -5,11 +5,11 @@ GET /virtualbox/{uuid} HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: keep-alive
|
||||
CONTENT-LENGTH: 375
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 348
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /virtualbox/{uuid}
|
||||
|
||||
{
|
||||
@ -19,9 +19,8 @@ X-ROUTE: /virtualbox/{uuid}
|
||||
"console": 2001,
|
||||
"enable_remote_console": false,
|
||||
"headless": false,
|
||||
"linked_clone": false,
|
||||
"name": "VMTEST",
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"uuid": "be1fa0fe-cd51-41e0-9806-2bac0f5f50ba",
|
||||
"uuid": "7d0bf59f-0a8c-4382-b5ed-23902653d8c5",
|
||||
"vmname": "VMTEST"
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ GET /vpcs/{uuid} HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 213
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /vpcs/{uuid}
|
||||
|
||||
{
|
||||
@ -18,5 +18,5 @@ X-ROUTE: /vpcs/{uuid}
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"script_file": null,
|
||||
"startup_script": null,
|
||||
"uuid": "a474c92d-c9d2-4f53-bbe2-64493f8f07cc"
|
||||
"uuid": "5af7ac19-3064-4c8d-8355-fb0c933bbf37"
|
||||
}
|
||||
|
@ -5,9 +5,9 @@ POST /project/{uuid}/close HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 204
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 0
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /project/{uuid}/close
|
||||
|
||||
|
@ -5,9 +5,9 @@ POST /project/{uuid}/commit HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 204
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 0
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /project/{uuid}/commit
|
||||
|
||||
|
@ -7,11 +7,11 @@ POST /version HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 29
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /version
|
||||
|
||||
{
|
||||
|
@ -10,11 +10,11 @@ POST /virtualbox HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 201
|
||||
CONNECTION: keep-alive
|
||||
CONTENT-LENGTH: 369
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 342
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /virtualbox
|
||||
|
||||
{
|
||||
@ -24,9 +24,8 @@ X-ROUTE: /virtualbox
|
||||
"console": 2000,
|
||||
"enable_remote_console": false,
|
||||
"headless": false,
|
||||
"linked_clone": false,
|
||||
"name": "VM1",
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"uuid": "8b5bbfa3-0682-4d65-ae8b-a1aea9dc40e5",
|
||||
"uuid": "4cdea9da-6611-44c3-a085-a3bc4dae7883",
|
||||
"vmname": "VM1"
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ POST /vpcs HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 201
|
||||
CONNECTION: keep-alive
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 213
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /vpcs
|
||||
|
||||
{
|
||||
@ -21,5 +21,5 @@ X-ROUTE: /vpcs
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"script_file": null,
|
||||
"startup_script": null,
|
||||
"uuid": "688ff2f8-08c5-4218-8e19-99f1ac7fc20d"
|
||||
"uuid": "2cefa3e7-6867-4282-a606-c42d94c7852e"
|
||||
}
|
||||
|
@ -7,15 +7,15 @@ PUT /project/{uuid} HTTP/1.1
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: keep-alive
|
||||
CONTENT-LENGTH: 158
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 114
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 GNS3/1.3.dev1
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /project/{uuid}
|
||||
|
||||
{
|
||||
"location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmpf9hmfoxi",
|
||||
"location": "/tmp/tmpjan_7gw5",
|
||||
"temporary": false,
|
||||
"uuid": "6cc80657-e8f3-445b-8c1a-e2081ac7d042"
|
||||
"uuid": "88146503-b509-40a4-ae43-0f17100c767a"
|
||||
}
|
||||
|
@ -19,7 +19,12 @@ Input
|
||||
|
||||
<table>
|
||||
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
|
||||
<tr><td>adapter_start_index</td> <td> </td> <td>integer</td> <td>adapter index from which to start using adapters</td> </tr>
|
||||
<tr><td>adapter_type</td> <td> </td> <td>string</td> <td>VirtualBox adapter type</td> </tr>
|
||||
<tr><td>adapters</td> <td> </td> <td>integer</td> <td>number of adapters</td> </tr>
|
||||
<tr><td>console</td> <td> </td> <td>integer</td> <td>console TCP port</td> </tr>
|
||||
<tr><td>enable_remote_console</td> <td> </td> <td>boolean</td> <td>enable the remote console</td> </tr>
|
||||
<tr><td>headless</td> <td> </td> <td>boolean</td> <td>headless mode</td> </tr>
|
||||
<tr><td>linked_clone</td> <td>✔</td> <td>boolean</td> <td>either the VM is a linked clone or not</td> </tr>
|
||||
<tr><td>name</td> <td>✔</td> <td>string</td> <td>VirtualBox VM instance name</td> </tr>
|
||||
<tr><td>project_uuid</td> <td>✔</td> <td>string</td> <td>Project UUID</td> </tr>
|
||||
@ -40,7 +45,6 @@ Output
|
||||
<tr><td>console</td> <td> </td> <td>integer</td> <td>console TCP port</td> </tr>
|
||||
<tr><td>enable_remote_console</td> <td> </td> <td>boolean</td> <td>enable the remote console</td> </tr>
|
||||
<tr><td>headless</td> <td> </td> <td>boolean</td> <td>headless mode</td> </tr>
|
||||
<tr><td>linked_clone</td> <td> </td> <td>boolean</td> <td>either the VM is a linked clone or not</td> </tr>
|
||||
<tr><td>name</td> <td>✔</td> <td>string</td> <td>VirtualBox VM instance name</td> </tr>
|
||||
<tr><td>project_uuid</td> <td>✔</td> <td>string</td> <td>Project UUID</td> </tr>
|
||||
<tr><td>uuid</td> <td>✔</td> <td>string</td> <td>VirtualBox VM instance UUID</td> </tr>
|
||||
|
@ -28,7 +28,6 @@ Output
|
||||
<tr><td>console</td> <td> </td> <td>integer</td> <td>console TCP port</td> </tr>
|
||||
<tr><td>enable_remote_console</td> <td> </td> <td>boolean</td> <td>enable the remote console</td> </tr>
|
||||
<tr><td>headless</td> <td> </td> <td>boolean</td> <td>headless mode</td> </tr>
|
||||
<tr><td>linked_clone</td> <td> </td> <td>boolean</td> <td>either the VM is a linked clone or not</td> </tr>
|
||||
<tr><td>name</td> <td>✔</td> <td>string</td> <td>VirtualBox VM instance name</td> </tr>
|
||||
<tr><td>project_uuid</td> <td>✔</td> <td>string</td> <td>Project UUID</td> </tr>
|
||||
<tr><td>uuid</td> <td>✔</td> <td>string</td> <td>VirtualBox VM instance UUID</td> </tr>
|
||||
@ -84,7 +83,6 @@ Output
|
||||
<tr><td>console</td> <td> </td> <td>integer</td> <td>console TCP port</td> </tr>
|
||||
<tr><td>enable_remote_console</td> <td> </td> <td>boolean</td> <td>enable the remote console</td> </tr>
|
||||
<tr><td>headless</td> <td> </td> <td>boolean</td> <td>headless mode</td> </tr>
|
||||
<tr><td>linked_clone</td> <td> </td> <td>boolean</td> <td>either the VM is a linked clone or not</td> </tr>
|
||||
<tr><td>name</td> <td>✔</td> <td>string</td> <td>VirtualBox VM instance name</td> </tr>
|
||||
<tr><td>project_uuid</td> <td>✔</td> <td>string</td> <td>Project UUID</td> </tr>
|
||||
<tr><td>uuid</td> <td>✔</td> <td>string</td> <td>VirtualBox VM instance UUID</td> </tr>
|
||||
|
@ -26,6 +26,7 @@ from ..modules.virtualbox import VirtualBox
|
||||
|
||||
|
||||
class VirtualBoxHandler:
|
||||
|
||||
"""
|
||||
API entry points for VirtualBox.
|
||||
"""
|
||||
|
@ -21,6 +21,7 @@ Base interface for NIOs.
|
||||
|
||||
|
||||
class NIO(object):
|
||||
|
||||
"""
|
||||
Network Input/Output.
|
||||
"""
|
||||
|
@ -25,6 +25,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PortManager:
|
||||
|
||||
"""
|
||||
:param host: IP address to bind for console connections
|
||||
"""
|
||||
|
@ -30,6 +30,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Project:
|
||||
|
||||
"""
|
||||
A project contains a list of VM.
|
||||
In theory VM are isolated project/project.
|
||||
|
@ -43,6 +43,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class VirtualBoxVM(BaseVM):
|
||||
|
||||
"""
|
||||
VirtualBox VM implementation.
|
||||
"""
|
||||
|
@ -89,9 +89,9 @@ def test_vbox_reload(server, vm):
|
||||
|
||||
def test_vbox_nio_create_udp(server, vm):
|
||||
response = server.post("/virtualbox/{}/adapters/0/nio".format(vm["uuid"]), {"type": "nio_udp",
|
||||
"lport": 4242,
|
||||
"rport": 4343,
|
||||
"rhost": "127.0.0.1"},
|
||||
"lport": 4242,
|
||||
"rport": 4343,
|
||||
"rhost": "127.0.0.1"},
|
||||
example=True)
|
||||
assert response.status == 201
|
||||
assert response.route == "/virtualbox/{uuid}/adapters/{adapter_id:\d+}/nio"
|
||||
@ -100,9 +100,9 @@ def test_vbox_nio_create_udp(server, vm):
|
||||
|
||||
def test_vbox_delete_nio(server, vm):
|
||||
server.post("/virtualbox/{}/adapters/0/nio".format(vm["uuid"]), {"type": "nio_udp",
|
||||
"lport": 4242,
|
||||
"rport": 4343,
|
||||
"rhost": "127.0.0.1"})
|
||||
"lport": 4242,
|
||||
"rport": 4343,
|
||||
"rhost": "127.0.0.1"})
|
||||
response = server.delete("/virtualbox/{}/adapters/0/nio".format(vm["uuid"]), example=True)
|
||||
assert response.status == 204
|
||||
assert response.route == "/virtualbox/{uuid}/adapters/{adapter_id:\d+}/nio"
|
||||
|
Loading…
Reference in New Issue
Block a user