New base server.

This commit is contained in:
Jeremy committed 2015-01-13 17:05:26 -07:00
1 parent 5e665cc67a
commit 61344a1669
51 files changed
+2632 -1835

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
curl -i -xGET 'http://localhost:8000/version'
GET /version HTTP/1.1
HTTP/1.1 200
CONNECTION: close
CONTENT-LENGTH: 31
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /version
{
"version": "1.2.2.dev2"
}
+19
View File
@@ -0,0 +1,19 @@
curl -i -xPOST 'http://localhost:8000/version' -d '{"version": "1.2.2.dev2"}'
POST /version HTTP/1.1
{
"version": "1.2.2.dev2"
}
HTTP/1.1 200
CONNECTION: close
CONTENT-LENGTH: 31
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /version
{
"version": "1.2.2.dev2"
}
+21
View File
@@ -0,0 +1,21 @@
curl -i -xPOST 'http://localhost:8000/vpcs' -d '{"name": "PC TEST 1"}'
POST /vpcs HTTP/1.1
{
"name": "PC TEST 1"
}
HTTP/1.1 200
CONNECTION: close
CONTENT-LENGTH: 67
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /vpcs
{
"console": 4242,
"name": "PC TEST 1",
"vpcs_id": 42
}
+28
View File
@@ -0,0 +1,28 @@
curl -i -xPOST 'http://localhost:8000/vpcs/{vpcs_id}/nio' -d '{"id": 42, "nio": {"local_file": "/tmp/test", "remote_file": "/tmp/remote", "type": "nio_unix"}, "port": 0, "port_id": 0}'
POST /vpcs/{vpcs_id}/nio HTTP/1.1
{
"id": 42,
"nio": {
"local_file": "/tmp/test",
"remote_file": "/tmp/remote",
"type": "nio_unix"
},
"port": 0,
"port_id": 0
}
HTTP/1.1 200
CONNECTION: close
CONTENT-LENGTH: 62
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /vpcs/{vpcs_id}/nio
{
"console": 4242,
"name": "PC 2",
"vpcs_id": 42
}
+13
View File
@@ -0,0 +1,13 @@
/sleep
------------------------------
.. contents::
GET /sleep
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response status codes
**************************
- **200**: OK
+13
View File
@@ -0,0 +1,13 @@
/stream
------------------------------
.. contents::
GET /stream
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response status codes
**************************
- **200**: OK
+28
View File
@@ -0,0 +1,28 @@
/version
------------------------------
.. contents::
GET /version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retrieve server version number
Response status codes
**************************
- **200**: OK
Output
*******
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>version</td><td>&#10004;</td><td>string</td><td>Version number human readable</td></tr>
</table>
Sample session
***************
.. literalinclude:: examples/get_version.txt
+46
View File
@@ -0,0 +1,46 @@
/vpcs
------------------------------
.. contents::
POST /vpcs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create a new VPCS and return it
Parameters
**********
- **vpcs_id**: Id of VPCS instance
Response status codes
**************************
- **201**: Success of creation of VPCS
- **409**: Conflict
Input
*******
.. 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>&#10004;</td><td>string</td><td>VPCS device name</td></tr>
<tr><td>vpcs_id</td><td> </td><td>integer</td><td>VPCS device instance ID</td></tr>
</table>
Output
*******
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>console</td><td>&#10004;</td><td>integer</td><td>console TCP port</td></tr>
<tr><td>name</td><td>&#10004;</td><td>string</td><td>VPCS device name</td></tr>
<tr><td>vpcs_id</td><td>&#10004;</td><td>integer</td><td>VPCS device instance ID</td></tr>
</table>
Sample session
***************
.. literalinclude:: examples/post_vpcs.txt
+63
View File
@@ -0,0 +1,63 @@
/vpcs/{vpcs_id}
------------------------------
.. contents::
GET /vpcs/{vpcs_id}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get informations about a VPCS
Parameters
**********
- **vpcs_id**: Id of VPCS instance
Response status codes
**************************
- **200**: OK
Output
*******
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>console</td><td>&#10004;</td><td>integer</td><td>console TCP port</td></tr>
<tr><td>name</td><td>&#10004;</td><td>string</td><td>VPCS device name</td></tr>
<tr><td>vpcs_id</td><td>&#10004;</td><td>integer</td><td>VPCS device instance ID</td></tr>
</table>
PUT /vpcs/{vpcs_id}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update VPCS informations
Parameters
**********
- **vpcs_id**: Id of VPCS instance
Response status codes
**************************
- **200**: OK
Input
*******
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>console</td><td>&#10004;</td><td>integer</td><td>console TCP port</td></tr>
<tr><td>name</td><td>&#10004;</td><td>string</td><td>VPCS device name</td></tr>
<tr><td>vpcs_id</td><td>&#10004;</td><td>integer</td><td>VPCS device instance ID</td></tr>
</table>
Output
*******
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>console</td><td>&#10004;</td><td>integer</td><td>console TCP port</td></tr>
<tr><td>name</td><td>&#10004;</td><td>string</td><td>VPCS device name</td></tr>
<tr><td>vpcs_id</td><td>&#10004;</td><td>integer</td><td>VPCS device instance ID</td></tr>
</table>
+127
View File
@@ -0,0 +1,127 @@
/vpcs/{vpcs_id}/nio
------------------------------
.. contents::
POST /vpcs/{vpcs_id}/nio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ADD NIO to a VPCS
Parameters
**********
- **vpcs_id**: Id of VPCS instance
Response status codes
**************************
- **201**: Success of creation of NIO
- **409**: Conflict
Input
*******
Types
+++++++++
Ethernet
^^^^^^^^^^^^^^^^
Generic Ethernet Network Input/Output
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>ethernet_device</td><td>&#10004;</td><td>string</td><td>Ethernet device name e.g. eth0</td></tr>
<tr><td>type</td><td>&#10004;</td><td>enum</td><td>Possible values: nio_generic_ethernet</td></tr>
</table>
LinuxEthernet
^^^^^^^^^^^^^^^^
Linux Ethernet Network Input/Output
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>ethernet_device</td><td>&#10004;</td><td>string</td><td>Ethernet device name e.g. eth0</td></tr>
<tr><td>type</td><td>&#10004;</td><td>enum</td><td>Possible values: nio_linux_ethernet</td></tr>
</table>
NULL
^^^^^^^^^^^^^^^^
NULL Network Input/Output
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>type</td><td>&#10004;</td><td>enum</td><td>Possible values: nio_null</td></tr>
</table>
TAP
^^^^^^^^^^^^^^^^
TAP Network Input/Output
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>tap_device</td><td>&#10004;</td><td>string</td><td>TAP device name e.g. tap0</td></tr>
<tr><td>type</td><td>&#10004;</td><td>enum</td><td>Possible values: nio_tap</td></tr>
</table>
UDP
^^^^^^^^^^^^^^^^
UDP Network Input/Output
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>lport</td><td>&#10004;</td><td>integer</td><td>Local port</td></tr>
<tr><td>rhost</td><td>&#10004;</td><td>string</td><td>Remote host</td></tr>
<tr><td>rport</td><td>&#10004;</td><td>integer</td><td>Remote port</td></tr>
<tr><td>type</td><td>&#10004;</td><td>enum</td><td>Possible values: nio_udp</td></tr>
</table>
UNIX
^^^^^^^^^^^^^^^^
UNIX Network Input/Output
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>local_file</td><td>&#10004;</td><td>string</td><td>path to the UNIX socket file (local)</td></tr>
<tr><td>remote_file</td><td>&#10004;</td><td>string</td><td>path to the UNIX socket file (remote)</td></tr>
<tr><td>type</td><td>&#10004;</td><td>enum</td><td>Possible values: nio_unix</td></tr>
</table>
VDE
^^^^^^^^^^^^^^^^
VDE Network Input/Output
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>control_file</td><td>&#10004;</td><td>string</td><td>path to the VDE control file</td></tr>
<tr><td>local_file</td><td>&#10004;</td><td>string</td><td>path to the VDE control file</td></tr>
<tr><td>type</td><td>&#10004;</td><td>enum</td><td>Possible values: nio_vde</td></tr>
</table>
Body
+++++++++
.. raw:: html
<table>
<tr><th>Name</th><th>Mandatory</th><th>Type</th><th>Description</th></tr>
<tr><td>id</td><td>&#10004;</td><td>integer</td><td>VPCS device instance ID</td></tr>
<tr><td>nio</td><td>&#10004;</td><td>UDP, Ethernet, LinuxEthernet, TAP, UNIX, VDE, NULL</td><td>Network Input/Output</td></tr>
<tr><td>port</td><td>&#10004;</td><td>integer</td><td>Port number</td></tr>
<tr><td>port_id</td><td>&#10004;</td><td>integer</td><td>Unique port identifier for the VPCS instance</td></tr>
</table>
Sample session
***************
.. literalinclude:: examples/post_vpcsvpcsidnio.txt