How to use startup method in localstack

Best Python code snippet using localstack_python

StartupConfigDialog.py

Source:StartupConfigDialog.py Github

copy

Full Screen

1# vim: expandtab ts=4 sw=4 sts=4 fileencoding=utf-8:2#3# Copyright (C) 2007-2010 GNS3 Development Team (http://www.gns3.net/team).4#5# This program is free software; you can redistribute it and/or modify6# it under the terms of the GNU General Public License version 2 as7# published by the Free Software Foundation;8#9# This program is distributed in the hope that it will be useful,10# but WITHOUT ANY WARRANTY; without even the implied warranty of11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12# GNU General Public License for more details.13#14# You should have received a copy of the GNU General Public License15# along with this program; if not, write to the Free Software16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17#18# http://www.gns3.net/contact19#20#by Alexey Eromenko: This class is responsible for open/save of Cisco Router Startup config.21import os, base6422import GNS3.Dynagen.dynamips_lib as lib23import GNS3.Globals as globals24import GNS3.UndoFramework as undo25from PyQt4 import QtCore, QtGui26from GNS3.Ui.Form_StartupConfig import Ui_StartupConfigDialog27from GNS3.Utils import fileBrowser, translate28class StartupConfigDialog(QtGui.QDialog, Ui_StartupConfigDialog):29 """ StartupConfigDialog class30 """31 def __init__(self, router):32 QtGui.QDialog.__init__(self)33 self.setupUi(self)34 self.dynagen = globals.GApp.dynagen35 self.topology = globals.GApp.topology36 self.router = router37 self.connect(self.StartupConfigPath_browser, QtCore.SIGNAL('clicked()'), self.slotSelectStartupConfigPath)38 self.connect(self.LoadStartupConfig, QtCore.SIGNAL('clicked()'), self.slotSelectLoadStartupConfig)39 self.connect(self.pushButtonConfigFromNvram, QtCore.SIGNAL('clicked()'), self.slotSelectStartupConfigFromNvram)40 self.config_path = unicode(self.router.cnfg)41 self.lineEditStartupConfig.setText(self.config_path)42 if self.config_path and self.config_path != 'None':43 self.loadConfig(self.config_path)44 def loadConfig(self, path):45 """ Load the startup-config from a file46 """47 try:48 f = open(path, 'r')49 config = f.read()50 self.EditStartupConfig.setPlainText(config)51 f.close()52 except IOError, e:53 QtGui.QMessageBox.critical(self, translate("StartupConfigDialog", "IO Error"), unicode(e))54 return55 def slotSelectStartupConfigPath(self):56 """ Get a path to the Startup-config from the file system57 """58 if self.config_path and self.config_path != 'None':59 directory = os.path.dirname(self.config_path)60 else:61 directory = globals.GApp.systconf['general'].project_path62 path = fileBrowser('Startup-config', directory=directory, parent=self).getFile()63 if path != None and path[0] != '':64 self.lineEditStartupConfig.setText(os.path.normpath(path[0]))65 def slotSelectLoadStartupConfig(self):66 """ Load/Refresh Startup-config (from a file)67 """68 config_path = unicode(self.lineEditStartupConfig.text(), 'utf-8', errors='replace')69 if config_path and config_path != 'None':70 self.loadConfig(config_path)71 def slotSelectStartupConfigFromNvram(self):72 """ Load/Refresh Startup-config (from nvram)73 """74 try:75 config = base64.decodestring(self.router.config_b64)76 if config:77 config = config.replace('\r', "")78 self.EditStartupConfig.setPlainText(config)79 except lib.DynamipsError, msg:80 QtGui.QMessageBox.critical(self, translate("StartupConfigDialog", "Dynamips error"), unicode(msg) + \81 "\nMake sure you saved your config in IOS\ni.e. #copy run start")82 except lib.DynamipsWarning, msg:83 QtGui.QMessageBox.critical(self, translate("StartupConfigDialog", "Dynamips warning"), unicode(msg))84 except:85 print "Unknown error ..."86 def on_buttonBox_clicked(self, button):87 """ Private slot called by a button of the button box clicked.88 button: button that was clicked (QAbstractButton)89 """90 if button == self.buttonBox.button(QtGui.QDialogButtonBox.Cancel):91 QtGui.QDialog.reject(self)92 else:93 # Save changes into config file94 config_path = unicode(self.lineEditStartupConfig.text(), 'utf-8', errors='replace')95 if self.checkBoxSaveIntoConfigFile.checkState() == QtCore.Qt.Checked:96 if config_path and config_path != 'None':97 try:98 f = open(config_path, 'w')99 f.write(unicode(self.EditStartupConfig.toPlainText()))100 f.close()101 command = undo.NewStartupConfigPath(self.router, config_path)102 self.topology.undoStack.push(command)103 if command.getStatus() != None:104 self.topology.undoStack.undo()105 QtGui.QMessageBox.critical(self, translate("StartupConfigDialog", "Startup-config"), unicode(command.getStatus()))106 return107 except IOError, e:108 QtGui.QMessageBox.critical(self, translate("StartupConfigDialog", "IO Error"), unicode(e))109 return110 # Save changes into nvram111 config = unicode(self.EditStartupConfig.toPlainText())112 if len(config) == 0:113 return114 # Encode string puts in a bunch of newlines. Split them out then join them back together115 encoded = ("").join(base64.encodestring(config).split())116 command = undo.NewStartupConfigNvram(self.router, encoded)117 self.topology.undoStack.push(command)118 if command.getStatus() != None:119 self.topology.undoStack.undo()120 QtGui.QMessageBox.critical(self, translate("StartupConfigDialog", "Dynamips error"), unicode(command.getStatus()))121 return122 QtGui.QMessageBox.information(globals.GApp.mainWindow, translate("StartupConfigDialog", "Startup-config"),123 translate("StartupConfigDialog", "The startup-config has been saved, now you can synchronize it in IOS\ni.e. #copy start run"))124 if button == self.buttonBox.button(QtGui.QDialogButtonBox.Ok):...

