当前位置: 首页>>代码示例>>Python>>正文


Python builtin.Builtin类代码示例

本文整理汇总了Python中gns3server.compute.builtin.Builtin的典型用法代码示例。如果您正苦于以下问题:Python Builtin类的具体用法?Python Builtin怎么用?Python Builtin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Builtin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: stream_pcap_file

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:7,代码来源:nat_handler.py

示例2: delete_nio

    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)
开发者ID:athmane,项目名称:gns3-server,代码行数:7,代码来源:nat_handler.py

示例3: stop_capture

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:7,代码来源:nat_handler.py

示例4: start_capture

    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})
开发者ID:GNS3,项目名称:gns3-server,代码行数:8,代码来源:nat_handler.py

示例5: update

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:9,代码来源:nat_handler.py

示例6: create_nio

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:9,代码来源:nat_handler.py

示例7: create

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:10,代码来源:nat_handler.py

示例8: update_nio

    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)
开发者ID:athmane,项目名称:gns3-server,代码行数:10,代码来源:nat_handler.py

示例9: update_nio

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:11,代码来源:nat_handler.py

示例10: update_nio

    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)
开发者ID:athmane,项目名称:gns3-server,代码行数:16,代码来源:cloud_handler.py

示例11: create

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:17,代码来源:cloud_handler.py

示例12: show

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:5,代码来源:nat_handler.py

示例13: suspend

    def suspend(request, response):

        Builtin.instance().get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
        response.set_status(204)
开发者ID:GNS3,项目名称:gns3-server,代码行数:4,代码来源:nat_handler.py

示例14: delete

    async def delete(request, response):

        builtin_manager = Builtin.instance()
        await builtin_manager.delete_node(request.match_info["node_id"])
        response.set_status(204)
开发者ID:GNS3,项目名称:gns3-server,代码行数:5,代码来源:nat_handler.py

示例15: start

    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)
开发者ID:GNS3,项目名称:gns3-server,代码行数:5,代码来源:cloud_handler.py


注:本文中的gns3server.compute.builtin.Builtin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。