本文整理汇总了Python中gns3server.modules.IModule.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python IModule.__init__方法的具体用法?Python IModule.__init__怎么用?Python IModule.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gns3server.modules.IModule
的用法示例。
在下文中一共展示了IModule.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gns3server.modules import IModule [as 别名]
# 或者: from gns3server.modules.IModule import __init__ [as 别名]
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
示例2: __init__
# 需要导入模块: from gns3server.modules import IModule [as 别名]
# 或者: from gns3server.modules.IModule import __init__ [as 别名]
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()
示例3: __init__
# 需要导入模块: from gns3server.modules import IModule [as 别名]
# 或者: from gns3server.modules.IModule import __init__ [as 别名]
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
示例4: __init__
# 需要导入模块: from gns3server.modules import IModule [as 别名]
# 或者: from gns3server.modules.IModule import __init__ [as 别名]
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()
示例5: __init__
# 需要导入模块: from gns3server.modules import IModule [as 别名]
# 或者: from gns3server.modules.IModule import __init__ [as 别名]
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()
示例6: __init__
# 需要导入模块: from gns3server.modules import IModule [as 别名]
# 或者: from gns3server.modules.IModule import __init__ [as 别名]
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
示例7: __init__
# 需要导入模块: from gns3server.modules import IModule [as 别名]
# 或者: from gns3server.modules.IModule import __init__ [as 别名]
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()