Full Screen

Full Screen

Form_StartupConfig.py

Source:Form_StartupConfig.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# Form implementation generated from reading ui file 'Form_StartupConfig.ui'3#4# Created: Mon Sep 9 21:29:21 20135# by: PyQt4 UI code generator 4.8.66#7# WARNING! All changes made in this file will be lost!8from PyQt4 import QtCore, QtGui9try:10 _fromUtf8 = QtCore.QString.fromUtf811except AttributeError:12 _fromUtf8 = lambda s: s13class Ui_StartupConfigDialog(object):14 def setupUi(self, StartupConfigDialog):15 StartupConfigDialog.setObjectName(_fromUtf8("StartupConfigDialog"))16 StartupConfigDialog.resize(660, 376)17 StartupConfigDialog.setWindowTitle(QtGui.QApplication.translate("StartupConfigDialog", "Startup-config", None, QtGui.QApplication.UnicodeUTF8))18 icon = QtGui.QIcon()19 icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/logo_icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)20 StartupConfigDialog.setWindowIcon(icon)21 self.gridLayout = QtGui.QGridLayout(StartupConfigDialog)22 self.gridLayout.setObjectName(_fromUtf8("gridLayout"))23 self.label = QtGui.QLabel(StartupConfigDialog)24 self.label.setText(QtGui.QApplication.translate("StartupConfigDialog", "Config file:", None, QtGui.QApplication.UnicodeUTF8))25 self.label.setObjectName(_fromUtf8("label"))26 self.gridLayout.addWidget(self.label, 0, 0, 1, 1)27 self.lineEditStartupConfig = QtGui.QLineEdit(StartupConfigDialog)28 self.lineEditStartupConfig.setObjectName(_fromUtf8("lineEditStartupConfig"))29 self.gridLayout.addWidget(self.lineEditStartupConfig, 0, 1, 1, 1)30 self.StartupConfigPath_browser = QtGui.QToolButton(StartupConfigDialog)31 self.StartupConfigPath_browser.setText(QtGui.QApplication.translate("StartupConfigDialog", "...", None, QtGui.QApplication.UnicodeUTF8))32 self.StartupConfigPath_browser.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)33 self.StartupConfigPath_browser.setObjectName(_fromUtf8("StartupConfigPath_browser"))34 self.gridLayout.addWidget(self.StartupConfigPath_browser, 0, 2, 1, 1)35 self.LoadStartupConfig = QtGui.QToolButton(StartupConfigDialog)36 self.LoadStartupConfig.setText(_fromUtf8(""))37 icon1 = QtGui.QIcon()38 icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/edit-redo.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)39 self.LoadStartupConfig.setIcon(icon1)40 self.LoadStartupConfig.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)41 self.LoadStartupConfig.setObjectName(_fromUtf8("LoadStartupConfig"))42 self.gridLayout.addWidget(self.LoadStartupConfig, 0, 3, 1, 1)43 self.pushButtonConfigFromNvram = QtGui.QPushButton(StartupConfigDialog)44 self.pushButtonConfigFromNvram.setText(QtGui.QApplication.translate("StartupConfigDialog", "Load config from nvram", None, QtGui.QApplication.UnicodeUTF8))45 self.pushButtonConfigFromNvram.setObjectName(_fromUtf8("pushButtonConfigFromNvram"))46 self.gridLayout.addWidget(self.pushButtonConfigFromNvram, 0, 5, 1, 1)47 self.EditStartupConfig = QtGui.QPlainTextEdit(StartupConfigDialog)48 self.EditStartupConfig.setObjectName(_fromUtf8("EditStartupConfig"))49 self.gridLayout.addWidget(self.EditStartupConfig, 1, 0, 1, 6)50 self.checkBoxSaveIntoConfigFile = QtGui.QCheckBox(StartupConfigDialog)51 self.checkBoxSaveIntoConfigFile.setText(QtGui.QApplication.translate("StartupConfigDialog", "Save changes into the config file", None, QtGui.QApplication.UnicodeUTF8))52 self.checkBoxSaveIntoConfigFile.setChecked(True)53 self.checkBoxSaveIntoConfigFile.setObjectName(_fromUtf8("checkBoxSaveIntoConfigFile"))54 self.gridLayout.addWidget(self.checkBoxSaveIntoConfigFile, 2, 0, 1, 2)55 self.buttonBox = QtGui.QDialogButtonBox(StartupConfigDialog)56 self.buttonBox.setOrientation(QtCore.Qt.Horizontal)57 self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Apply|QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)58 self.buttonBox.setObjectName(_fromUtf8("buttonBox"))59 self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 6)60 self.retranslateUi(StartupConfigDialog)61 QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), StartupConfigDialog.accept)62 QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), StartupConfigDialog.reject)63 QtCore.QMetaObject.connectSlotsByName(StartupConfigDialog)64 def retranslateUi(self, StartupConfigDialog):65 pass...

