mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-17 06:48:18 +00:00
@ -52,10 +52,10 @@ class ATMSwitchHandler:
|
||||
|
||||
# Use the Dynamips ATM switch to simulate this node
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = yield from dynamips_manager.create_device(request.json.pop("name"),
|
||||
node = yield from dynamips_manager.create_node(request.json.pop("name"),
|
||||
request.match_info["project_id"],
|
||||
request.json.get("node_id"),
|
||||
device_type="atm_switch",
|
||||
node_type="atm_switch",
|
||||
mappings=request.json.get("mappings"))
|
||||
response.set_status(201)
|
||||
response.json(node)
|
||||
@ -76,7 +76,7 @@ class ATMSwitchHandler:
|
||||
def show(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = dynamips_manager.get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
response.json(node)
|
||||
|
||||
@Route.put(
|
||||
@ -97,7 +97,7 @@ class ATMSwitchHandler:
|
||||
def update(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = dynamips_manager.get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
if "name" in request.json and node.name != request.json["name"]:
|
||||
yield from node.set_name(request.json["name"])
|
||||
if "mappings" in request.json:
|
||||
@ -120,7 +120,7 @@ class ATMSwitchHandler:
|
||||
def delete(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
yield from dynamips_manager.delete_device(request.match_info["node_id"])
|
||||
yield from dynamips_manager.delete_node(request.match_info["node_id"])
|
||||
response.set_status(204)
|
||||
|
||||
@Route.post(
|
||||
@ -137,7 +137,7 @@ class ATMSwitchHandler:
|
||||
description="Start an ATM switch")
|
||||
def start(request, response):
|
||||
|
||||
Dynamips.instance().get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
Dynamips.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
response.set_status(204)
|
||||
|
||||
@Route.post(
|
||||
@ -154,7 +154,7 @@ class ATMSwitchHandler:
|
||||
description="Stop an ATM switch")
|
||||
def stop(request, response):
|
||||
|
||||
Dynamips.instance().get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
Dynamips.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
response.set_status(204)
|
||||
|
||||
@Route.post(
|
||||
@ -171,7 +171,7 @@ class ATMSwitchHandler:
|
||||
description="Suspend an ATM Relay switch")
|
||||
def suspend(request, response):
|
||||
|
||||
Dynamips.instance().get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
Dynamips.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
response.set_status(204)
|
||||
|
||||
@Route.post(
|
||||
@ -193,7 +193,7 @@ class ATMSwitchHandler:
|
||||
def create_nio(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = dynamips_manager.get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
nio = yield from dynamips_manager.create_nio(node, request.json)
|
||||
port_number = int(request.match_info["port_number"])
|
||||
yield from node.add_nio(nio, port_number)
|
||||
@ -217,7 +217,7 @@ class ATMSwitchHandler:
|
||||
def delete_nio(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = dynamips_manager.get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
port_number = int(request.match_info["port_number"])
|
||||
nio = yield from node.remove_nio(port_number)
|
||||
yield from nio.delete()
|
||||
@ -241,7 +241,7 @@ class ATMSwitchHandler:
|
||||
def start_capture(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = dynamips_manager.get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
port_number = int(request.match_info["port_number"])
|
||||
pcap_file_path = os.path.join(node.project.capture_working_directory(), request.json["capture_file_name"])
|
||||
yield from node.start_capture(port_number, pcap_file_path, request.json["data_link_type"])
|
||||
@ -264,7 +264,7 @@ class ATMSwitchHandler:
|
||||
def stop_capture(request, response):
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = dynamips_manager.get_device(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
port_number = int(request.match_info["port_number"])
|
||||
yield from node.stop_capture(port_number)
|
||||
response.set_status(204)
|
||||
|
Reference in New Issue
Block a user