mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
PEP8, documentation update, test fix
This commit is contained in:
parent
50fea669b5
commit
70faf76c10
@ -13,10 +13,10 @@ SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /vpcs/{uuid}
|
||||
|
||||
{
|
||||
"console": 2001,
|
||||
"console": 2003,
|
||||
"name": "PC TEST 1",
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"script_file": null,
|
||||
"startup_script": null,
|
||||
"uuid": "b37ef237-15aa-46a7-bdc5-8fa8657056c6"
|
||||
"uuid": "624e94fb-9e7e-45d0-a27d-4eeda19e98cd"
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ POST /virtualbox HTTP/1.1
|
||||
|
||||
HTTP/1.1 201
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 348
|
||||
CONTENT-LENGTH: 369
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
@ -21,11 +21,12 @@ X-ROUTE: /virtualbox
|
||||
"adapter_start_index": 0,
|
||||
"adapter_type": "Intel PRO/1000 MT Desktop (82540EM)",
|
||||
"adapters": 0,
|
||||
"console": 2000,
|
||||
"enable_remote_console": false,
|
||||
"headless": false,
|
||||
"linked_clone": false,
|
||||
"name": "VM1",
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"uuid": "767b6b21-2209-4d73-aec8-49e4a332709d",
|
||||
"uuid": "bd6e0124-bb4b-4224-a71f-9a28c302df4e",
|
||||
"vmname": "VM1"
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /vpcs
|
||||
|
||||
{
|
||||
"console": 2000,
|
||||
"console": 2001,
|
||||
"name": "PC TEST 1",
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"script_file": null,
|
||||
"startup_script": null,
|
||||
"uuid": "076902d4-97d2-4243-b4fb-374a381d4bc5"
|
||||
"uuid": "fc2b4d10-e4c6-4545-8b59-cd7a09bc3d33"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /project/{uuid}
|
||||
|
||||
{
|
||||
"location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmps4qnfnar",
|
||||
"location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmp2d1dq1sb",
|
||||
"temporary": false,
|
||||
"uuid": "b3eccaca-af01-4244-a3fd-da1fb98d04c9"
|
||||
"uuid": "7a6d9fd4-c212-4368-950f-5513e518313a"
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
GET /project/**{uuid}**
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Get project informations
|
||||
Get project information
|
||||
|
||||
Parameters
|
||||
**********
|
||||
|
@ -10,7 +10,7 @@ Create a new VirtualBox VM instance
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid project UUID
|
||||
- **201**: VirtualBox VM instance created
|
||||
- **201**: Instance created
|
||||
- **409**: Conflict
|
||||
|
||||
Input
|
||||
@ -19,6 +19,7 @@ Input
|
||||
|
||||
<table>
|
||||
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
|
||||
<tr><td>console</td> <td> </td> <td>integer</td> <td>console TCP port</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>
|
||||
|
@ -9,11 +9,11 @@ Reload a VirtualBox VM instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VirtualBox VM instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VirtualBox VM instance UUID
|
||||
- **404**: VirtualBox VM instance doesn't exist
|
||||
- **204**: VirtualBox VM instance reloaded
|
||||
- **400**: Invalid instance UUID
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance reloaded
|
||||
|
||||
|
@ -9,11 +9,11 @@ Resume a suspended VirtualBox VM instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VirtualBox VM instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VirtualBox VM instance UUID
|
||||
- **404**: VirtualBox VM instance doesn't exist
|
||||
- **204**: VirtualBox VM instance resumed
|
||||
- **400**: Invalid instance UUID
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance resumed
|
||||
|
||||
|
@ -9,13 +9,13 @@ Start a VirtualBox VM instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VirtualBox VM instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VirtualBox VM instance UUID
|
||||
- **404**: VirtualBox VM instance doesn't exist
|
||||
- **204**: VirtualBox VM instance started
|
||||
- **400**: Invalid instance UUID
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance started
|
||||
|
||||
Sample session
|
||||
***************
|
||||
|
@ -9,13 +9,13 @@ Stop a VirtualBox VM instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VirtualBox VM instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VirtualBox VM instance UUID
|
||||
- **404**: VirtualBox VM instance doesn't exist
|
||||
- **204**: VirtualBox VM instance stopped
|
||||
- **400**: Invalid instance UUID
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance stopped
|
||||
|
||||
Sample session
|
||||
***************
|
||||
|
@ -9,11 +9,11 @@ Suspend a VirtualBox VM instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VirtualBox VM instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VirtualBox VM instance UUID
|
||||
- **404**: VirtualBox VM instance doesn't exist
|
||||
- **204**: VirtualBox VM instance suspended
|
||||
- **400**: Invalid instance UUID
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance suspended
|
||||
|
||||
|
@ -10,7 +10,7 @@ Create a new VPCS instance
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid project UUID
|
||||
- **201**: VPCS instance created
|
||||
- **201**: Instance created
|
||||
- **409**: Conflict
|
||||
|
||||
Input
|
||||
|
@ -9,12 +9,26 @@ Get a VPCS instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VPCS instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **200**: Success
|
||||
- **404**: VPCS instance doesn't exist
|
||||
- **404**: Instance doesn't exist
|
||||
|
||||
Output
|
||||
*******
|
||||
.. raw:: html
|
||||
|
||||
<table>
|
||||
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
|
||||
<tr><td>console</td> <td>✔</td> <td>integer</td> <td>console TCP port</td> </tr>
|
||||
<tr><td>name</td> <td>✔</td> <td>string</td> <td>VPCS device name</td> </tr>
|
||||
<tr><td>project_uuid</td> <td>✔</td> <td>string</td> <td>Project UUID</td> </tr>
|
||||
<tr><td>script_file</td> <td> </td> <td>['string', 'null']</td> <td>VPCS startup script</td> </tr>
|
||||
<tr><td>startup_script</td> <td> </td> <td>['string', 'null']</td> <td>Content of the VPCS startup script</td> </tr>
|
||||
<tr><td>uuid</td> <td>✔</td> <td>string</td> <td>VPCS device UUID</td> </tr>
|
||||
</table>
|
||||
|
||||
Sample session
|
||||
***************
|
||||
@ -29,13 +43,13 @@ Update a VPCS instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VPCS instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **200**: VPCS instance updated
|
||||
- **200**: Instance updated
|
||||
- **409**: Conflict
|
||||
- **404**: VPCS instance doesn't exist
|
||||
- **404**: Instance doesn't exist
|
||||
|
||||
Input
|
||||
*******
|
||||
@ -70,10 +84,10 @@ Delete a VPCS instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VPCS instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **404**: VPCS instance doesn't exist
|
||||
- **204**: VPCS instance deleted
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance deleted
|
||||
|
||||
|
@ -5,15 +5,15 @@
|
||||
|
||||
POST /vpcs/**{uuid}**/reload
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Remove a NIO from a VPCS
|
||||
Reload a VPCS instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VPCS instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VPCS instance UUID
|
||||
- **404**: VPCS instance doesn't exist
|
||||
- **204**: VPCS reloaded
|
||||
- **400**: Invalid instance UUID
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance reloaded
|
||||
|
||||
|
@ -9,11 +9,11 @@ Start a VPCS instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VPCS instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VPCS instance UUID
|
||||
- **404**: VPCS instance doesn't exist
|
||||
- **204**: VPCS instance started
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance started
|
||||
|
||||
|
@ -9,11 +9,11 @@ Stop a VPCS instance
|
||||
|
||||
Parameters
|
||||
**********
|
||||
- **uuid**: VPCS instance UUID
|
||||
- **uuid**: Instance UUID
|
||||
|
||||
Response status codes
|
||||
**********************
|
||||
- **400**: Invalid VPCS instance UUID
|
||||
- **404**: VPCS instance doesn't exist
|
||||
- **204**: VPCS instance stopped
|
||||
- **404**: Instance doesn't exist
|
||||
- **204**: Instance stopped
|
||||
|
||||
|
@ -51,7 +51,6 @@ class PortManager:
|
||||
else:
|
||||
self._console_host = host
|
||||
|
||||
assert not hasattr(PortManager, "_instance")
|
||||
PortManager._instance = self
|
||||
|
||||
@classmethod
|
||||
|
@ -428,7 +428,7 @@ class VirtualBoxVM(BaseVM):
|
||||
|
||||
log.info("VirtualBox VM '{name}' [{uuid}] has set the VM name to '{vmname}'".format(name=self.name, uuid=self.uuid, vmname=vmname))
|
||||
# TODO: test linked clone
|
||||
#if self._linked_clone:
|
||||
# if self._linked_clone:
|
||||
# yield from self._modify_vm('--name "{}"'.format(vmname))
|
||||
self._vmname = vmname
|
||||
|
||||
|
@ -89,7 +89,7 @@ def interfaces():
|
||||
import netifaces
|
||||
for interface in netifaces.interfaces():
|
||||
results.append({"id": interface,
|
||||
"name": interface})
|
||||
"name": interface})
|
||||
except ImportError:
|
||||
return
|
||||
else:
|
||||
|
@ -41,4 +41,4 @@ def test_vm_non_executable_vboxmanage_path(project, manager):
|
||||
tmpfile = tempfile.NamedTemporaryFile()
|
||||
with patch("gns3server.config.Config.get_section_config", return_value={"vboxmanage_path": tmpfile.name}):
|
||||
with pytest.raises(VirtualBoxError):
|
||||
manager.find_vboxmanage()
|
||||
manager.find_vboxmanage()
|
||||
|
Loading…
Reference in New Issue
Block a user