本文整理汇总了Python中gns3server.compute.builtin.Builtin.instance方法的典型用法代码示例。如果您正苦于以下问题:Python Builtin.instance方法的具体用法?Python Builtin.instance怎么用?Python Builtin.instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gns3server.compute.builtin.Builtin
的用法示例。
在下文中一共展示了Builtin.instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stream_pcap_file
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def stream_pcap_file(request, response):
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"])
nio = node.get_nio(port_number)
await builtin_manager.stream_pcap_file(nio, node.project.id, request, response)
示例2: delete_nio
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
def delete_nio(request, response):
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.remove_nio(port_number)
response.set_status(204)
示例3: stop_capture
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def stop_capture(request, response):
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"])
await node.stop_capture(port_number)
response.set_status(204)
示例4: start_capture
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def start_capture(request, response):
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"])
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})
示例5: update
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
def update(request, response):
builtin_manager = Builtin.instance()
node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
for name, value in request.json.items():
if hasattr(node, name) and getattr(node, name) != value:
setattr(node, name, value)
node.updated()
response.json(node)
示例6: create_nio
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def create_nio(request, response):
builtin_manager = Builtin.instance()
node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
nio = builtin_manager.create_nio(request.json)
port_number = int(request.match_info["port_number"])
await node.add_nio(nio, port_number)
response.set_status(201)
response.json(nio)
示例7: create
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def create(request, response):
builtin_manager = Builtin.instance()
node = await builtin_manager.create_node(request.json.pop("name"),
request.match_info["project_id"],
request.json.get("node_id"),
node_type="nat",
ports=request.json.get("ports_mapping"))
response.set_status(201)
response.json(node)
示例8: update_nio
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
def update_nio(request, response):
builtin_manager = Builtin.instance()
node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
nio = node.nios[int(request.match_info["adapter_number"])]
if "filters" in request.json and nio:
nio.filters = request.json["filters"]
yield from node.update_nio(int(request.match_info["port_number"]), nio)
response.set_status(201)
response.json(request.json)
示例9: update_nio
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def update_nio(request, response):
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"])
nio = node.get_nio(port_number)
if "filters" in request.json:
nio.filters = request.json["filters"]
await node.update_nio(port_number, nio)
response.set_status(201)
response.json(request.json)
示例10: update_nio
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
def update_nio(request, response):
builtin_manager = Builtin.instance()
node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
adapter_number = int(request.match_info["adapter_number"])
try:
nio = node.nios[adapter_number]
except KeyError:
raise HTTPConflict(text="NIO `{}` doesn't exist".format(adapter_number))
if "filters" in request.json and nio:
nio.filters = request.json["filters"]
yield from node.update_nio(int(request.match_info["port_number"]), nio)
response.set_status(201)
response.json(request.json)
示例11: create
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def create(request, response):
builtin_manager = Builtin.instance()
node = await builtin_manager.create_node(request.json.pop("name"),
request.match_info["project_id"],
request.json.get("node_id"),
node_type="cloud",
ports=request.json.get("ports_mapping"))
# add the remote console settings
node.remote_console_host = request.json.get("remote_console_host", node.remote_console_host)
node.remote_console_port = request.json.get("remote_console_port", node.remote_console_port)
node.remote_console_type = request.json.get("remote_console_type", node.remote_console_type)
node.remote_console_http_path = request.json.get("remote_console_http_path", node.remote_console_http_path)
response.set_status(201)
response.json(node)
示例12: show
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
def show(request, response):
builtin_manager = Builtin.instance()
node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
response.json(node)
示例13: suspend
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
def suspend(request, response):
Builtin.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
response.set_status(204)
示例14: delete
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def delete(request, response):
builtin_manager = Builtin.instance()
await builtin_manager.delete_node(request.match_info["node_id"])
response.set_status(204)
示例15: start
# 需要导入模块: from gns3server.compute.builtin import Builtin [as 别名]
# 或者: from gns3server.compute.builtin.Builtin import instance [as 别名]
async def start(request, response):
node = Builtin.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
await node.start()
response.set_status(204)