本文整理汇总了Python中gns3server.compute.dynamips.Dynamips.instance方法的典型用法代码示例。如果您正苦于以下问题:Python Dynamips.instance方法的具体用法?Python Dynamips.instance怎么用?Python Dynamips.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gns3server.compute.dynamips.Dynamips
的用法示例。
在下文中一共展示了Dynamips.instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def update(request, response):
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
yield from dynamips_manager.update_vm_settings(vm, request.json)
vm.updated()
response.json(vm)
示例2: stream_pcap_file
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
async def stream_pcap_file(request, response):
dynamips_manager = Dynamips.instance()
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 = node.get_nio(port_number)
await dynamips_manager.stream_pcap_file(nio, node.project.id, request, response)
示例3: stop_capture
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
async def stop_capture(request, response):
dynamips_manager = Dynamips.instance()
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"])
await node.stop_capture(port_number)
response.set_status(204)
示例4: get_auto_idlepc
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def get_auto_idlepc(request, response):
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
idlepc = yield from dynamips_manager.auto_idlepc(vm)
response.set_status(200)
response.json({"idlepc": idlepc})
示例5: test_duplicate_ethernet_switch
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def test_duplicate_ethernet_switch(async_run, project):
with asyncio_patch('gns3server.compute.dynamips.nodes.ethernet_switch.EthernetSwitch.create'):
dynamips_manager = Dynamips.instance()
source_node_id = str(uuid.uuid4())
source_node = async_run(dynamips_manager.create_node("SW-1", project.id, source_node_id, node_type='ethernet_switch'))
destination_node_id = str(uuid.uuid4())
destination_node = async_run(dynamips_manager.create_node("SW-2", project.id, destination_node_id, node_type='ethernet_switch'))
async_run(dynamips_manager.duplicate_node(source_node_id, destination_node_id))
示例6: stop_capture
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def stop_capture(request, response):
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
slot_number = int(request.match_info["adapter_number"])
port_number = int(request.match_info["port_number"])
yield from vm.stop_capture(slot_number, port_number)
response.set_status(204)
示例7: duplicate
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
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)
示例8: show
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def show(request, response):
dynamips_manager = Dynamips.instance()
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
# builtin_manager = Builtin.instance()
# node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
response.json(node)
示例9: start_capture
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
async def start_capture(request, response):
dynamips_manager = Dynamips.instance()
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"])
await node.start_capture(port_number, pcap_file_path, request.json["data_link_type"])
response.json({"pcap_file_path": pcap_file_path})
示例10: get_idlepcs
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def get_idlepcs(request, response):
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
yield from vm.set_idlepc("0x0")
idlepcs = yield from vm.get_idle_pc_prop()
response.set_status(200)
response.json(idlepcs)
示例11: delete_nio
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
async def delete_nio(request, response):
dynamips_manager = Dynamips.instance()
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 = await node.remove_nio(port_number)
await nio.delete()
response.set_status(204)
示例12: stop_capture
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def stop_capture(request, response):
dynamips_manager = Dynamips.instance()
node = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
#builtin_manager = Builtin.instance()
#node = builtin_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)
示例13: delete_nio
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def delete_nio(request, response):
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
slot_number = int(request.match_info["adapter_number"])
port_number = int(request.match_info["port_number"])
nio = yield from vm.slot_remove_nio_binding(slot_number, port_number)
yield from nio.delete()
response.set_status(204)
示例14: create_nio
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def create_nio(request, response):
dynamips_manager = Dynamips.instance()
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)
response.set_status(201)
response.json(nio)
示例15: create_nio
# 需要导入模块: from gns3server.compute.dynamips import Dynamips [as 别名]
# 或者: from gns3server.compute.dynamips.Dynamips import instance [as 别名]
def create_nio(request, response):
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
nio = yield from dynamips_manager.create_nio(vm, request.json)
slot_number = int(request.match_info["adapter_number"])
port_number = int(request.match_info["port_number"])
yield from vm.slot_add_nio_binding(slot_number, port_number, nio)
response.set_status(201)
response.json(nio)