#!/usr/bin/env python from aldbConf import * from alamMain import * from altgEnv import setEnv import sys, ast setEnv() sys.stdout.flush() groupId = int(sys.argv[1]) tests = (sys.argv[2]) conf = aldbConf(groupId) conf.lockGroup() test = alam(groupId) # TestId needs to be corrected, currently it is fixed to 1 if tests: # Create a list and convert to a dictionary of alam parameters try: tests.index('[') except: tests = "['"+tests+"']" testList = ast.literal_eval(tests) testDict = {} for key in testList: testDict[key] = True test.alamTestStart(testId=1, **testDict)
from aldbConf import * from aldbConnConfig import * # for aldbConf groupId = 10 try: test = aldbConf(groupId) except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("Something is wrong with your user name or password") elif err.errno == errorcode.ER_BAD_DB_ERROR: print("Database does not exist") else: print(err) # Test for the MapBun Set # Set dictionary, just change, what the fields correspond to # in order to change the test case setDict = dict(filename='test_file1', profile='profile1', script='script1', satname='viasat1') test.aldbConfMapbunSet(**setDict) result = test.aldbConfMapbunGet() print(result) print(setDict) if cmp(result, setDict): print("MapBun SetNew passed") else: print("MapBun SetNew failed") test.lockGroup()
#!/usr/bin/env python from aldbConf import * from altgScreen import confScreen, changeGroup data = changeGroup() screen = confScreen(aldbConf(data['groupId']), data['form']) screen.nmsAcessChange() screen.printScreen()
from aldbConf import * from aldbConnConfig import * # for aldbConf groupId = 10 try: test = aldbConf(groupId) except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("Something is wrong with your user name or password") elif err.errno == errorcode.ER_BAD_DB_ERROR: print("Database does not exist") else: print(err) # Test for the MapBun Set # Set dictionary, just change, what the fields correspond to # in order to change the test case setDict = dict(filename = 'test_file1', profile='profile1', script='script1', satname='viasat1') test.aldbConfMapbunSet(**setDict) result = test.aldbConfMapbunGet() print(result) print(setDict) if cmp(result, setDict): print("MapBun SetNew passed") else: print("MapBun SetNew failed") test.lockGroup() result = aldbConf.isLocked(aldbConnParmsGet(), 22) print(result) # updateDict = {'filename': 'test_file3', 'profile': 'profile3', \
#!/usr/bin/env python from altgScreen import confScreen, changeGroup from aldbConf import * from alamMain import alam import datetime, time, subprocess, sys data = changeGroup() conf = aldbConf(data['groupId']) screen = confScreen(conf, data['form']) screen.printScreen() # subprocess.call(["./testLauncher.sh {} {} >>{} 2>&1 &".format(data['groupId'], None, None)], shell=True) resultDir = conf.aldbConfDirsGet()['resultDir'] results = open("{}results".format(resultDir), "a+") results.write("Results from Configuration Lock on {}\n".format( datetime.datetime.fromtimestamp( time.time()).strftime('%Y-%m-%d %H:%M:%S'))) results.flush() oldstdout = sys.stdout sys.stdout = results conf.lockGroup() test = alam(data['groupId'], lock=True) sys.stdout.flush() sys.stdout = oldstdout print "Locked\n"
from cgiSetup import * from aldbConf import * from aldbDefaults import * from string import Template from altgScreen import changeGroup import subprocess, re, random, sys data = changeGroup() form = data['form'] if form.getvalue('groupId'): groupId = data['groupId'] else: groupId = aldbConf.getGroup(aldbConnParmsGet(), True) conf = aldbConf(groupId) header = """Content-type: text/html\n\n <head> <title>Test Automation Results</title> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="-1"> </head> <body>""" groupIdFieldSet = """ <form action="altgTestResults.py" enctype="multipart/form-data" method="post"> <fieldset> <legend>Currently Loaded Group</legend>
#!/usr/bin/env python from altgScreen import confScreen, changeGroup from aldbConf import * from alamMain import alam import datetime, time, subprocess, sys data = changeGroup() conf = aldbConf(data['groupId']) screen = confScreen(conf, data['form']) screen.printScreen() # subprocess.call(["./testLauncher.sh {} {} >>{} 2>&1 &".format(data['groupId'], None, None)], shell=True) resultDir = conf.aldbConfDirsGet()['resultDir'] results = open("{}results".format(resultDir), "a+") results.write("Results from Configuration Lock on {}\n".format(datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S'))) results.flush() oldstdout = sys.stdout sys.stdout = results conf.lockGroup() test = alam(data['groupId'], lock=True) sys.stdout.flush() sys.stdout = oldstdout print "Locked\n"
def printScreen(self): template = Template("""Content-type: text/html\n\n <head> <title>Launcher-AL Test Automation</title> </head> <body> <form action="/cgi-bin/altgTestLauncher.py" enctype="multipart/form-data" method="post"> <fieldset> <legend>Currently Loaded Group</legend> <table> <tr> <td align="right">Group ID:</td> <td align="left"><input type="text" name="groupId" value="${groupId}"> </td> </tr> <tr> <td align="right">Name:</td> <td align="left"><input type="text" size="50" name="grptestc" value="${grptestc}" readonly="readonly"> </td> </tr> <tr> <td align="right">Description:</td> <td align="left"><input type="text" size="100" name="grpdesc" value="${grpdesc}" readonly="readonly"> </td> </tr> </table> <br> <div> <input type="submit" value="Load"> </div> </fieldset> <br> <fieldset> <legend>ArcLight Test Automation Test Case Launcher</legend> <input type="checkbox" name="Test" value="upload">Map Bundle-Terminal Upload <br> <input type="checkbox" name="Test" value="trickle">Map Bundle-Trickle Download <br> <input type="checkbox" name="Test" value="fllock">Map Bundle-Forward Link Lock <br> <input type="checkbox" name="Test" value="precedence">Map Bundle-Precedence <br> <input type="checkbox" name="Test" value="nlgstart">NLG-Poll Start <br> <input type="checkbox" name="Test" value="nlgtermstart">NLG-Poll Term-only Start <br> <input type="checkbox" name="Test" value="nlgstop">NLG-Poll Stop <br> <input type="checkbox" name="Test" value="logout">NLG-VMT Logout <br> <input type="checkbox" name="Test" value="relogin">NLG-VMT ReLogin <br> <input type="checkbox" name="Test" value="reboot">NLG-VMT Reboot <br><br> <input type="submit" value="Start"> </fieldset> <br> <a href="$link">Test Results</a> <br> </form> <a href="/index.html"> Main Screen </a> </body> </html>""") groupList = makeGroupList(self.groupId) if len(groupList) > 1: link = "/cgi-bin/altgTestResultsMain.py?groupList={}".format( groupList) subs = { 'groupId': self.groupId, 'link': link, 'grptestc': "Multiple Groups", 'grpdesc': "See individual configuration for groups " + str(groupList) } else: link = "/cgi-bin/altgTestResults.py?groupId={}".format( self.groupId) self.conf = aldbConf(self.groupId) grp = self.conf.aldbConfGroupGet() subs = { 'groupId': self.groupId, 'link': link, 'grptestc': grp['TestCase'], 'grpdesc': grp['Description'] } print template.substitute(subs)
#!/usr/bin/env python from aldbConf import * from altgScreen import dbExportScreen, changeGroup data = changeGroup() screen = dbExportScreen(aldbConf(data['groupId']), data['form']) screen.printScreen()
#!/usr/bin/env python from aldbConf import * from altgScreen import dbExportScreen, changeGroup data = changeGroup() screen = dbExportScreen(aldbConf(data['groupId']), data['form']) screen.exportSave() screen.printScreen()
#!/usr/bin/env python from altgScreen import makeGroupList from aldbConf import * import sys, re, datetime, time, subprocess groupIds = sys.argv[1] groupList = makeGroupList(groupIds) testList = sys.argv[2] for i in groupList: groupId = "{}".format(i) args = [groupId, testList] resultDir = aldbConf(groupId).aldbConfDirsGet()['resultDir'] results = open("{}results".format(resultDir), "a+") results.write("Results from {} test on {}\n".format( testList, datetime.datetime.fromtimestamp( time.time()).strftime('%Y-%m-%d %H:%M:%S'))) results.flush() cmd = [ '/var/www/cgi-bin/altgTestLaunched.py {} \"{}\" >>{} 2>&1'.format( groupId, testList, results.name) ] #print cmd subprocess.call(cmd, shell=True) results.close() time.sleep(15)