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


Python modules.IModule类代码示例

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


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

示例1: __init__

    def __init__(self, name, *args, **kwargs):

        # get the VPCS location
        config = Config.instance()
        vpcs_config = config.get_section_config(name.upper())
        self._vpcs = vpcs_config.get("vpcs_path")
        if not self._vpcs or not os.path.isfile(self._vpcs):
            paths = [os.getcwd()] + os.environ["PATH"].split(os.pathsep)
            # look for VPCS in the current working directory and $PATH
            for path in paths:
                try:
                    if "vpcs" in os.listdir(path) and os.access(os.path.join(path, "vpcs"), os.X_OK):
                        self._vpcs = os.path.join(path, "vpcs")
                        break
                except OSError:
                    continue

        if not self._vpcs:
            log.warning("VPCS binary couldn't be found!")
        elif not os.access(self._vpcs, os.X_OK):
            log.warning("VPCS is not executable")

        # a new process start when calling IModule
        IModule.__init__(self, name, *args, **kwargs)
        self._vpcs_instances = {}
        self._console_start_port_range = vpcs_config.get("console_start_port_range", 4501)
        self._console_end_port_range = vpcs_config.get("console_end_port_range", 5000)
        self._allocated_udp_ports = []
        self._udp_start_port_range = vpcs_config.get("udp_start_port_range", 20501)
        self._udp_end_port_range = vpcs_config.get("udp_end_port_range", 21000)
        self._host = vpcs_config.get("host", kwargs["host"])
        self._console_host = vpcs_config.get("console_host", kwargs["console_host"])
        self._projects_dir = kwargs["projects_dir"]
        self._tempdir = kwargs["temp_dir"]
        self._working_dir = self._projects_dir
开发者ID:shaneutt,项目名称:gns3-server,代码行数:35,代码来源:__init__.py

示例2: __init__

    def __init__(self, name, *args, **kwargs):
        config = Config.instance()

        # a new process start when calling IModule
        IModule.__init__(self, name, *args, **kwargs)
        self._host = kwargs["host"]
        self._projects_dir = kwargs["projects_dir"]
        self._tempdir = kwargs["temp_dir"]
        self._working_dir = self._projects_dir
        self._heartbeat_file = "%s/heartbeat_file_for_gnsdms" % (
            self._tempdir)

        if 'heartbeat_file' in kwargs:
            self._heartbeat_file = kwargs['heartbeat_file']

        self._is_enabled = False
        try:
            cloud_config = Config.instance().get_section_config("CLOUD_SERVER")
            instance_id = cloud_config["instance_id"]
            cloud_user_name = cloud_config["cloud_user_name"]
            cloud_api_key = cloud_config["cloud_api_key"]
            self._is_enabled = True
        except KeyError:
            log.critical("Missing cloud.conf - disabling Deadman Switch")

        self._deadman_process = None
        self.heartbeat()
        self.start()
开发者ID:planctechnologies,项目名称:gns3-server,代码行数:28,代码来源:__init__.py

示例3: stop

    def stop(self):
        """
        Properly stops the module.
        """

        #if not sys.platform.startswith("win32"):
        #    self._callback.stop()
        if self._hypervisor_manager:
            self._hypervisor_manager.stop_all_hypervisors()
        IModule.stop(self)  # this will stop the I/O loop
开发者ID:fpena06,项目名称:gns3-server,代码行数:10,代码来源:__init__.py

示例4: stop

    def stop(self):
        """
        Properly stops the module.
        """

        # delete all IOU instances
        for iou_id in self._iou_instances:
            iou_instance = self._iou_instances[iou_id]
            iou_instance.delete()

        IModule.stop(self)  # this will stop the I/O loop
开发者ID:charlesnw1,项目名称:gns3-server,代码行数:11,代码来源:__init__.py

示例5: stop

    def stop(self, signum=None):
        """
        Properly stops the module.

        :param signum: signal number (if called by the signal handler)
        """

        # delete all QEMU instances
        for qemu_id in self._qemu_instances:
            qemu_instance = self._qemu_instances[qemu_id]
            qemu_instance.delete()

        IModule.stop(self, signum)  # this will stop the I/O loop
开发者ID:shmygov,项目名称:gns3-server,代码行数:13,代码来源:__init__.py

示例6: stop

    def stop(self, signum=None):
        """
        Properly stops the module.

        :param signum: signal number (if called by the signal handler)
        """

        # delete all VPCS instances
        for vpcs_id in self._vpcs_instances:
            vpcs_instance = self._vpcs_instances[vpcs_id]
            vpcs_instance.delete()

        IModule.stop(self, signum)  # this will stop the I/O loop
开发者ID:shaneutt,项目名称:gns3-server,代码行数:13,代码来源:__init__.py

