From f682e1c47431a5d27f04a0a17a59f9e43a7f985c Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 27 Jan 2015 15:06:55 +0100 Subject: [PATCH] Complete documentation --- docs/api/examples/delete_projectuuid.txt | 4 ++-- .../delete_virtualboxuuidportsportiddnio.txt | 4 ++-- .../delete_vpcsuuidportsportiddnio.txt | 4 ++-- docs/api/examples/get_interfaces.txt | 22 ++++++------------- docs/api/examples/get_projectuuid.txt | 4 ++-- docs/api/examples/get_version.txt | 4 ++-- docs/api/examples/get_virtualboxuuid.txt | 6 ++--- docs/api/examples/get_vpcsuuid.txt | 6 ++--- docs/api/examples/post_projectuuidclose.txt | 4 ++-- docs/api/examples/post_projectuuidcommit.txt | 4 ++-- docs/api/examples/post_udp.txt | 17 ++++++++++++++ docs/api/examples/post_version.txt | 4 ++-- docs/api/examples/post_virtualbox.txt | 6 ++--- .../post_virtualboxuuidportsportiddnio.txt | 4 ++-- docs/api/examples/post_vpcs.txt | 6 ++--- .../examples/post_vpcsuuidportsportiddnio.txt | 4 ++-- docs/api/examples/put_projectuuid.txt | 8 +++---- docs/api/udp.rst | 6 +++++ .../api/virtualboxuuidcaptureportiddstart.rst | 2 +- docs/api/virtualboxuuidcaptureportiddstop.rst | 2 +- docs/api/virtualboxuuidportsportiddnio.rst | 4 ++-- docs/api/virtualboxvms.rst | 13 +++++++++++ docs/api/vpcsuuidportsportiddnio.rst | 4 ++-- tests/api/test_network.py | 2 +- 24 files changed, 86 insertions(+), 58 deletions(-) create mode 100644 docs/api/examples/post_udp.txt create mode 100644 docs/api/virtualboxvms.rst diff --git a/docs/api/examples/delete_projectuuid.txt b/docs/api/examples/delete_projectuuid.txt index 68989437..9d63e2e0 100644 --- a/docs/api/examples/delete_projectuuid.txt +++ b/docs/api/examples/delete_projectuuid.txt @@ -5,9 +5,9 @@ DELETE /project/{uuid} HTTP/1.1 HTTP/1.1 204 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 0 DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /project/{uuid} diff --git a/docs/api/examples/delete_virtualboxuuidportsportiddnio.txt b/docs/api/examples/delete_virtualboxuuidportsportiddnio.txt index 17a9dc1c..6cbca129 100644 --- a/docs/api/examples/delete_virtualboxuuidportsportiddnio.txt +++ b/docs/api/examples/delete_virtualboxuuidportsportiddnio.txt @@ -5,9 +5,9 @@ DELETE /virtualbox/{uuid}/ports/{port_id:\d+}/nio HTTP/1.1 HTTP/1.1 204 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 0 DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /virtualbox/{uuid}/ports/{port_id:\d+}/nio diff --git a/docs/api/examples/delete_vpcsuuidportsportiddnio.txt b/docs/api/examples/delete_vpcsuuidportsportiddnio.txt index 9d2ac73f..b5801424 100644 --- a/docs/api/examples/delete_vpcsuuidportsportiddnio.txt +++ b/docs/api/examples/delete_vpcsuuidportsportiddnio.txt @@ -5,9 +5,9 @@ DELETE /vpcs/{uuid}/ports/{port_id:\d+}/nio HTTP/1.1 HTTP/1.1 204 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 0 DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /vpcs/{uuid}/ports/{port_id:\d+}/nio diff --git a/docs/api/examples/get_interfaces.txt b/docs/api/examples/get_interfaces.txt index 1063f948..7e21daff 100644 --- a/docs/api/examples/get_interfaces.txt +++ b/docs/api/examples/get_interfaces.txt @@ -5,11 +5,11 @@ GET /interfaces HTTP/1.1 HTTP/1.1 200 -CONNECTION: close -CONTENT-LENGTH: 652 +CONNECTION: keep-alive +CONTENT-LENGTH: 520 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /interfaces [ @@ -33,14 +33,14 @@ X-ROUTE: /interfaces "id": "en1", "name": "en1" }, - { - "id": "en2", - "name": "en2" - }, { "id": "fw0", "name": "fw0" }, + { + "id": "en2", + "name": "en2" + }, { "id": "p2p0", "name": "p2p0" @@ -48,13 +48,5 @@ X-ROUTE: /interfaces { "id": "bridge0", "name": "bridge0" - }, - { - "id": "vboxnet0", - "name": "vboxnet0" - }, - { - "id": "vboxnet1", - "name": "vboxnet1" } ] diff --git a/docs/api/examples/get_projectuuid.txt b/docs/api/examples/get_projectuuid.txt index bed046ad..2388771c 100644 --- a/docs/api/examples/get_projectuuid.txt +++ b/docs/api/examples/get_projectuuid.txt @@ -5,11 +5,11 @@ GET /project/{uuid} HTTP/1.1 HTTP/1.1 200 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 102 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /project/{uuid} { diff --git a/docs/api/examples/get_version.txt b/docs/api/examples/get_version.txt index 59bdb128..39509cda 100644 --- a/docs/api/examples/get_version.txt +++ b/docs/api/examples/get_version.txt @@ -5,11 +5,11 @@ GET /version HTTP/1.1 HTTP/1.1 200 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 29 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /version { diff --git a/docs/api/examples/get_virtualboxuuid.txt b/docs/api/examples/get_virtualboxuuid.txt index 27839d2c..446e6e1c 100644 --- a/docs/api/examples/get_virtualboxuuid.txt +++ b/docs/api/examples/get_virtualboxuuid.txt @@ -5,11 +5,11 @@ GET /virtualbox/{uuid} HTTP/1.1 HTTP/1.1 200 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 375 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /virtualbox/{uuid} { @@ -22,6 +22,6 @@ X-ROUTE: /virtualbox/{uuid} "linked_clone": false, "name": "VMTEST", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", - "uuid": "9b8874fe-919e-4a30-874b-68614da8d42f", + "uuid": "be1fa0fe-cd51-41e0-9806-2bac0f5f50ba", "vmname": "VMTEST" } diff --git a/docs/api/examples/get_vpcsuuid.txt b/docs/api/examples/get_vpcsuuid.txt index 08e28bb7..4112dde4 100644 --- a/docs/api/examples/get_vpcsuuid.txt +++ b/docs/api/examples/get_vpcsuuid.txt @@ -5,11 +5,11 @@ GET /vpcs/{uuid} HTTP/1.1 HTTP/1.1 200 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 213 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 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": "417eef12-d13b-4cb4-8a1f-1ff12963e570" + "uuid": "a474c92d-c9d2-4f53-bbe2-64493f8f07cc" } diff --git a/docs/api/examples/post_projectuuidclose.txt b/docs/api/examples/post_projectuuidclose.txt index d038c178..03ae88bc 100644 --- a/docs/api/examples/post_projectuuidclose.txt +++ b/docs/api/examples/post_projectuuidclose.txt @@ -5,9 +5,9 @@ POST /project/{uuid}/close HTTP/1.1 HTTP/1.1 204 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 0 DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /project/{uuid}/close diff --git a/docs/api/examples/post_projectuuidcommit.txt b/docs/api/examples/post_projectuuidcommit.txt index b5d0c2d9..2fe9c38f 100644 --- a/docs/api/examples/post_projectuuidcommit.txt +++ b/docs/api/examples/post_projectuuidcommit.txt @@ -5,9 +5,9 @@ POST /project/{uuid}/commit HTTP/1.1 HTTP/1.1 204 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 0 DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /project/{uuid}/commit diff --git a/docs/api/examples/post_udp.txt b/docs/api/examples/post_udp.txt new file mode 100644 index 00000000..7dfd4d75 --- /dev/null +++ b/docs/api/examples/post_udp.txt @@ -0,0 +1,17 @@ +curl -i -X POST 'http://localhost:8000/udp' -d '{}' + +POST /udp HTTP/1.1 +{} + + +HTTP/1.1 201 +CONNECTION: keep-alive +CONTENT-LENGTH: 25 +CONTENT-TYPE: application/json +DATE: Thu, 08 Jan 2015 16:09:15 GMT +SERVER: Python/3.4 GNS3/1.3.dev1 +X-ROUTE: /udp + +{ + "udp_port": 10000 +} diff --git a/docs/api/examples/post_version.txt b/docs/api/examples/post_version.txt index 45ef1069..1d4ecc7d 100644 --- a/docs/api/examples/post_version.txt +++ b/docs/api/examples/post_version.txt @@ -7,11 +7,11 @@ POST /version HTTP/1.1 HTTP/1.1 200 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 29 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /version { diff --git a/docs/api/examples/post_virtualbox.txt b/docs/api/examples/post_virtualbox.txt index 89badb75..3eff439d 100644 --- a/docs/api/examples/post_virtualbox.txt +++ b/docs/api/examples/post_virtualbox.txt @@ -10,11 +10,11 @@ POST /virtualbox HTTP/1.1 HTTP/1.1 201 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 369 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /virtualbox { @@ -27,6 +27,6 @@ X-ROUTE: /virtualbox "linked_clone": false, "name": "VM1", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", - "uuid": "455cc5f9-22f2-4121-973a-45d525110970", + "uuid": "8b5bbfa3-0682-4d65-ae8b-a1aea9dc40e5", "vmname": "VM1" } diff --git a/docs/api/examples/post_virtualboxuuidportsportiddnio.txt b/docs/api/examples/post_virtualboxuuidportsportiddnio.txt index a7cffb9c..d754de40 100644 --- a/docs/api/examples/post_virtualboxuuidportsportiddnio.txt +++ b/docs/api/examples/post_virtualboxuuidportsportiddnio.txt @@ -10,11 +10,11 @@ POST /virtualbox/{uuid}/ports/{port_id:\d+}/nio HTTP/1.1 HTTP/1.1 201 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 89 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /virtualbox/{uuid}/ports/{port_id:\d+}/nio { diff --git a/docs/api/examples/post_vpcs.txt b/docs/api/examples/post_vpcs.txt index af3ed908..2eadd535 100644 --- a/docs/api/examples/post_vpcs.txt +++ b/docs/api/examples/post_vpcs.txt @@ -8,11 +8,11 @@ POST /vpcs HTTP/1.1 HTTP/1.1 201 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 213 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /vpcs { @@ -21,5 +21,5 @@ X-ROUTE: /vpcs "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "script_file": null, "startup_script": null, - "uuid": "7c5d69c1-ba5a-4c2a-b1a7-da721aa58044" + "uuid": "688ff2f8-08c5-4218-8e19-99f1ac7fc20d" } diff --git a/docs/api/examples/post_vpcsuuidportsportiddnio.txt b/docs/api/examples/post_vpcsuuidportsportiddnio.txt index 09a955a5..057c1385 100644 --- a/docs/api/examples/post_vpcsuuidportsportiddnio.txt +++ b/docs/api/examples/post_vpcsuuidportsportiddnio.txt @@ -10,11 +10,11 @@ POST /vpcs/{uuid}/ports/{port_id:\d+}/nio HTTP/1.1 HTTP/1.1 201 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 89 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /vpcs/{uuid}/ports/{port_id:\d+}/nio { diff --git a/docs/api/examples/put_projectuuid.txt b/docs/api/examples/put_projectuuid.txt index a1baf6c8..998473c6 100644 --- a/docs/api/examples/put_projectuuid.txt +++ b/docs/api/examples/put_projectuuid.txt @@ -7,15 +7,15 @@ PUT /project/{uuid} HTTP/1.1 HTTP/1.1 200 -CONNECTION: close +CONNECTION: keep-alive CONTENT-LENGTH: 158 CONTENT-TYPE: application/json DATE: Thu, 08 Jan 2015 16:09:15 GMT -SERVER: Python/3.4 aiohttp/0.13.1 +SERVER: Python/3.4 GNS3/1.3.dev1 X-ROUTE: /project/{uuid} { - "location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmpivbrfsdh", + "location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmpf9hmfoxi", "temporary": false, - "uuid": "0442fdb6-fc77-4f1c-b996-675b98dc032e" + "uuid": "6cc80657-e8f3-445b-8c1a-e2081ac7d042" } diff --git a/docs/api/udp.rst b/docs/api/udp.rst index f2cdb2ae..6ed3ac5d 100644 --- a/docs/api/udp.rst +++ b/docs/api/udp.rst @@ -11,3 +11,9 @@ Response status codes ********************** - **201**: UDP port allocated +Sample session +*************** + + +.. literalinclude:: examples/post_udp.txt + diff --git a/docs/api/virtualboxuuidcaptureportiddstart.rst b/docs/api/virtualboxuuidcaptureportiddstart.rst index b6a61ca0..342f1893 100644 --- a/docs/api/virtualboxuuidcaptureportiddstart.rst +++ b/docs/api/virtualboxuuidcaptureportiddstart.rst @@ -9,8 +9,8 @@ Start a packet capture on a VirtualBox VM instance Parameters ********** -- **port_id**: ID of the port to start a packet capture - **uuid**: Instance UUID +- **port_id**: ID of the port to start a packet capture Response status codes ********************** diff --git a/docs/api/virtualboxuuidcaptureportiddstop.rst b/docs/api/virtualboxuuidcaptureportiddstop.rst index c336bf6c..a4a35c47 100644 --- a/docs/api/virtualboxuuidcaptureportiddstop.rst +++ b/docs/api/virtualboxuuidcaptureportiddstop.rst @@ -9,8 +9,8 @@ Stop a packet capture on a VirtualBox VM instance Parameters ********** -- **port_id**: ID of the port to stop a packet capture - **uuid**: Instance UUID +- **port_id**: ID of the port to stop a packet capture Response status codes ********************** diff --git a/docs/api/virtualboxuuidportsportiddnio.rst b/docs/api/virtualboxuuidportsportiddnio.rst index 817dc47a..160e5272 100644 --- a/docs/api/virtualboxuuidportsportiddnio.rst +++ b/docs/api/virtualboxuuidportsportiddnio.rst @@ -9,8 +9,8 @@ Add a NIO to a VirtualBox VM instance Parameters ********** -- **port_id**: ID of the port where the nio should be added - **uuid**: Instance UUID +- **port_id**: ID of the port where the nio should be added Response status codes ********************** @@ -31,8 +31,8 @@ Remove a NIO from a VirtualBox VM instance Parameters ********** -- **port_id**: ID of the port from where the nio should be removed - **uuid**: Instance UUID +- **port_id**: ID of the port from where the nio should be removed Response status codes ********************** diff --git a/docs/api/virtualboxvms.rst b/docs/api/virtualboxvms.rst new file mode 100644 index 00000000..c8f79412 --- /dev/null +++ b/docs/api/virtualboxvms.rst @@ -0,0 +1,13 @@ +/virtualbox/vms +--------------------------------------------- + +.. contents:: + +GET /virtualbox/vms +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Get all VirtualBox VMs available + +Response status codes +********************** +- **200**: Success + diff --git a/docs/api/vpcsuuidportsportiddnio.rst b/docs/api/vpcsuuidportsportiddnio.rst index a3075cd0..6226c3cf 100644 --- a/docs/api/vpcsuuidportsportiddnio.rst +++ b/docs/api/vpcsuuidportsportiddnio.rst @@ -9,8 +9,8 @@ Add a NIO to a VPCS instance Parameters ********** -- **port_id**: ID of the port where the nio should be added - **uuid**: Instance UUID +- **port_id**: ID of the port where the nio should be added Response status codes ********************** @@ -31,8 +31,8 @@ Remove a NIO from a VPCS instance Parameters ********** -- **port_id**: ID of the port from where the nio should be removed - **uuid**: Instance UUID +- **port_id**: ID of the port from where the nio should be removed Response status codes ********************** diff --git a/tests/api/test_network.py b/tests/api/test_network.py index 7c6aab6d..fdbee465 100644 --- a/tests/api/test_network.py +++ b/tests/api/test_network.py @@ -17,7 +17,7 @@ def test_udp_allocation(server): - response = server.post('/udp', {}) + response = server.post('/udp', {}, example=True) assert response.status == 201 assert response.json == {'udp_port': 10000}