當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。