示例7: stop

    def stop(self, signum=None):
        """
        Properly stops the module.

        :param signum: signal number (if called by the signal handler)
        """

        # delete all VirtualBox instances
        for vbox_id in self._vbox_instances:
            vbox_instance = self._vbox_instances[vbox_id]
            vbox_instance.delete()

        if self._vboxwrapper and self._vboxwrapper.started:
            self._vboxwrapper.stop()

        IModule.stop(self, signum)  # this will stop the I/O loop
开发者ID:mint22,项目名称:gns3-server,代码行数:16,代码来源:__init__.py

示例8: stop

    def stop(self, signum=None):
        """
        Properly stops the module.

        :param signum: signal number (if called by the signal handler)
        """

        if not sys.platform.startswith("win32"):
            self._callback.stop()

        # stop all Dynamips hypervisors
        if self._hypervisor_manager:
            self._hypervisor_manager.stop_all_hypervisors()

        self.delete_dynamips_files()

        IModule.stop(self, signum)  # this will stop the I/O loop
开发者ID:madkrell,项目名称:gns3-server,代码行数:17,代码来源:__init__.py

示例9: stop

    def stop(self, signum=None):
        """
        Properly stops the module.

        :param signum: signal number (if called by the signal handler)
        """

        if self._deadman_process == None:
            log.info("Deadman: Can't stop, is not currently running")

        log.debug("Deadman: Stopping process")

        self._deadman_process = self._stop_deadman_process()
        self._deadman_process = None
        #Jerry or Jeremy why do we do this? Won't this stop the I/O loop for
        #for everyone?
        IModule.stop(self, signum)  # this will stop the I/O loop
开发者ID:planctechnologies,项目名称:gns3-server,代码行数:17,代码来源:__init__.py

示例10: stop

    def stop(self, signum=None):
        """
        Properly stops the module.

        :param signum: signal number (if called by the signal handler)
        """

        self._iou_callback.stop()

        # delete all IOU instances
        for iou_id in self._iou_instances:
            iou_instance = self._iou_instances[iou_id]
            iou_instance.delete()

        self.delete_iourc_file()

        IModule.stop(self, signum)  # this will stop the I/O loop
开发者ID:joebowen,项目名称:gns3-server,代码行数:17,代码来源:__init__.py

示例11: __init__

    def __init__(self, name, *args, **kwargs):

        # a new process start when calling IModule
        IModule.__init__(self, name, *args, **kwargs)
        self._qemu_instances = {}

        config = Config.instance()
        qemu_config = config.get_section_config(name.upper())
        self._console_start_port_range = qemu_config.get("console_start_port_range", 5001)
        self._console_end_port_range = qemu_config.get("console_end_port_range", 5500)
        self._allocated_udp_ports = []
        self._udp_start_port_range = qemu_config.get("udp_start_port_range", 40001)
        self._udp_end_port_range = qemu_config.get("udp_end_port_range", 45500)
        self._host = qemu_config.get("host", kwargs["host"])
        self._projects_dir = kwargs["projects_dir"]
        self._tempdir = kwargs["temp_dir"]
        self._working_dir = self._projects_dir
开发者ID:grossmj,项目名称:gns3-server,代码行数:17,代码来源:__init__.py

示例12: __init__

    def __init__(self, name, *args, **kwargs):

        # get the iouyap location
        config = Config.instance()
        iou_config = config.get_section_config(name.upper())
        self._iouyap = iou_config.get("iouyap")
        if not self._iouyap or not os.path.isfile(self._iouyap):
            iouyap_in_cwd = os.path.join(os.getcwd(), "iouyap")
            if os.path.isfile(iouyap_in_cwd):
                self._iouyap = iouyap_in_cwd
            else:
                # look for iouyap if none is defined or accessible
                for path in os.environ["PATH"].split(":"):
                    try:
                        if "iouyap" in os.listdir(path) and os.access(os.path.join(path, "iouyap"), os.X_OK):
                            self._iouyap = os.path.join(path, "iouyap")
                            break
                    except OSError:
                        continue

        if not self._iouyap:
            log.warning("iouyap binary couldn't be found!")
        elif not os.access(self._iouyap, os.X_OK):
            log.warning("iouyap is not executable")

        # a new process start when calling IModule
        IModule.__init__(self, name, *args, **kwargs)
        self._iou_instances = {}
        self._console_start_port_range = 4001
        self._console_end_port_range = 4512
        self._allocated_udp_ports = []
        self._udp_start_port_range = 30001
        self._udp_end_port_range = 40001
        self._host = kwargs["host"]
        self._projects_dir = kwargs["projects_dir"]
        self._tempdir = kwargs["temp_dir"]
        self._working_dir = self._projects_dir
        self._iourc = ""

        # check every 5 seconds
        self._iou_callback = self.add_periodic_callback(self._check_iou_is_alive, 5000)
        self._iou_callback.start()
