mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 03:08:14 +00:00
Get informations about a VPCS instance
This commit is contained in:
parent
ce9fd3cb25
commit
7abb426d04
22
docs/api/examples/get_vpcsuuid.txt
Normal file
22
docs/api/examples/get_vpcsuuid.txt
Normal file
@ -0,0 +1,22 @@
|
||||
curl -i -X GET 'http://localhost:8000/vpcs/{uuid}'
|
||||
|
||||
GET /vpcs/{uuid} HTTP/1.1
|
||||
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 213
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /vpcs/{uuid}
|
||||
|
||||
{
|
||||
"console": 2001,
|
||||
"name": "PC TEST 1",
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"script_file": null,
|
||||
"startup_script": null,
|
||||
"uuid": "40f76457-de2b-4399-8853-a35393a72a2d"
|
||||
}
|
15
docs/api/examples/post_virtualboxuuidstart.txt
Normal file
15
docs/api/examples/post_virtualboxuuidstart.txt
Normal file
@ -0,0 +1,15 @@
|
||||
curl -i -X POST 'http://localhost:8000/virtualbox/{uuid}/start' -d '{}'
|
||||
|
||||
POST /virtualbox/{uuid}/start HTTP/1.1
|
||||
{}
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 2
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /virtualbox/{uuid}/start
|
||||
|
||||
{}
|
15
docs/api/examples/post_virtualboxuuidstop.txt
Normal file
15
docs/api/examples/post_virtualboxuuidstop.txt
Normal file
@ -0,0 +1,15 @@
|
||||
curl -i -X POST 'http://localhost:8000/virtualbox/{uuid}/stop' -d '{}'
|
||||
|
||||
POST /virtualbox/{uuid}/stop HTTP/1.1
|
||||
{}
|
||||
|
||||
|
||||
HTTP/1.1 200
|
||||
CONNECTION: close
|
||||
CONTENT-LENGTH: 2
|
||||
CONTENT-TYPE: application/json
|
||||
DATE: Thu, 08 Jan 2015 16:09:15 GMT
|
||||
SERVER: Python/3.4 aiohttp/0.13.1
|
||||
X-ROUTE: /virtualbox/{uuid}/stop
|
||||
|
||||
{}
|
@ -21,5 +21,5 @@ X-ROUTE: /vpcs
|
||||
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
|
||||
"script_file": null,
|
||||
"startup_script": null,
|
||||
"uuid": "6370f75e-0a48-4e2b-95a8-0140da6ef1fb"
|
||||
"uuid": "a022aa0d-acab-4554-b2a6-6e6f51c9d65e"
|
||||
}
|
||||
|
@ -50,6 +50,23 @@ class VPCSHandler:
|
||||
startup_script=request.json.get("startup_script"))
|
||||
response.json(vm)
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/vpcs/{uuid}",
|
||||
parameters={
|
||||
"uuid": "VPCS instance UUID"
|
||||
},
|
||||
status_codes={
|
||||
200: "VPCS instance started",
|
||||
404: "VPCS instance doesn't exist"
|
||||
},
|
||||
description="Get a VPCS instance")
|
||||
def show(request, response):
|
||||
|
||||
vpcs_manager = VPCS.instance()
|
||||
vm = vpcs_manager.get_vm(request.match_info["uuid"])
|
||||
response.json(vm)
|
||||
|
||||
@classmethod
|
||||
@Route.post(
|
||||
r"/vpcs/{uuid}/start",
|
||||
|
@ -39,6 +39,14 @@ def test_vpcs_create(server, project):
|
||||
assert response.json["script_file"] is None
|
||||
|
||||
|
||||
def test_vpcs_get(server, project, vm):
|
||||
response = server.get("/vpcs/{}".format(vm["uuid"]), example=True)
|
||||
assert response.status == 200
|
||||
assert response.route == "/vpcs/{uuid}"
|
||||
assert response.json["name"] == "PC TEST 1"
|
||||
assert response.json["project_uuid"] == project.uuid
|
||||
|
||||
|
||||
def test_vpcs_create_script_file(server, project, tmpdir):
|
||||
path = os.path.join(str(tmpdir), "test")
|
||||
with open(path, 'w+') as f:
|
||||
|
Loading…
Reference in New Issue
Block a user