def __clearConfiguration(self):

        reply = QtGui.QMessageBox.question(
            globals.preferencesWindow,
            translate("UiConfig_PreferencesGeneral", "Configuration file"),
            translate("UiConfig_PreferencesGeneral", "All GNS3 configuration will be lost. Do you want to proceed?"),
            QtGui.QMessageBox.Yes,
            QtGui.QMessageBox.No,
        )

        if reply == QtGui.QMessageBox.Yes:
            from __main__ import VERSION

            ConfDB().clear()
            c = ConfDB()
            c.set("GNS3/version", VERSION)
            c.sync()
            QtGui.QMessageBox.information(
                globals.preferencesWindow,
                translate("UiConfig_PreferencesGeneral", "Configuration file"),
                translate(
                    "UiConfig_PreferencesGeneral",
                    "Configuration file cleared, default settings will be applied after a restart",
                ),
            )
            globals.recordConfiguration = False
            globals.preferencesWindow.close()
Пример #2
0
 def __clearConfiguration(self):
 
     ConfDB().clear()
     c = ConfDB()
     c.set('GNS3/version', VERSION_INTEGER)
     c.sync()
     QtGui.QMessageBox.information(globals.preferencesWindow, translate("UiConfig_PreferencesGeneral", "Configuration file"),  
                                   translate("UiConfig_PreferencesGeneral", "Configuration file cleared, default settings will be applied after a restart"))
     globals.recordConfiguration = False
     globals.preferencesWindow.close()
    def __importConfiguration(self):

        config_path = os.path.normpath(unicode(ConfDB().fileName()))
        (path,
         selected) = fileBrowser(translate("UiConfig_PreferencesGeneral",
                                           "Import configuration"),
                                 filter='INI file (*.ini);;All files (*.*)',
                                 directory=os.path.dirname(config_path),
                                 parent=globals.preferencesWindow).getFile()

        if path != None and path != '':
            path = os.path.normpath(path)
            try:
                shutil.copyfile(path, config_path)
            except (OSError, IOError), e:
                QtGui.QMessageBox.critical(
                    globals.preferencesWindow,
                    translate("UiConfig_PreferencesGeneral",
                              "Import configuration"),
                    translate("UiConfig_PreferencesGeneral",
                              "Cannot export configuration file: %s") %
                    e.strerror)
                return
            except shutil.Error, e:
                QtGui.QMessageBox.critical(
                    globals.preferencesWindow,
                    translate("UiConfig_PreferencesGeneral",
                              "Import configuration"),
                    translate("UiConfig_PreferencesGeneral", "%s") % e)
                return
    def saveConf(self):

        # VBoxwrapper
        self.conf.vboxwrapper_path = unicode(self.lineEditVBoxwrapperPath.text(), 'utf-8', errors='replace')
        self.conf.vboxwrapper_workdir = unicode(self.lineEditVBoxwrapperWorkdir.text(), 'utf-8', errors='replace')
        self.conf.external_hosts = self.external_hosts
        self.conf.VBoxManager_binding = unicode(self.comboBoxBinding.currentText(), 'utf-8', errors='replace')

        if self.checkBoxUseVBoxVMNames.checkState() == QtCore.Qt.Checked:
            self.conf.use_VBoxVmnames = True
        else:
            self.conf.use_VBoxVmnames = False
        if self.checkBoxEnableVBoxManager.checkState() == QtCore.Qt.Checked:
            self.conf.enable_VBoxManager = True
        else:
            self.conf.enable_VBoxManager = False
        if self.checkBoxVBoxManagerImport.checkState() == QtCore.Qt.Checked:
            self.conf.import_use_VBoxManager = True
        else:
            self.conf.import_use_VBoxManager = False
        if self.VBoxcheckBoxEnableGuestControl.checkState() == QtCore.Qt.Checked:
            self.conf.enable_GuestControl = True
        else:
            self.conf.enable_GuestControl = False

        self.conf.vboxwrapper_port = self.port.value()
        self.conf.vboxwrapper_baseUDP = self.baseUDP.value()
        self.conf.vboxwrapper_baseConsole = self.baseConsole.value()

        globals.GApp.systconf['vbox'] = self.conf
        ConfDB().sync()

        return True
    def __clearConfiguration(self):

        reply = QtGui.QMessageBox.question(
            globals.preferencesWindow,
            translate("UiConfig_PreferencesGeneral", "Configuration file"),
            translate(
                "UiConfig_PreferencesGeneral",
                "All GNS3 configuration will be lost. Do you want to proceed?"
            ), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)

        if reply == QtGui.QMessageBox.Yes:
            from __main__ import VERSION
            ConfDB().clear()
            c = ConfDB()
            c.set('GNS3/version', VERSION)
            c.sync()
            QtGui.QMessageBox.information(
                globals.preferencesWindow,
                translate("UiConfig_PreferencesGeneral", "Configuration file"),
                translate(
                    "UiConfig_PreferencesGeneral",
                    "Configuration file cleared, default settings will be applied after a restart"
                ))
            globals.recordConfiguration = False
            globals.preferencesWindow.close()