开发者ID:joebowen,项目名称:gns3-server,代码行数:42,代码来源:__init__.py

示例13: __init__

    def __init__(self, name, *args, **kwargs):

        IModule.__init__(self, name, *args, **kwargs)

        self._hypervisor_manager = None
        self._hypervisor_manager_settings = {}
        self._routers = {}
        self._ethernet_switches = {}
        self._frame_relay_switches = {}
        self._atm_switches = {}
        self._ethernet_hubs = {}
        self._projects_dir = kwargs["projects_dir"]
        self._tempdir = kwargs["temp_dir"]
        self._working_dir = self._projects_dir
        self._dynamips = ""
        self._host = kwargs["host"]

        if not sys.platform.startswith("win32"):
            #FIXME: pickle issues Windows
            self._callback = self.add_periodic_callback(self._check_hypervisors, 5000)
            self._callback.start()
开发者ID:madkrell,项目名称:gns3-server,代码行数:21,代码来源:__init__.py

示例14: __init__

    def __init__(self, name, *args, **kwargs):

        # get the vboxwrapper location (only non-Windows platforms)
        if not sys.platform.startswith("win"):
            config = Config.instance()
            vbox_config = config.get_section_config(name.upper())
            self._vboxwrapper_path = vbox_config.get("vboxwrapper_path")
            if not self._vboxwrapper_path or not os.path.isfile(self._vboxwrapper_path):
                paths = [os.getcwd()] + os.environ["PATH"].split(":")
                # look for iouyap in the current working directory and $PATH
                for path in paths:
                    try:
                        if "vboxwrapper" in os.listdir(path) and os.access(os.path.join(path, "vboxwrapper"), os.X_OK):
                            self._vboxwrapper_path = os.path.join(path, "vboxwrapper")
                            break
                    except OSError:
                        continue

            if not self._vboxwrapper_path:
                log.warning("vboxwrapper couldn't be found!")
            elif not os.access(self._vboxwrapper_path, os.X_OK):
                log.warning("vboxwrapper is not executable")

        # a new process start when calling IModule
        IModule.__init__(self, name, *args, **kwargs)
        self._vbox_instances = {}

        config = Config.instance()
        vbox_config = config.get_section_config(name.upper())
        self._console_start_port_range = vbox_config.get("console_start_port_range", 3501)
        self._console_end_port_range = vbox_config.get("console_end_port_range", 4000)
        self._allocated_udp_ports = []
        self._udp_start_port_range = vbox_config.get("udp_start_port_range", 35001)
        self._udp_end_port_range = vbox_config.get("udp_end_port_range", 35500)
        self._host = kwargs["host"]
        self._projects_dir = kwargs["projects_dir"]
        self._tempdir = kwargs["temp_dir"]
        self._working_dir = self._projects_dir
        self._vboxmanager = None
        self._vboxwrapper = None
开发者ID:mint22,项目名称:gns3-server,代码行数:40,代码来源:__init__.py

示例15: __init__

    def __init__(self, name, *args, **kwargs):

        # get the iouyap location
        config = Config.instance()
        iou_config = config.get_section_config(name.upper())
        self._iouyap = iou_config.get("iouyap")
        if not self._iouyap:
            for path in os.environ["PATH"].split(":"):
                if "iouyap" in os.listdir(path) and os.access("iouyap", os.X_OK):
                    self._iouyap = os.path.join(path, "iouyap")
                    break

        if not self._iouyap or not os.path.exists(self._iouyap):
            raise IOUError("iouyap binary couldn't be found!")

        if not os.access(self._iouyap, os.X_OK):
            raise IOUError("iouyap is not executable")

        # a new process start when calling IModule
        IModule.__init__(self, name, *args, **kwargs)
        self._remote_server = False
        self._iou_instances = {}
        self._console_start_port_range = 4001
        self._console_end_port_range = 4512
        self._current_console_port = self._console_start_port_range
        self._udp_start_port_range = 30001
        self._udp_end_port_range = 40001
        self._current_udp_port = self._udp_start_port_range
        self._host = "127.0.0.1"  # FIXME: used by ZeroMQ...
        self._projects_dir = kwargs["projects_dir"]
        self._tempdir = kwargs["temp_dir"]
        self._working_dir = self._projects_dir
        self._iourc = ""

        # check every 5 seconds
        self._iou_callback = self.add_periodic_callback(self._check_iou_is_alive, 5000)
        self._iou_callback.start()
开发者ID:charlesnw1,项目名称:gns3-server,代码行数:37,代码来源:__init__.py


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