mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-18 07:18:18 +00:00
Ethernet hub and Ethernet switch almost fully migrated to the new API.
This commit is contained in:
@ -56,7 +56,8 @@ class EthernetHubHandler:
|
||||
node = yield from dynamips_manager.create_device(request.json.pop("name"),
|
||||
request.match_info["project_id"],
|
||||
request.json.get("node_id"),
|
||||
device_type="ethernet_hub")
|
||||
device_type="ethernet_hub",
|
||||
ports=request.json.get("ports"))
|
||||
|
||||
# On Linux, use the generic hub
|
||||
# builtin_manager = Builtin.instance()
|
||||
@ -109,6 +110,10 @@ class EthernetHubHandler:
|
||||
|
||||
dynamips_manager = Dynamips.instance()
|
||||
node = dynamips_manager.get_device(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 "ports" in request.json:
|
||||
node.ports = request.json["ports"]
|
||||
|
||||
# builtin_manager = Builtin.instance()
|
||||
# node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
@ -157,10 +162,7 @@ class EthernetHubHandler:
|
||||
node = dynamips_manager.get_device(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"])
|
||||
port_settings = request.json.get("port_settings")
|
||||
yield from node.add_nio(nio, port_number)
|
||||
if port_settings:
|
||||
yield from node.set_port_settings(port_number, port_settings)
|
||||
|
||||
#builtin_manager = Builtin.instance()
|
||||
#node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
|
Reference in New Issue
Block a user