Пример #6
0
    def _startupLoading(self):

        confo = self.systconf['general']
        force_clear_configuration = True
        version = ConfDB().get('GNS3/version', '0.0.1')
        try:
            # trick to test old version format (integer), before 0.8.2.1 release
            int(version)
        except ValueError:
            force_clear_configuration = False

        #for future releases
        if LooseVersion(VERSION) > str(version):
            # reset the tips dialog
            if self.mainWindow.tips_dialog:
                self.mainWindow.tips_dialog.checkBoxDontShowAgain.setChecked(False)

        if force_clear_configuration:
            self.mainWindow.raise_()
            reply = QMessageBox.question(self.mainWindow, translate("Application", "GNS3 configuration file"),
                                        translate("Application", "You have installed a new GNS3 version.\nIt is recommended to clear your old configuration, do you want to proceed?"), QMessageBox.Yes, QMessageBox.No)
            if reply == QMessageBox.Yes:
                ConfDB().clear()
                c = ConfDB()
                c.set('GNS3/version', VERSION)
                c.sync()
                globals.recordConfiguration = False
                QMessageBox.information(self.mainWindow, translate("Application", "GNS3 configuration file"), translate("Application", "Configuration cleared!\nPlease restart GNS3"))
        else:
            # if we cannot find our config file, we start the Wizard dialog
            configFile = unicode(ConfDB().fileName(), 'utf-8', errors='replace')
            if not os.access(configFile, os.F_OK):
                dialog = Wizard(parent=self.mainWindow)
                dialog.setModal(True)
                dialog.show()
            else:
                if self._file:
                    self.mainWindow.load_netfile(self._file, load_instructions=True)
                elif confo.project_startup and os.access(configFile, os.F_OK):
                    dialog = ProjectDialog(parent=self.mainWindow, newProject=True)
                    dialog.setModal(True)
                    dialog.show()
                    if self.mainWindow.tips_dialog and self.mainWindow.tips_dialog.checkBoxDontShowAgain.isChecked() == False:
                        self.showTipsDialog()
                else:
                    self.mainWindow.createProject((None, None, None, False, False))
                    self.mainWindow.raise_()
                    if self.mainWindow.tips_dialog and self.mainWindow.tips_dialog.checkBoxDontShowAgain.isChecked() == False:
                        self.showTipsDialog()
    def saveConf(self):

        self.conf.workdir = unicode(self.CaptureWorkingDirectory.text(),
                                    'utf-8',
                                    errors='replace')
        self.conf.cap_cmd = unicode(self.CaptureCommand.text(),
                                    'utf-8',
                                    errors='replace')

        if self.checkBoxStartCaptureCommand.checkState() == QtCore.Qt.Checked:
            self.conf.auto_start = True
        else:
            self.conf.auto_start = False
        globals.GApp.systconf['capture'] = self.conf
        ConfDB().sync()

        return True
    def loadConf(self):

        if globals.GApp.systconf.has_key('general'):
            self.conf = globals.GApp.systconf['general']
        else:
            self.conf = systemGeneralConf()

        curr_lang_code = self.conf.lang

        # Set the languages comboBox the the right value.
        idx = 0
        for i in self.langs:
            if i[0] == curr_lang_code:
                self.langsBox.setCurrentIndex(idx)
            idx += 1

        # Slow start when starting every devices
        self.slowStartAll.setValue(self.conf.slow_start)

        # Autosave
        self.autoSave.setValue(self.conf.autosave)

        # Set default terminal command
        if self.conf.term_cmd == '':
            self.conf.term_cmd = TERMINAL_DEFAULT_CMD

        # Set default terminal command
        if self.conf.term_serial_cmd == '':
            self.conf.term_serial_cmd = TERMINAL_SERIAL_DEFAULT_CMD

        # Set default project dir
        if self.conf.project_path == '':
            self.conf.project_path = PROJECT_DEFAULT_DIR

        # Set default IOS image dir
        if self.conf.ios_path == '':
            self.conf.ios_path = IOS_DEFAULT_DIR

        self.lineEditTermCommand.setText(self.conf.term_cmd)
        self.lineEditTermCommandVBoxConsole.setText(self.conf.term_serial_cmd)
        self.ProjectPath.setText(os.path.normpath(self.conf.project_path))
        self.IOSPath.setText(os.path.normpath(self.conf.ios_path))

        # GUI settings
        self.workspaceWidth.setValue(self.conf.scene_width)
        self.workspaceHeight.setValue(self.conf.scene_height)

        if self.conf.status_points == True:
            self.checkBoxShowStatusPoints.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxShowStatusPoints.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.manual_connection == True:
            self.checkBoxManualConnections.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxManualConnections.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.use_shell == True:
            self.checkBoxUseShell.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxUseShell.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.bring_console_to_front == True:
            self.checkBoxBringConsoleToFront.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxBringConsoleToFront.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.project_startup == True:
            self.checkBoxProjectDialog.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxProjectDialog.setCheckState(QtCore.Qt.Unchecked)

        if self.conf.draw_selected_rectangle == True:
            self.checkBoxDrawRectangle.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxDrawRectangle.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.term_close_on_delete == True:
            self.checkBoxCloseTermPrograms.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxCloseTermPrograms.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.relative_paths == True:
            self.checkBoxRelativePaths.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxRelativePaths.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.auto_screenshot == True:
            self.checkBoxAutoScreenshot.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxAutoScreenshot.setCheckState(QtCore.Qt.Unchecked)
        if self.conf.auto_check_for_update == True:
            self.checkBoxCheckForUpdate.setCheckState(QtCore.Qt.Checked)
        else:
            self.checkBoxCheckForUpdate.setCheckState(QtCore.Qt.Unchecked)

        self.labelConfigurationPath.setText(
            os.path.normpath(unicode(ConfDB().fileName())))

        # Delay between console starts
        self.doubleSpinBoxConsoleDelay.setValue(self.conf.console_delay)
                    self.conf.ios_path + os.sep + 'baseconfig_sw.txt')
                debug("Copying %s to %s" %
                      (BASECONFIG_DIR + 'baseconfig_sw.txt',
                       self.conf.ios_path + os.sep + 'baseconfig_sw.txt'))
        except (OSError, IOError), e:
            debug("Warning: cannot copy baseconfig_sw.txt to " +
                  self.conf.ios_path + ": " + e.strerror)

        # Apply scene size
        globals.GApp.topology.setSceneRect(-(self.conf.scene_width / 2),
                                           -(self.conf.scene_height / 2),
                                           self.conf.scene_width,
                                           self.conf.scene_height)

        globals.GApp.systconf['general'] = self.conf
        ConfDB().sync()

        globals.GApp.mainWindow.updateAction_addLink()
        return True

    def __setProjectPath(self):

        project_default_directory = '.'
        if os.path.exists(globals.GApp.systconf['general'].project_path):
            project_default_directory = globals.GApp.systconf[
                'general'].project_path
        elif sys.platform.startswith('win') and os.environ.has_key(
                "HOMEDRIVE") and os.environ.has_key("HOMEPATH"):
            project_default_directory = os.environ["HOMEDRIVE"] + os.environ[
                "HOMEPATH"]
        elif os.environ.has_key("HOME"):
Пример #10
0
    def syncConf(self):
        """ Sync current application config with config file (gns3.{ini,conf})
        """

        c = ConfDB()
        c.set('GNS3/version', VERSION)

        # Apply general settings
        confo = self.systconf['general']
        c.set('GNS3/lang', confo.lang)
        c.set('GNS3/project_startup', confo.project_startup)
        c.set('GNS3/relative_paths', confo.relative_paths)
        c.set('GNS3/auto_screenshot', confo.auto_screenshot)
        c.set('GNS3/slow_start', confo.slow_start)
        c.set('GNS3/autosave', confo.autosave)
        c.set('GNS3/console', confo.term_cmd)
        c.set('GNS3/serial_console', confo.term_serial_cmd)
        c.set('GNS3/term_close_on_delete', confo.term_close_on_delete)
        c.set('GNS3/use_shell', confo.use_shell)
        c.set('GNS3/bring_console_to_front', confo.bring_console_to_front)
        c.set('GNS3/gui_show_status_points', confo.status_points)
        c.set('GNS3/gui_use_manual_connection', confo.manual_connection)
        c.set('GNS3/gui_draw_selected_rectangle', confo.draw_selected_rectangle)
        c.set('GNS3/project_directory', confo.project_path)
        c.set('GNS3/ios_directory', confo.ios_path)
        c.set('GNS3/scene_width', confo.scene_width)
        c.set('GNS3/scene_height', confo.scene_height)
        c.set('GNS3/auto_check_for_update', confo.auto_check_for_update)
        c.set('GNS3/last_check_for_update', confo.last_check_for_update)
        c.set('GNS3/console_delay', confo.console_delay)
        c.set('GNS3/debug_level', globals.debugLevel)

        # Dynamips settings
        confo = self.systconf['dynamips']
        c.set('Dynamips/hypervisor_path', confo.path)
        c.set('Dynamips/hypervisor_port', confo.port)
        c.set('Dynamips/hypervisor_baseUDP', confo.baseUDP)
        c.set('Dynamips/hypervisor_baseConsole', confo.baseConsole)
        c.set('Dynamips/hypervisor_baseAUX', confo.baseAUX)
        c.set('Dynamips/hypervisor_working_directory', confo.workdir)
        c.set('Dynamips/clean_working_directory', confo.clean_workdir)
        c.set('Dynamips/dynamips_ghosting', confo.ghosting)
        c.set('Dynamips/dynamips_sparsemem', confo.sparsemem)
        c.set('Dynamips/dynamips_jitsharing', confo.jitsharing)
        c.set('Dynamips/dynamips_mmap', confo.mmap)
        c.set('Dynamips/hypervisor_memory_usage_limit', confo.memory_limit)
        c.set('Dynamips/detected_version', confo.detected_version)
        c.set('Dynamips/hypervisor_udp_incrementation', confo.udp_incrementation)
        c.set('Dynamips/hypervisor_manager_import', confo.import_use_HypervisorManager)
        c.set('Dynamips/allocate_hypervisor_per_IOS', confo.allocateHypervisorPerIOS)
        c.set('Dynamips/hypervisor_manager_binding', confo.HypervisorManager_binding)

        # Qemu config
        confo = self.systconf['qemu']
        c.set('Qemu/qemuwrapper_path', confo.qemuwrapper_path)
        c.set('Qemu/qemuwrapper_working_directory', confo.qemuwrapper_workdir)
        c.set('Qemu/qemu_path', confo.qemu_path)
        c.set('Qemu/qemu_img_path', confo.qemu_img_path)
        external_hosts = ','.join(confo.external_hosts)
        c.set('Qemu/external_hosts', external_hosts)
        c.set('Qemu/enable_QemuWrapperAdvOptions', confo.enable_QemuWrapperAdvOptions)
        c.set('Qemu/enable_QemuManager', confo.enable_QemuManager)
        c.set('Qemu/qemu_manager_import', confo.import_use_QemuManager)
        c.set('Qemu/qemu_manager_binding', confo.QemuManager_binding)
        c.set('Qemu/send_paths_external_Qemuwrapper', confo.send_path_external_QemuWrapper)
        c.set('Qemu/qemuwrapper_port', confo.qemuwrapper_port)
        c.set('Qemu/qemuwrapper_baseUDP', confo.qemuwrapper_baseUDP)
        c.set('Qemu/qemuwrapper_baseConsole', confo.qemuwrapper_baseConsole)

        # VBox config
        confo = self.systconf['vbox']
        c.set('VBox/vboxwrapper_path', confo.vboxwrapper_path)
        c.set('VBox/vboxwrapper_working_directory', confo.vboxwrapper_workdir)
        external_hosts = ','.join(confo.external_hosts)
        c.set('VBox/external_hosts', external_hosts)
        c.set('VBox/use_VBoxVmnames', confo.use_VBoxVmnames)
        c.set('VBox/enable_VBoxWrapperAdvOptions', confo.enable_VBoxWrapperAdvOptions)
        c.set('VBox/enable_VBoxAdvOptions', confo.enable_VBoxAdvOptions)
        c.set('VBox/enable_GuestControl', confo.enable_GuestControl)
        c.set('VBox/enable_VBoxManager', confo.enable_VBoxManager)
        c.set('VBox/vbox_manager_import', confo.import_use_VBoxManager)
        c.set('VBox/vbox_manager_binding', confo.VBoxManager_binding)
        c.set('VBox/vboxwrapper_port', confo.vboxwrapper_port)
        c.set('VBox/vboxwrapper_baseUDP', confo.vboxwrapper_baseUDP)
        c.set('VBox/vboxwrapper_baseConsole', confo.vboxwrapper_baseConsole)

        # Capture settings
        confo = self.systconf['capture']
        c.set('Capture/working_directory', confo.workdir)
        c.set('Capture/capture_reader_cmd', confo.cap_cmd)
        c.set('Capture/auto_start_cmd', confo.auto_start)

        # Clear IOS.hypervisors, IOS.images and QEMU.images group
        c.beginGroup("IOS.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("IOS.hypervisors")
        c.remove("")
        c.endGroup()

        c.beginGroup("QEMU.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("VBOX.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("PIX.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("JUNOS.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("ASA.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("AWP.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("IDS.images")
        c.remove("")
        c.endGroup()

        # Clear Symbol.libraries group
        c.beginGroup("Symbol.libraries")
        c.remove("")
        c.endGroup()

        # Clear Recent.files group
        c.beginGroup("Recent.files")
        c.remove("")
        c.endGroup()

        # Clear Symbol.libraries group
        c.beginGroup("Symbol.settings")
        c.remove("")
        c.endGroup()

        # IOS Images
        for (key, o) in self.__iosimages.iteritems():
            basekey = "IOS.images/" + str(o.id)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/chassis", o.chassis)
            c.set(basekey + "/platform", o.platform)
            c.set(basekey + "/baseconfig", o.baseconfig)
            hypervisors = ''
            for hypervisor in o.hypervisors:
                hypervisors += hypervisor + ' '
            c.set(basekey + "/hypervisors", hypervisors.strip())
            c.set(basekey + "/default_ram", o.default_ram)
            c.set(basekey + "/idlepc", o.idlepc)
            c.set(basekey + "/idlemax", o.idlemax)
            c.set(basekey + "/idlesleep", o.idlesleep)
            c.set(basekey + "/default",  o.default)

        # Hypervisors
        for (key, o) in self.__hypervisors.iteritems():
            basekey = "IOS.hypervisors/" + str(o.id)
            c.set(basekey + "/host", o.host)
            c.set(basekey + "/port", o.port)
            c.set(basekey + "/working_directory", o.workdir)
            c.set(basekey + "/base_udp", o.baseUDP)
            c.set(basekey + "/base_console", o.baseConsole)
            c.set(basekey + "/base_aux", o.baseAUX)

        # Qemu images
        for (key, o) in self.__qemuimages.iteritems():
            basekey = "QEMU.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/usermod", o.usermod)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/flavor", o.flavor)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kvm", o.kvm)
            c.set(basekey + "/monitor", o.monitor)

        # VBox images
        for (key, o) in self.__vboximages.iteritems():
            basekey = "VBOX.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/first_nic_managed", o.first_nic_managed)
            c.set(basekey + "/headless_mode", o.headless_mode)
            c.set(basekey + "/console_support", o.console_support)
            c.set(basekey + "/console_telnet_server", o.console_telnet_server)
            c.set(basekey + "/guestcontrol_user", o.guestcontrol_user)
            c.set(basekey + "/guestcontrol_password", o.guestcontrol_password)

        # PIX images
        for (key, o) in self.__piximages.iteritems():
            basekey = "PIX.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/key", o.key)
            c.set(basekey + "/serial", o.serial)

        # JunOS images
        for (key, o) in self.__junosimages.iteritems():
            basekey = "JUNOS.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/usermod", o.usermod)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kvm", o.kvm)
            c.set(basekey + "/monitor", o.monitor)

        # ASA images
        for (key, o) in self.__asaimages.iteritems():
            basekey = "ASA.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/usermod", o.usermod)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kvm", o.kvm)
            c.set(basekey + "/monitor", o.monitor)
            c.set(basekey + "/initrd", o.initrd)
            c.set(basekey + "/kernel", o.kernel)
            c.set(basekey + "/kernel_cmdline", o.kernel_cmdline)

        # AWP images
        for (key, o) in self.__awprouterimages.iteritems():
            basekey = "AWP.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kvm", o.kvm)
            c.set(basekey + "/initrd", o.initrd)
            c.set(basekey + "/kernel", o.kernel)
            c.set(basekey + "/rel", o.rel)
            c.set(basekey + "/kernel_cmdline", o.kernel_cmdline)

        # IDS images
        for (key, o) in self.__idsimages.iteritems():
            basekey = "IDS.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/image1", o.image1)
            c.set(basekey + "/image2", o.image2)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/usermod", o.usermod)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kvm", o.kvm)
            c.set(basekey + "/monitor", o.monitor)

        # Libraries
        id = 0
        for (key, o) in self.__libraries.iteritems():
            basekey = "Symbol.libraries/" + str(id)
            c.set(basekey + "/path", o.path)
            id += 1

        # Recent Files
        id = 0
        for o in self.__recentfiles:
            basekey = "Recent.files/" + str(id)
            c.set(basekey + "/path", o.path)
            id += 1

        # Symbols
        id = 0
        for symbol in SYMBOLS:
            if not symbol['translated']:
                basekey = "Symbol.settings/" + str(id)
                c.set(basekey + "/name", symbol['name'])
                c.set(basekey + "/type", SYMBOL_TYPES[symbol['object']])
                c.set(basekey + "/normal_svg_file", symbol['normal_svg_file'])
                c.set(basekey + "/selected_svg_file", symbol['select_svg_file'])
                id += 1

        c.sync()
