def __init__(self,name):

        path = os.path.join(os.getcwd(),'targets')
        if not os.path.isdir(path):
            logger.error("Cannot access directory with known clients.")

        fileName = name+'.target'
        list = os.path.join(path,fileName)

        logger.debug("Will read information from config file '"+fileName+"'.")

        conf = ConfigParser.RawConfigParser()
        conf.read(list)

        self.name = name
        self.timeout = int(cfg.get('general','timeout'))

        self.maxwait = 10

        try:
            self.address = conf.get('access','address')
            self.port = int(conf.get('access','port'))
            self.user = conf.get('credentials','user')
            self.pswd = conf.get('credentials','password')
            self.type = conf.get('hardware','type')
            self.power = int(conf.get('hardware','power'))
            self.firmware = conf.get('build','firmware')
            self.last = conf.get('build','build')
            self.qa_dev = conf.get('build','type')
        except:
            logger.error("Cannot read all information from '"+name+"'.")
Exemple #2
0
    def __init__(self):
        """
        :return:
        """

        self.baseurl = '%s/cmd.cgi?' % cfg.get('power','url')
        self.commands = {"off":"$A3 %s 0",
                         "on":"$A3 %s 1",
                         "reboot":"$A4 %s",
                         "status":"$A5 %s",
                         "allon":"$A7 1",
                         "alloff":"$A7 0"}
        self.user = '******'
        self.password = '******'
Exemple #3
0
    def __init__(self,name):
        path = os.path.join(os.getcwd(),'clients')
        if not os.path.isdir(path):
            logger.error("Cannot access directory with known clients.")

        fileName = name+'.cfg'
        list = os.path.join(path,fileName)

        logger.debug("Will read information from config file '"+fileName+"'.")

        conf = ConfigParser.RawConfigParser()
        conf.read(list)

        self.name = name
        self.timeout = int(cfg.get('general','timeout'))

        try:
            self.publ = conf.get('address','corp')
            self.locl = conf.get('address','local')
            self.user = conf.get('system','user')
            self.pswd = conf.get('system','pass')
            self.tver = conf.get('connecteddata','version')
            self.tlib = conf.get('connecteddata','directory')
            self.tusr = conf.get('connecteddata','user')
            self.tpwd = conf.get('connecteddata','pass')
            self.mount = conf.get('samba','drive')
            self.smbserv = conf.get('samba','server')
            self.smbshare = conf.get('samba','share')
            self.smbuser = conf.get('samba','user')
            self.smbpass = conf.get('samba','pass')
            self.smbnas = conf.get('samba','nas')
        except:
            logger.error("Cannot read all information from '"+name+"'.")

        self.platform = self.getOS()

        if self.platform == 'WIN':
            self.tpath = "C:\\Users\\"+self.user+"\\Transporter\\"
            self.tlpath = self.tpath+"Transporter Library"
        else:
            self.tpath = "/Users/"+self.user+"/Transporter/"
            self.tlpath = self.tpath+".Transporter Library"
Exemple #4
0
    def __init__(self,suite):

        self.suite = suite
        self.timeout = int(cfg.get('general', 'timeout'))

        path = os.path.join(os.getcwd(), 'testsuites')

        filename = self.suite+'.cfg'
        fullname = os.path.join(path,filename)

        logger.debug("Will read information from config file '"+filename+"'.")

        conf = ConfigParser.RawConfigParser()
        conf.read(fullname)

        try:
            self.targets = conf.get('testbed', 'target')
            self.clients = conf.get('testbed', 'client')
            self.trrun = conf.get('testrail', 'run')
            self.users = conf.get('testbed', 'user')
        except:
            logger.error("Cannot read information from '"+filename+"'.")
Exemple #5
0
    def __init__(self):

        self.csurl = cfg.get("general", "cs")
    def buildFinder(self):

        import re, cgi

        logger.debug("Will search for latest build for '"+self.firmware+".x' version.")
        if self.qa_dev == 'dev':
            logger.debug("Working with build from BuildBot.")
            url = cfg.get('build','dev')
            path = '/Product/Device/installation/tfb/'
        else:
            logger.debug("Working with build from QA server.")
            url = cfg.get('build','qa')
            path = '/'

        builds = []

        if os.path.exists('build.tmp'):
            logger.debug("Delete old version of temporary file.")
            os.remove('build.tmp')
            time.sleep(5)

        try:
            wFile = urllib2.urlopen(url)
        except:
            logger.error("Unable to access BuildBot server at "+url+".")
            return 'Error'

        lFile = open("build.tmp",'w')

        tag_re = re.compile(r'(<!--.*?-->|<[^>]*>)')

        for i, line in enumerate(wFile):
            if line.startswith('<tr>'):
                no_tags = tag_re.sub('', line)
                build_name = cgi.escape(no_tags)
                name = build_name.split('/')
                if not name[0].startswith('Parent'):
                    new_line = url+name[0]+path+'\n'
                    lFile.writelines(new_line)

        wFile.close()
        lFile.close()

        for line in reversed(open("build.tmp").readlines()):
            wFile = urllib2.urlopen(line)
            for i, place in enumerate(wFile):
                if place.startswith('<tr>'):
                    no_tags = tag_re.sub('', place)
                    build_name = cgi.escape(no_tags)
                    if self.firmware != 'x.x':
                        key = 'tfb64-'+self.firmware
                    else:
                        key = 'tfb64-'
                    if build_name.startswith(key):
                        tarfile = build_name.split('tar.gz')
                        builds.append(line[:-1]+tarfile[0]+'tar.gz')

        if len(builds) < 1:
            logger.warning("Build with required prefix was not found.")
            return 'Error'

        return builds[0]