Duplicate API for ATM, Ethernet Hub and Frame Relay Switch

Fix https://github.com/GNS3/gns3-gui/issues/1065
This commit is contained in:
Julien Duponchelle
2017-07-25 16:51:49 +02:00
parent bb90c0ba52
commit d69475cd44
3 changed files with 72 additions and 13 deletions

View File

@ -53,10 +53,10 @@ class ATMSwitchHandler:
# Use the Dynamips ATM switch to simulate this node
dynamips_manager = Dynamips.instance()
node = yield from dynamips_manager.create_node(request.json.pop("name"),
request.match_info["project_id"],
request.json.get("node_id"),
node_type="atm_switch",
mappings=request.json.get("mappings"))
request.match_info["project_id"],
request.json.get("node_id"),
node_type="atm_switch",
mappings=request.json.get("mappings"))
response.set_status(201)
response.json(node)
@ -79,6 +79,26 @@ class ATMSwitchHandler:
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
response.json(node)
@Route.post(
r"/projects/{project_id}/atm_switch/nodes/{node_id}/duplicate",
parameters={
"project_id": "Project UUID",
"node_id": "Node UUID"
},
status_codes={
201: "Instance duplicated",
404: "Instance doesn't exist"
},
description="Duplicate an atm switch instance")
def duplicate(request, response):
new_node = yield from Dynamips.instance().duplicate_node(
request.match_info["node_id"],
request.json["destination_node_id"]
)
response.set_status(201)
response.json(new_node)
@Route.put(
r"/projects/{project_id}/atm_switch/nodes/{node_id}",
parameters={