Пример #11
0
    def run(self, file):


        self._file = file
        # Display splash screen while waiting for the application to open
        self.processSplashScreen()

        # Instantiation of Dynagen
        self.__dynagen = DynagenSub()

        self.systconf['dynamips'] = systemDynamipsConf()
        confo = self.systconf['dynamips']
        confo.path = ConfDB().get('Dynamips/hypervisor_path', Defaults.DYNAMIPS_DEFAULT_PATH)
        confo.port = int(ConfDB().get('Dynamips/hypervisor_port', 7200))
        confo.baseUDP = int(ConfDB().get('Dynamips/hypervisor_baseUDP', 10001))
        confo.baseConsole = int(ConfDB().get('Dynamips/hypervisor_baseConsole', 2101))
        confo.baseAUX = int(ConfDB().get('Dynamips/hypervisor_baseAUX', 2501))
        confo.workdir = ConfDB().get('Dynamips/hypervisor_working_directory', Defaults.DYNAMIPS_DEFAULT_WORKDIR)
        confo.clean_workdir = ConfDB().value("Dynamips/clean_working_directory", QVariant(True)).toBool()
        confo.ghosting = ConfDB().value("Dynamips/dynamips_ghosting", QVariant(True)).toBool()
        confo.mmap = ConfDB().value("Dynamips/dynamips_mmap", QVariant(True)).toBool()
        confo.sparsemem = ConfDB().value("Dynamips/dynamips_sparsemem", QVariant(True)).toBool()
        confo.jitsharing = ConfDB().value("Dynamips/dynamips_jitsharing", QVariant(False)).toBool()
        if sys.platform.startswith('win'):
            confo.memory_limit = int(ConfDB().get("Dynamips/hypervisor_memory_usage_limit", 512))
        else:
            confo.memory_limit = int(ConfDB().get("Dynamips/hypervisor_memory_usage_limit", 1024))
        confo.udp_incrementation = int(ConfDB().get("Dynamips/hypervisor_udp_incrementation", 100))
        confo.detected_version = ConfDB().get('Dynamips/detected_version', unicode(''))
        confo.import_use_HypervisorManager = ConfDB().value("Dynamips/hypervisor_manager_import", QVariant(True)).toBool()
        confo.HypervisorManager_binding = ConfDB().get('Dynamips/hypervisor_manager_binding', unicode('127.0.0.1'))
        confo.allocateHypervisorPerIOS = ConfDB().value("Dynamips/allocate_hypervisor_per_IOS", QVariant(True)).toBool()

        # Expand user home dir and environment variables
        confo.path = os.path.expandvars(os.path.expanduser(confo.path))
        confo.workdir = os.path.expandvars(os.path.expanduser(confo.workdir))

        # Qemu config
        self.systconf['qemu'] = systemQemuConf()
        confo = self.systconf['qemu']
        confo.qemuwrapper_path = ConfDB().get('Qemu/qemuwrapper_path', Defaults.QEMUWRAPPER_DEFAULT_PATH)
        confo.qemuwrapper_workdir = ConfDB().get('Qemu/qemuwrapper_working_directory', Defaults.QEMUWRAPPER_DEFAULT_WORKDIR)
        confo.qemu_path = ConfDB().get('Qemu/qemu_path', Defaults.QEMU_DEFAULT_PATH)
        confo.qemu_img_path = ConfDB().get('Qemu/qemu_img_path', Defaults.QEMU_IMG_DEFAULT_PATH)
        confo.external_hosts = ConfDB().get('Qemu/external_hosts', unicode('127.0.0.1:10525')).split(',')
        confo.enable_QemuWrapperAdvOptions = ConfDB().value("Qemu/enable_QemuWrapperAdvOptions", QVariant(False)).toBool()
        confo.enable_QemuManager = ConfDB().value("Qemu/enable_QemuManager", QVariant(True)).toBool()
        confo.import_use_QemuManager = ConfDB().value("Qemu/qemu_manager_import", QVariant(True)).toBool()
        confo.send_path_external_QemuWrapper = ConfDB().value("Qemu/send_paths_external_Qemuwrapper", QVariant(False)).toBool()
        confo.QemuManager_binding = ConfDB().get('Qemu/qemu_manager_binding', unicode('127.0.0.1'))
        confo.qemuwrapper_port = int(ConfDB().get('Qemu/qemuwrapper_port', 10525))
        confo.qemuwrapper_baseUDP = int(ConfDB().get('Qemu/qemuwrapper_baseUDP', 40000))
        confo.qemuwrapper_baseConsole = int(ConfDB().get('Qemu/qemuwrapper_baseConsole', 3001))

        # Expand user home dir and environment variables
        confo.qemuwrapper_path = os.path.expandvars(os.path.expanduser(confo.qemuwrapper_path))
        confo.qemuwrapper_workdir = os.path.expandvars(os.path.expanduser(confo.qemuwrapper_workdir))

        # VBox config
        self.systconf['vbox'] = systemVBoxConf()
        confo = self.systconf['vbox']
        confo.vboxwrapper_path = ConfDB().get('VBox/vboxwrapper_path', Defaults.VBOXWRAPPER_DEFAULT_PATH)
        confo.vboxwrapper_workdir = ConfDB().get('VBox/vboxwrapper_working_directory', Defaults.VBOXWRAPPER_DEFAULT_WORKDIR)
        confo.external_hosts = ConfDB().get('VBox/external_hosts', unicode('127.0.0.1:11525')).split(',')
        confo.use_VBoxVmnames = ConfDB().value("VBox/use_VBoxVmnames", QVariant(True)).toBool()
        confo.enable_VBoxWrapperAdvOptions = ConfDB().value("VBox/enable_VBoxWrapperAdvOptions", QVariant(False)).toBool()
        confo.enable_VBoxAdvOptions = ConfDB().value("VBox/enable_VBoxAdvOptions", QVariant(False)).toBool()
        confo.enable_GuestControl = ConfDB().value("VBox/enable_GuestControl", QVariant(False)).toBool()
        confo.enable_VBoxManager = ConfDB().value("VBox/enable_VBoxManager", QVariant(True)).toBool()
        confo.import_use_VBoxManager = ConfDB().value("VBox/vbox_manager_import", QVariant(True)).toBool()
        confo.VBoxManager_binding = ConfDB().get('VBox/vbox_manager_binding', unicode('127.0.0.1'))
        confo.vboxwrapper_port = int(ConfDB().get('VBox/vboxwrapper_port', 11525))
        confo.vboxwrapper_baseUDP = int(ConfDB().get('VBox/vboxwrapper_baseUDP', 20900))
        confo.vboxwrapper_baseConsole = int(ConfDB().get('VBox/vboxwrapper_baseConsole', 3501))

        # Expand user home dir and environment variables
        confo.vboxwrapper_path = os.path.expandvars(os.path.expanduser(confo.vboxwrapper_path))
        confo.vboxwrapper_workdir = os.path.expandvars(os.path.expanduser(confo.vboxwrapper_workdir))

        # Capture config
        self.systconf['capture'] = systemCaptureConf()
        confo = self.systconf['capture']
        confo.workdir = ConfDB().get('Capture/working_directory', Defaults.CAPTURE_DEFAULT_WORKDIR)
        confo.cap_cmd = ConfDB().get('Capture/capture_reader_cmd', Defaults.CAPTURE_DEFAULT_CMD)
        confo.auto_start = ConfDB().value('Capture/auto_start_cmd', QVariant(False)).toBool()

        # Expand user home dir and environment variables
        confo.cap_cmd = os.path.expandvars(os.path.expanduser(confo.cap_cmd))
        confo.workdir = os.path.expandvars(os.path.expanduser(confo.workdir))

        # Deployement Wizard config
        self.systconf['deployement wizard'] = systemDeployementWizardConf()
        confo = self.systconf['deployement wizard']
        confo.deployementwizard_path = ConfDB().get('DeployementWizard/deployementwizard_path', Defaults.DEPLOYEMENTWIZARD_DEFAULT_PATH)
        confo.deployementwizard_filename = ConfDB().get('DeployementWizard/deployementwizard_filename', unicode('Topology.pdf'))

        # Expand user home dir and environement variable
        confo.deployementwizard_path = os.path.expandvars(os.path.expanduser(confo.deployementwizard_path))
        confo.deployementwizard_filename = os.path.expandvars(os.path.expanduser(confo.deployementwizard_filename))

        # System general config
        self.systconf['general'] = systemGeneralConf()
        confo = self.systconf['general']
        confo.lang = ConfDB().get('GNS3/lang', unicode('en'))
        confo.slow_start = int(ConfDB().get('GNS3/slow_start', 1))
        confo.autosave = int(ConfDB().get('GNS3/autosave', 0))
        confo.project_startup = ConfDB().value("GNS3/project_startup", QVariant(True)).toBool()
        confo.relative_paths = ConfDB().value("GNS3/relative_paths", QVariant(True)).toBool()
        confo.auto_screenshot = ConfDB().value("GNS3/auto_screenshot", QVariant(True)).toBool()
        if sys.platform.startswith('win'):
            confo.use_shell = ConfDB().value("GNS3/use_shell", QVariant(False)).toBool()
        else:
            confo.use_shell = ConfDB().value("GNS3/use_shell", QVariant(True)).toBool()
        confo.bring_console_to_front = ConfDB().value("GNS3/bring_console_to_front", QVariant(False)).toBool()
        confo.term_cmd = ConfDB().get('GNS3/console', Defaults.TERMINAL_DEFAULT_CMD)
        confo.term_serial_cmd = ConfDB().get('GNS3/serial_console', Defaults.TERMINAL_SERIAL_DEFAULT_CMD)
        confo.term_close_on_delete = ConfDB().value("GNS3/term_close_on_delete", QVariant(True)).toBool()
        confo.project_path = ConfDB().get('GNS3/project_directory', Defaults.PROJECT_DEFAULT_DIR)
        confo.ios_path = ConfDB().get('GNS3/ios_directory', Defaults.IOS_DEFAULT_DIR)
        confo.status_points = ConfDB().value("GNS3/gui_show_status_points", QVariant(True)).toBool()
        confo.manual_connection = ConfDB().value("GNS3/gui_use_manual_connection", QVariant(True)).toBool()
        confo.draw_selected_rectangle = ConfDB().value("GNS3/gui_draw_selected_rectangle", QVariant(False)).toBool()
        confo.scene_width = int(ConfDB().get('GNS3/scene_width', 2000))
        confo.scene_height = int(ConfDB().get('GNS3/scene_height', 1000))
        confo.console_delay = float(ConfDB().get('GNS3/console_delay', 1))
        if sys.platform.startswith('win') or sys.platform.startswith('darwin'):
            # by default auto check for update only on Windows or OSX
            confo.auto_check_for_update = ConfDB().value("GNS3/auto_check_for_update", QVariant(True)).toBool()
        else:
            confo.auto_check_for_update = ConfDB().value("GNS3/auto_check_for_update", QVariant(False)).toBool()
        confo.last_check_for_update = int(ConfDB().get('GNS3/last_check_for_update', 0))

        # Expand user home dir and environment variables
        confo.term_cmd = os.path.expandvars(os.path.expanduser(confo.term_cmd))
        confo.project_path = os.path.expandvars(os.path.expanduser(confo.project_path))
        confo.ios_path = os.path.expandvars(os.path.expanduser(confo.ios_path))

        # Restore debug level
        globals.debugLevel = int(ConfDB().get('GNS3/debug_level', 0))
        if globals.debugLevel == 1 or globals.debugLevel == 3:
            lib.setdebug(True)
            tracker.setdebug(True)

        # Now systGeneral settings are loaded, load the translator
        self.translator = Translator()
        self.translator.switchLangTo(self.systconf['general'].lang)

        # HypervisorManager
        if globals.GApp.systconf['dynamips'].path:
            self.__HypervisorManager = HypervisorManager()

        # QemuManager
        self.__QemuManager = QemuManager()

        # VBoxManager
        self.__VBoxManager = VBoxManager()

        GNS_Conf().VBOX_images()
        GNS_Conf().IOS_images()
        GNS_Conf().IOS_hypervisors()
        GNS_Conf().QEMU_images()
        GNS_Conf().PIX_images()
        GNS_Conf().JUNOS_images()
        GNS_Conf().ASA_images()
        GNS_Conf().AWP_images()
        GNS_Conf().IDS_images()
        GNS_Conf().Libraries()
        GNS_Conf().Symbols()
        GNS_Conf().RecentFiles()

        # Workspace create a ` Scene' object,
        # so it also set self.__topology
        self.__workspace = Workspace()

        # seems strange to have mainWindow = Workspace, but actually,
        # we don't use MDI style, so there not so much difference.
        self.__mainWindow = self.__workspace

        # In GNS3, the `scene' represent the widget where all graphical stuff
        # are done (drawing Node, Animation), and in Qt, it's the QGraphicsView
        # which handle all this stuff.
        self.__scene = self.__mainWindow.graphicsView

        # Restore the geometry & state of the GUI
        self.mainWindow.restoreGeometry(ConfDB().value("GUIState/Geometry").toByteArray())
        self.mainWindow.restoreState(ConfDB().value("GUIState/State").toByteArray())
        self.mainWindow.action_DisableMouseWheel.setChecked(ConfDB().value("GUIState/DisableMouseWheel", QVariant(False)).toBool())
        self.mainWindow.action_ZoomUsingMouseWheel.setChecked(ConfDB().value("GUIState/ZoomUsingMouseWheel", QVariant(False)).toBool())
        if self.mainWindow.tips_dialog:
            self.mainWindow.tips_dialog.checkBoxDontShowAgain.setChecked(ConfDB().value("GUIState/DoNotShowTipsDialog", QVariant(False)).toBool())

        # load initial stuff once the event loop isn't busy
        QtCore.QTimer.singleShot(0, self._startupLoading)

        # By default, don't show the NodeTypes dock
        self.mainWindow.dockWidget_NodeTypes.setVisible(False)
        self.mainWindow.show()

        retcode = QApplication.exec_()

        self.__HypervisorManager = None
        self.__QemuManager = None
        self.__VBoxManager = None

        if globals.recordConfiguration:
            # Save the geometry & state of the GUI
            ConfDB().set("GUIState/Geometry", self.mainWindow.saveGeometry())
            ConfDB().set("GUIState/State", self.mainWindow.saveState())
            ConfDB().set("GUIState/DisableMouseWheel", self.mainWindow.action_DisableMouseWheel.isChecked())
            ConfDB().set("GUIState/ZoomUsingMouseWheel", self.mainWindow.action_ZoomUsingMouseWheel.isChecked())
            if self.mainWindow.tips_dialog:
                ConfDB().set("GUIState/DoNotShowTipsDialog", self.mainWindow.tips_dialog.checkBoxDontShowAgain.isChecked())
            self.syncConf()

        self.deleteLater()
        sys.exit(retcode)
Пример #12
0
    def __testDynamips(self):

        if len(globals.GApp.topology.nodes):
            reply = QtGui.QMessageBox.question(
                self, translate("UiConfig_PreferencesDynamips", "Message"),
                translate(
                    "UiConfig_PreferencesDynamips",
                    "This action is going to delete your current topology, would you like to continue?"
                ), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
            if reply == QtGui.QMessageBox.No:
                return

        self.saveConf()
        if globals.GApp.systconf['dynamips'].path:
            if os.path.exists(globals.GApp.systconf['dynamips'].path) == False:
                self.labelDynamipsStatus.setText(
                    '<font color="red">' +
                    translate("UiConfig_PreferencesDynamips",
                              "Dynamips path doesn't exist") + '</font>')
                return

        if not sys.platform.startswith('win') and not os.access(
                globals.GApp.systconf['dynamips'].path, os.X_OK):
            self.labelDynamipsStatus.setText('<font color="red">' + translate(
                "UiConfig_PreferencesDynamips",
                "Dynamips path isn't marked as executable.<br>Please fix using the following command:<br>chmod +x path_to_dynamips"
            ) + '</font>')
            return

        try:
            p = sub.Popen([globals.GApp.systconf['dynamips'].path, '--help'],
                          stdout=sub.PIPE)
            dynamips_stdout = p.communicate()
        except OSError:
            self.labelDynamipsStatus.setText('<font color="red">' + translate(
                "UiConfig_PreferencesDynamips", "Failed to start Dynamips") +
                                             '</font>')
            return

        try:
            if not dynamips_stdout[0].splitlines()[0].__contains__('version'):
                self.labelDynamipsStatus.setText(
                    '<font color="red">' +
                    translate("UiConfig_PreferencesDynamips",
                              "Failed to determine version of Dynamips.") +
                    '</font>')
                return
            version_raw = dynamips_stdout[0].splitlines()[0].split(
                'version')[1].lstrip()
            version_1st = int(version_raw.split('.')[0])
            version_2nd = int(version_raw.split('.')[1])
            version_3rd = int(version_raw.split('.')[2].split('-')[0])
            dynamips_ver = str(version_1st) + '.' + str(
                version_2nd) + '.' + str(
                    version_3rd) + '-' + version_raw.split('.')[2].split(
                        '-')[1]
            globals.GApp.systconf['dynamips'].detected_version = unicode(
                dynamips_ver)
            ConfDB().sync()
        except:
            self.labelDynamipsStatus.setText(
                '<font color="red">' +
                translate("UiConfig_PreferencesDynamips",
                          "Failed to determine version of Dynamips.") +
                '</font>')
            return

        if version_2nd < 2 or version_3rd < 8:
            self.labelDynamipsStatus.setText('<font color="red">' + translate(
                "UiConfig_PreferencesDynamips",
                "Found Dynamips %s, which is not supported. Use 0.2.8+ instead."
            ) % dynamips_ver + '</font>')
            return

        if not testIfWritableDir(globals.GApp.systconf['dynamips'].workdir):
            self.labelDynamipsStatus.setText('<font color="red">' + translate(
                "UiConfig_PreferencesDynamips",
                "Dynamips working directory does not exist or is not writable")
                                             + '</font>')
            return

        track = tracker.portTracker()
        # Check if any of the first 10 ports are free to use by hypervisors
        not_free_ports = track.getNotAvailableTcpPortRange(
            globals.GApp.systconf['dynamips'].HypervisorManager_binding,
            globals.hypervisor_baseport, 10)
        if len(not_free_ports):
            self.labelDynamipsStatus.setText('<font color="red">' + translate(
                "UiConfig_PreferencesDynamips",
                "Ports already in use %s<br>Please choose another base port value<br>or close these ports"
                % str(not_free_ports)) + '</font>')
            return

        # Check if any of the first 10 ports are free to use for dynamips console ports
        not_free_ports = track.getNotAvailableTcpPortRange(
            globals.GApp.systconf['dynamips'].HypervisorManager_binding,
            globals.GApp.systconf['dynamips'].baseConsole, 10)
        if len(not_free_ports):
            self.labelDynamipsStatus.setText('<font color="red">' + translate(
                "UiConfig_PreferencesDynamips",
                "Ports already in use %s<br>Please choose another base console value<br>or close these ports"
                % str(not_free_ports)) + '</font>')
            return

        # Check if any of the first 10 ports are free to use for dynamips aux ports
        not_free_ports = track.getNotAvailableTcpPortRange(
            globals.GApp.systconf['dynamips'].HypervisorManager_binding,
            globals.GApp.systconf['dynamips'].baseAUX, 10)
        if len(not_free_ports):
            self.labelDynamipsStatus.setText('<font color="red">' + translate(
                "UiConfig_PreferencesDynamips",
                "Ports already in use %s<br>Please choose another base AUX value<br>or close these ports"
                % str(not_free_ports)) + '</font>')
            return

        if globals.GApp.systconf['dynamips'].path:
            globals.GApp.workspace.clear()
            globals.GApp.HypervisorManager = HypervisorManager()
            if globals.GApp.HypervisorManager.preloadDynamips():
                self.labelDynamipsStatus.setText(
                    '<font color="green">' +
                    translate("UiConfig_PreferencesDynamips",
                              "Dynamips %s successfully started") %
                    dynamips_ver + '</font>')
            else:
                self.labelDynamipsStatus.setText(
                    '<font color="red">' +
                    translate("UiConfig_PreferencesDynamips",
                              "Failed to start Dynamips") + '</font>')
Пример #13
0
    def saveConf(self):
        """ Save widget settings to syst. config
        """

        self.conf.workdir = unicode(self.dynamips_workdir.text(),
                                    'utf-8',
                                    errors='replace')
        self.conf.path = unicode(self.dynamips_path.text(),
                                 'utf-8',
                                 errors='replace')
        self.conf.port = self.dynamips_port.value()
        self.conf.baseUDP = self.dynamips_baseUDP.value()
        self.conf.baseConsole = self.dynamips_baseConsole.value()
        self.conf.baseAUX = self.dynamips_baseAUX.value()
        self.conf.memory_limit = self.spinBoxMemoryLimit.value()
        self.conf.udp_incrementation = self.spinBoxUDPIncrementation.value()
        if self.checkBoxClearWorkdir.checkState() == QtCore.Qt.Checked:
            self.conf.clean_workdir = True
        else:
            self.conf.clean_workdir = False
        if self.checkBoxHypervisorManagerImport.checkState(
        ) == QtCore.Qt.Checked:
            self.conf.import_use_HypervisorManager = True
        else:
            self.conf.import_use_HypervisorManager = False
        if self.checkBoxAllocatePerIOS.checkState() == QtCore.Qt.Checked:
            self.conf.allocateHypervisorPerIOS = True
        else:
            self.conf.allocateHypervisorPerIOS = False
        if self.checkBoxGhosting.checkState() == QtCore.Qt.Checked:
            self.conf.ghosting = True
        else:
            self.conf.ghosting = False
        if self.checkBoxSparseMem.checkState() == QtCore.Qt.Checked:
            self.conf.sparsemem = True
        else:
            self.conf.sparsemem = False
        if self.checkBoxJITsharing.checkState() == QtCore.Qt.Checked:
            self.conf.jitsharing = True
        else:
            self.conf.jitsharing = False
        if self.checkBoxMmap.checkState() == QtCore.Qt.Checked:
            self.conf.mmap = True
        else:
            self.conf.mmap = False

        # update IOS images used by the hypervisor manager
        binding = unicode(self.comboBoxBinding.currentText(),
                          'utf-8',
                          errors='replace')
        if self.conf.HypervisorManager_binding != binding:
            self.conf.HypervisorManager_binding = binding
            for name in globals.GApp.iosimages.keys():
                image_conf = globals.GApp.iosimages[name]
                if len(image_conf.hypervisors) == 0:
                    del globals.GApp.iosimages[name]
                    #if binding == '0.0.0.0':
                    #    binding = '127.0.0.1'
                    globals.GApp.iosimages[binding + ':' +
                                           image_conf.filename] = image_conf

        globals.GApp.systconf['dynamips'] = self.conf
        ConfDB().sync()

        return True
Пример #14
0
    def syncConf(self):
        """ Sync current application config with config file (gns3.{ini,conf})
        """

        c = ConfDB()
        c.set('GNS3/version', VERSION_INTEGER)

        # Apply general settings
        confo = self.systconf['general']
        c.set('GNS3/lang', confo.lang)
        c.set('GNS3/project_startup', confo.project_startup)
        c.set('GNS3/relative_paths', confo.relative_paths)
        c.set('GNS3/slow_start', confo.slow_start)
        c.set('GNS3/autosave', confo.autosave)
        c.set('GNS3/console', confo.term_cmd)
        c.set('GNS3/use_shell', confo.use_shell)
        c.set('GNS3/gui_show_status_points', confo.status_points)
        c.set('GNS3/gui_use_manual_connection', confo.manual_connection)
        c.set('GNS3/gui_draw_selected_rectangle', confo.draw_selected_rectangle)
        c.set('GNS3/project_directory', confo.project_path)
        c.set('GNS3/ios_directory', confo.ios_path)
        c.set('GNS3/scene_width', confo.scene_width)
        c.set('GNS3/scene_height', confo.scene_height)

        # Dynamips settings
        confo = self.systconf['dynamips']
        c.set('Dynamips/hypervisor_path', confo.path)
        c.set('Dynamips/hypervisor_port', confo.port)
        c.set('Dynamips/hypervisor_baseUDP', confo.baseUDP)
        c.set('Dynamips/hypervisor_baseConsole', confo.baseConsole)
        c.set('Dynamips/hypervisor_baseAUX', confo.baseAUX)
        c.set('Dynamips/hypervisor_working_directory', confo.workdir)
        c.set('Dynamips/clean_working_directory', confo.clean_workdir)
        c.set('Dynamips/dynamips_ghosting', confo.ghosting)
        c.set('Dynamips/dynamips_sparsemem', confo.sparsemem)
        c.set('Dynamips/dynamips_jitsharing', confo.jitsharing)
        c.set('Dynamips/dynamips_mmap', confo.mmap)
        c.set('Dynamips/hypervisor_memory_usage_limit', confo.memory_limit)
        c.set('Dynamips/hypervisor_udp_incrementation', confo.udp_incrementation)
        c.set('Dynamips/hypervisor_manager_import', confo.import_use_HypervisorManager)
        c.set('Dynamips/allocate_hypervisor_per_IOS', confo.allocateHypervisorPerIOS)
        c.set('Dynamips/hypervisor_manager_binding', confo.HypervisorManager_binding)
        
        # Qemu config
        confo = self.systconf['qemu']
        c.set('Qemu/qemuwrapper_path', confo.qemuwrapper_path)
        c.set('Qemu/qemuwrapper_working_directory', confo.qemuwrapper_workdir)
        c.set('Qemu/qemu_path', confo.qemu_path)
        c.set('Qemu/qemu_img_path', confo.qemu_img_path)
        external_hosts = ','.join(confo.external_hosts)
        c.set('Qemu/external_hosts', external_hosts)
        c.set('Qemu/enable_QemuManager', confo.enable_QemuManager)
        c.set('Qemu/qemu_manager_import', confo.import_use_QemuManager)
        c.set('Qemu/qemu_manager_binding', confo.QemuManager_binding)
        c.set('Qemu/qemuwrapper_port', confo.qemuwrapper_port)
        c.set('Qemu/qemuwrapper_baseUDP', confo.qemuwrapper_baseUDP)
        c.set('Qemu/qemuwrapper_baseConsole', confo.qemuwrapper_baseConsole)
        
        # Capture settings
        confo = self.systconf['capture']
        c.set('Capture/working_directory', confo.workdir)
        c.set('Capture/capture_reader_cmd', confo.cap_cmd)
        c.set('Capture/auto_start_cmd', confo.auto_start)

        # Clear IOS.hypervisors, IOS.images and QEMU.images group
        c.beginGroup("IOS.images")
        c.remove("")
        c.endGroup()

        c.beginGroup("IOS.hypervisors")
        c.remove("")
        c.endGroup()
        
        c.beginGroup("QEMU.images")
        c.remove("")
        c.endGroup()
        
        c.beginGroup("PIX.images")
        c.remove("")
        c.endGroup()
        
        c.beginGroup("JUNOS.images")
        c.remove("")
        c.endGroup()
        
        c.beginGroup("ASA.images")
        c.remove("")
        c.endGroup()
        
        c.beginGroup("IDS.images")
        c.remove("")
        c.endGroup()
        
        # Clear Symbol.libraries group
        c.beginGroup("Symbol.libraries")
        c.remove("")
        c.endGroup()
        
        # Clear Symbol.libraries group
        c.beginGroup("Symbol.settings")
        c.remove("")
        c.endGroup()

        # IOS Images 
        for (key, o) in self.__iosimages.iteritems():
            basekey = "IOS.images/" + str(o.id)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/chassis", o.chassis)
            c.set(basekey + "/platform", o.platform)
            c.set(basekey + "/baseconfig", o.baseconfig)
            hypervisors = ''
            for hypervisor in o.hypervisors:
                hypervisors += hypervisor + ' '
            c.set(basekey + "/hypervisors", hypervisors.strip())
            c.set(basekey + "/default_ram", o.default_ram)
            c.set(basekey + "/idlepc", o.idlepc)
            c.set(basekey + "/default",  o.default)

        # Hypervisors
        for (key, o) in self.__hypervisors.iteritems():
            basekey = "IOS.hypervisors/" + str(o.id)
            c.set(basekey + "/host", o.host)
            c.set(basekey + "/port", o.port)
            c.set(basekey + "/working_directory", o.workdir)
            c.set(basekey + "/base_udp", o.baseUDP)
            c.set(basekey + "/base_console", o.baseConsole)
            c.set(basekey + "/base_aux", o.baseAUX)

        # Qemu images
        for (key, o) in self.__qemuimages.iteritems():
            basekey = "QEMU.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kqemu", o.kqemu)
            c.set(basekey + "/kvm", o.kvm)
            
        # PIX images
        for (key, o) in self.__piximages.iteritems():
            basekey = "PIX.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kqemu", o.kqemu)
            c.set(basekey + "/key", o.key)
            c.set(basekey + "/serial", o.serial)
            
        # JunOS images
        for (key, o) in self.__junosimages.iteritems():
            basekey = "JUNOS.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/filename", o.filename)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kqemu", o.kqemu)
            c.set(basekey + "/kvm", o.kvm)
            
        # ASA images
        for (key, o) in self.__asaimages.iteritems():
            basekey = "ASA.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kqemu", o.kqemu)
            c.set(basekey + "/kvm", o.kvm)
            c.set(basekey + "/initrd", o.initrd)
            c.set(basekey + "/kernel", o.kernel)
            c.set(basekey + "/kernel_cmdline", o.kernel_cmdline)
            
        # IDS images
        for (key, o) in self.__idsimages.iteritems():
            basekey = "IDS.images/" + str(o.id)
            c.set(basekey + "/name", o.name)
            c.set(basekey + "/image1", o.image1)
            c.set(basekey + "/image2", o.image2)
            c.set(basekey + "/memory", o.memory)
            c.set(basekey + "/nic_nb", o.nic_nb)
            c.set(basekey + "/nic", o.nic)
            c.set(basekey + "/options", o.options)
            c.set(basekey + "/kqemu", o.kqemu)
            c.set(basekey + "/kvm", o.kvm)

        # Libraries
        id = 0
        for (key, o) in self.__libraries.iteritems():
            basekey = "Symbol.libraries/" + str(id)
            c.set(basekey + "/path", o.path)
            id += 1
            
        # Symbols
        id = 0
        for symbol in SYMBOLS:
            if not symbol['translated']:
                basekey = "Symbol.settings/" + str(id)
                c.set(basekey + "/name", symbol['name'])
                c.set(basekey + "/type", SYMBOL_TYPES[symbol['object']])
                c.set(basekey + "/normal_svg_file", symbol['normal_svg_file'])
                c.set(basekey + "/selected_svg_file", symbol['select_svg_file'])
                id += 1

        c.sync()