Full Screen

Full Screen

SConscript

Source:SConscript Github

copy

Full Screen

1import rtconfig2Import('RTT_ROOT')3from building import *4# get current directory5cwd = GetCurrentDir()6# The set of source files associated with this SConscript file.7src = Split("""8CMSIS/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c9""")10src += Glob('STM32F4xx_StdPeriph_Driver/src/*.c')11# starupt scripts for each STM32 kind12# startup_scripts = {}13# startup_scripts['STM32F10X_CL'] = 'startup_stm32f10x_cl.s'14# startup_scripts['STM32F10X_HD'] = 'startup_stm32f10x_hd.s'15# startup_scripts['STM32F10X_HD_VL'] = 'startup_stm32f10x_hd_vl.s'16# startup_scripts['STM32F10X_LD'] = 'startup_stm32f10x_ld.s'17# startup_scripts['STM32F10X_LD_VL'] = 'startup_stm32f10x_ld_vl.s'18# startup_scripts['STM32F10X_MD'] = 'startup_stm32f10x_md.s'19# startup_scripts['STM32F10X_MD_VL'] = 'startup_stm32f10x_md_vl.s'20# startup_scripts['STM32F10X_XL'] = 'startup_stm32f10x_xl.s'21#add for startup script 22if rtconfig.CROSS_TOOL == 'gcc':23 src = src + ['CMSIS/ST/STM32F4xx/Source/Templates/gcc_ride7/startup_stm32f4xx.s']24elif rtconfig.CROSS_TOOL == 'keil':25 src = src + ['CMSIS/ST/STM32F4xx/Source/Templates/arm/startup_stm32f4xx.s']26# elif rtconfig.CROSS_TOOL == 'iar':27 # src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/iar/' + startup_scripts[rtconfig.STM32_TYPE]]28path = [cwd + '/STM32F4xx_StdPeriph_Driver/inc', 29 cwd + '/CMSIS/ST/STM32F4xx/Include',30 cwd + '/CMSIS/Include',31 cwd + '/CMSIS/CM3/DeviceSupport/ST/STM32F10x']32#CPPDEFINES = ['USE_STDPERIPH_DRIVER', rtconfig.STM32_TYPE]33CPPDEFINES = ['USE_STDPERIPH_DRIVER']34group = DefineGroup('STM32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful