mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-17 22:08:35 +00:00
Duplicate API for ATM, Ethernet Hub and Frame Relay Switch
Fix https://github.com/GNS3/gns3-gui/issues/1065
This commit is contained in:
parent
bb90c0ba52
commit
d69475cd44
@ -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={
|
||||
|
@ -20,7 +20,6 @@ import os
|
||||
from gns3server.web.route import Route
|
||||
from gns3server.schemas.node import NODE_CAPTURE_SCHEMA
|
||||
from gns3server.schemas.nio import NIO_SCHEMA
|
||||
from gns3server.compute.builtin import Builtin
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
|
||||
from gns3server.schemas.ethernet_hub import (
|
||||
@ -82,6 +81,26 @@ class EthernetHubHandler:
|
||||
|
||||
response.json(node)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/ethernet_hub/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 ethernet hub 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}/ethernet_hub/nodes/{node_id}",
|
||||
parameters={
|
||||
|
@ -79,6 +79,26 @@ class FrameRelaySwitchHandler:
|
||||
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}/frame_relay_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 a frame relay 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}/frame_relay_switch/nodes/{node_id}",
|
||||
parameters={
|
||||
|
Loading…
Reference in New Issue
Block a user