mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-23 23:38:21 +00:00
Endpoint for getting information about a compute node
This commit is contained in:
parent
5280644327
commit
b46a0ff4ae
@ -60,6 +60,20 @@ class ComputeHandler:
|
||||
controller = Controller.instance()
|
||||
response.json([c for c in controller.computes.values()])
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/computes/{compute_id}",
|
||||
description="Get a compute node informations",
|
||||
status_codes={
|
||||
200: "Compute list"
|
||||
},
|
||||
output=COMPUTE_OBJECT_SCHEMA)
|
||||
def get(request, response):
|
||||
|
||||
controller = Controller.instance()
|
||||
compute = controller.get_compute(request.match_info["compute_id"])
|
||||
response.json(compute)
|
||||
|
||||
@classmethod
|
||||
@Route.post(
|
||||
r"/computes/shutdown",
|
||||
|
@ -36,6 +36,24 @@ def test_compute_create(http_controller, controller):
|
||||
assert controller.computes["my_compute_id"].host == "example.com"
|
||||
|
||||
|
||||
def test_compute_get(http_controller, controller):
|
||||
|
||||
params = {
|
||||
"compute_id": "my_compute_id",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
}
|
||||
response = http_controller.post("/computes", params)
|
||||
assert response.status == 201
|
||||
|
||||
response = http_controller.get("/computes/my_compute_id", example=True)
|
||||
assert response.status == 200
|
||||
assert response.json["protocol"] == "http"
|
||||
|
||||
|
||||
def test_compute_list(http_controller, controller):
|
||||
|
||||
params = {
|
||||
|
Loading…
Reference in New Issue
Block a user