def __init__(self, vbox, name): debugmsg( 2, "AnyVBoxEmuDevice::__init__(%s, %s)" % (unicode(vbox), unicode(name))) self.p = vbox #create a twin variable to self.p but with name self.dynamips to keep things working elsewhere self.dynamips = vbox self._instance = self._instance_count self._instance_count += 1 if name == None: self.name = 'vbox_emu' + str(self._instance) else: self.name = name self._image = None self._console = None self.state = 'stopped' self.defaults = { 'image': None, 'nics': 6, 'netcard': 'automatic', 'guestcontrol_user': None, 'guestcontrol_password': None, 'first_nic_managed': True, 'headless_mode': False, 'console_support': False, 'console_telnet_server': False, } self._nics = self.defaults['nics'] self._netcard = self.defaults['netcard'] self._capture = {} self._guestcontrol_user = self.defaults['guestcontrol_user'] self._guestcontrol_password = self.defaults['guestcontrol_password'] self._first_nic_managed = self.defaults['first_nic_managed'] self._headless_mode = self.defaults['headless_mode'] self._console_support = self.defaults['console_support'] self._console_telnet_server = self.defaults['console_telnet_server'] self.nios = {} for i in range(self._nics): self.nios[i] = None send(self.p, 'vbox create %s %s' % (self.vbox_dev_type, self.name)) self.p.devices.append(self) #set the console to VBox baseconsole self.track = tracker.portTracker() self._console = self.track.allocateTcpPort(self.p.host, self.p.baseconsole) send(self.p, 'vbox setattr %s console %i' % (self.name, self._console)) self.p.baseconsole += 1 self.starttime = int(time.time()) self.suspendtime = self.starttime self.stoptime = self.starttime self.waittime = 0
def __init__(self, vbox, name): debugmsg(2, "AnyVBoxEmuDevice::__init__(%s, %s)" % (unicode(vbox), unicode(name))) self.p = vbox #create a twin variable to self.p but with name self.dynamips to keep things working elsewhere self.dynamips = vbox self._instance = self._instance_count self._instance_count += 1 if name == None: self.name = 'vbox_emu' + str(self._instance) else: self.name = name self._image = None self._console = None self.state = 'stopped' self.defaults = { 'image': None, 'nics': 6, 'netcard': 'automatic', 'guestcontrol_user' : None, 'guestcontrol_password': None, 'first_nic_managed': True, 'headless_mode': False, 'console_support': False, 'console_telnet_server': False, } self._nics = self.defaults['nics'] self._netcard = self.defaults['netcard'] self._capture = {} self._guestcontrol_user = self.defaults['guestcontrol_user'] self._guestcontrol_password = self.defaults['guestcontrol_password'] self._first_nic_managed = self.defaults['first_nic_managed'] self._headless_mode = self.defaults['headless_mode'] self._console_support = self.defaults['console_support'] self._console_telnet_server = self.defaults['console_telnet_server'] self.nios = {} for i in range(self._nics): self.nios[i] = None send(self.p, 'vbox create %s %s' % (self.vbox_dev_type, self.name)) self.p.devices.append(self) #set the console to VBox baseconsole self.track = tracker.portTracker() self._console = self.track.allocateTcpPort(self.p.host, self.p.baseconsole) send(self.p, 'vbox setattr %s console %i' % (self.name, self._console)) self.p.baseconsole += 1 self.starttime = int(time.time()) self.suspendtime = self.starttime self.stoptime = self.starttime self.waittime = 0
def isLocalhost(self, i_host): if i_host in tracker.portTracker().local_addresses: return True else: return False