def user(): return Response(cli.command('set_user', 'pi'))
def password(): return Response(cli.command('set_password', 'raspberry'))
print("Attempting to locate path to data directory") try: path = data_handler.load_object("path.config") except Exception as e: print(e) return False return True def get_path(): """ This returns the path to the dataset directory :return: the path """ dir_path = os.path.dirname(os.path.realpath(__file__)) os.chdir(dir_path) # changes the current working directory to pathname path = data_handler.load_object("path.config") return path if __name__ == '__main__': if check_path( ) is False: # check if path.config can be located. If it can't it will allow the user to paste in location of the dataset set_path() else: print("Path located as " + path) while True: # it will run until you enter exit. command = input( "Please input a command. Type help for a list of options\n") cli.command(command)
if opts.rsp_nr == 12: RspBrd = "rsp0,rsp1,rsp2,rsp3,rsp4,rsp5,rsp6,rsp7,rsp8,rsp9,rsp10,rsp11" SubBrd = "rsp0,rsp4,rsp8" SubRck = "sub0,sub1,sub2" if opts.rsp_nr == 24: RspBrd = "rsp0,rsp1,rsp2,rsp3,rsp4,rsp5,rsp6,rsp7,rsp8,rsp9,rsp10,rsp11,rsp12,rsp13,rsp14,rsp15,rsp16,rsp17,rsp18,rsp19,rsp20,rsp21,rsp22,rsp23" SubBrd = "rsp0,rsp4,rsp8,rsp12,rsp16,rsp20" SubRck = "sub0,sub1,sub2,sub3,sub4,sub5" ############################################################################### # Define subrack testlog class for pass/fail and logging vlev = opts.verbosity testId = "" appLev = False logName = "/opt/stationtest/data/SUBR-%05d-%05d.dat" % (opts.rsp_nr, opts.tbb_nr) cli.command("rm -f /opt/stationtest/data/SUBR-%05d-%05d.dat", appLev) sr = testlog.Testlog(vlev, testId, logName) sr.setResult("PASSED") sr.setId("Station - ") sr.appendLog(11, "") sr.appendLog(1, "Station production test %s" % logName) sr.appendLog(11, "") ################################################################################ sr.setId("RSP version - ") sr.appendLog(21, "") sr.appendLog(21, "### Verify LCU - RSP ethernet link by getting the RSP version info") sr.appendLog(21, "") res = cli.command("./rsp_version.sh")
def nat(): return Response(cli.command('nat', 'install_nat'))
testId = 'I2C-SPU - ' logName = 'i2c_spu.log' tlog = testlog.Testlog(vlev, testId, logName) tlog.setResult('PASSED') tlog.appendLog(11, '') tlog.appendLog(1, 'Read SPU sensor to verify the RSP - SPU I2C interface for subrack %s' % subId) tlog.appendLog(11, '') ################################################################################ # Command line appLev = False cli.command('rm -f spustat.log', appLev) cli.command('rspctl --spustat > spustat.log', appLev) # Echo spustat.log into i2c_spu.log tlog.appendFile(21, 'spustat.log') ################################################################################ # Verify result f = open('spustat.log', 'r') f.readline() # skip title line data_str = f.readline() # read measured data line j = 0 while data_str != '': data_str = data_str.replace(' ', '') # remove spaces
tlog.setResult('PASSED') tlog.appendLog(11,'') tlog.appendLog(1,'Read RSP status information for the station RAD interface') tlog.appendLog(11,'') ################################################################################ # Command line repeat loop appLev = False for rep in range(repeat): tlog.appendLog(11, 'Rep-%d' % rep) # Do rspctl --status and grep for RAD lane or ri error (any case) into one.log cli.command('rspctl --status | egrep \'(lane| ri)\' | egrep [Ee][Rr][Rr][Oo][Rr] > one.log', appLev) # Verify result, this one.log file should be empty f=open('one.log','r') if f.readline() != '': # Preserve the RAD error(s) into the test log tlog.appendFile(21, 'one.log') tlog.setResult('FAILED') # Stop repeat loop after first error #f.close() #break f.close() tlog.sleep(950) tlog.appendLog(0,tlog.getResult()) tlog.closeLog()
def samba(): return Response(cli.command('samba', 'install_samba'))
opts, args = op.parse_args() # - Option checks and/or reformatting if opts.batch_nr==None: op.error('Option -b must specify a subrack batch number') if opts.serial_nr==None: op.error('Option -s must specify a subrack serial number') ################################################################################ # Define subrack testlog class for pass/fail and logging vlev = opts.verbosity testId = '' appLev = False logName = '/opt/stationtest/data/SUBR-%05d-%05d.dat' % (opts.batch_nr, opts.serial_nr) cli.command('rm -f /opt/stationtest/data/SUBR-%05d-%05d.dat', appLev) sr = testlog.Testlog(vlev, testId, logName) sr.setResult('PASSED') sr.setId('Subrack - ') sr.appendLog(11,'') sr.appendLog(1,'Subrack production test %s' % logName) sr.appendLog(11,'') ################################################################################ sr.setId('RSP version - ') sr.appendLog(21,'') sr.appendLog(21,'### Verify LCU - RSP ethernet link by getting the RSP version info') sr.appendLog(21,'')
opts, args = op.parse_args() # - Option checks and/or reformatting if opts.batch_nr == None: op.error('Option -b must specify a subrack batch number') if opts.serial_nr == None: op.error('Option -s must specify a subrack serial number') ################################################################################ # Define subrack testlog class for pass/fail and logging vlev = opts.verbosity testId = '' appLev = False logName = '/opt/stationtest/data/SUBR-%05d-%05d.dat' % (opts.batch_nr, opts.serial_nr) cli.command('rm -f /opt/stationtest/data/SUBR-%05d-%05d.dat', appLev) sr = testlog.Testlog(vlev, testId, logName) sr.setResult('PASSED') sr.setId('Subrack - ') sr.appendLog(11, '') sr.appendLog(1, 'Subrack production test %s' % logName) sr.appendLog(11, '') ################################################################################ sr.setId('RSP version - ') sr.appendLog(21, '') sr.appendLog( 21, '### Verify LCU - RSP ethernet link by getting the RSP version info') sr.appendLog(21, '')
testId = "I2C-TD- " logName = "i2c_td.log" tlog = testlog.Testlog(vlev, testId, logName) tlog.setResult("PASSED") tlog.appendLog(11, "") tlog.appendLog(1, "Read TD sensor to verify the RSP - TD I2C interface for %s" % rspId) tlog.appendLog(11, "") ################################################################################ # Command line appLev = False cli.command("rm -f tdstat.log", appLev) cli.command("rspctl --tdstat > tdstat.log", appLev) # Echo tdstat.log into i2c_td.log tlog.appendFile(21, "tdstat.log") ################################################################################ # Verify result f = open("tdstat.log", "r") f.readline() # skip title line data_str = f.readline() # read measured data line j = 0 while data_str != "": data_str = data_str.replace(" ", "") # remove spaces
logName = 'i2c_td.log' tlog = testlog.Testlog(vlev, testId, logName) tlog.setResult('PASSED') tlog.appendLog(11, '') tlog.appendLog( 1, 'Read TD sensor to verify the RSP - TD I2C interface for %s' % rspId) tlog.appendLog(11, '') ################################################################################ # Command line appLev = False cli.command('rm -f tdstat.log', appLev) cli.command('rspctl --tdstat > tdstat.log', appLev) # Echo tdstat.log into i2c_td.log tlog.appendFile(21, 'tdstat.log') ################################################################################ # Verify result f = open('tdstat.log', 'r') f.readline() # skip title line data_str = f.readline() # read measured data line j = 0 while data_str != '': data_str = data_str.replace(' ', '') # remove spaces
def magic(): return Response(cli.command('magic', 'install'))
RspBrd = 'rsp0,rsp1,rsp2,rsp3,rsp4,rsp5,rsp6,rsp7,rsp8,rsp9,rsp10,rsp11,rsp12,rsp13,rsp14,rsp15,rsp16,rsp17,rsp18,rsp19,rsp20,rsp21,rsp22,rsp23' SubBrd = 'rsp0,rsp4,rsp8,rsp12,rsp16,rsp20' SubRck = 'sub0,sub1,sub2,sub3,sub4,sub5' # Define subrack testlog class for pass/fail and logging vlev = opts.verbosity testId = '' appLev = False #logName = '/opt/stationtest/data/SUBR-%05d-%05d.dat' % (opts.rsp_nr, opts.tbb_nr) #cli.command('rm -f /opt/stationtest/data/SUBR-%05d-%05d.dat', appLev) #logName = '/localhome/data/PPS-OPT-%s-%05s.dat' % (StID,tme) logName = '/localhome/data/PPS-OPT-%s-%s.dat' % (StID,tme) configName = '/opt/lofar/etc/%s-CHECK-PPSdelays.conf' % (StID) #logName = '/localhome/data/SUBR-%05d.dat' % (opts.rsp_nr) cli.command('rm -f /localhome/data/SUBR-%05d.dat', appLev) sr = testlog.Testlog(vlev, testId, logName) sr.setResult('PASSED') sr.setId('Station - ') sr.appendLog(11,'') sr.appendLog(1,' Station AP delay test %s' % logName) sr.appendLog(11,'') # Define config file st_log = file(configName, 'w') st_log.write('#\n')
def nextcloud(): return Response(cli.command('nextcloud', 'install_nextcloud'))
RspBrd = 'rsp0,rsp1,rsp2,rsp3,rsp4,rsp5,rsp6,rsp7,rsp8,rsp9,rsp10,rsp11' SubBrd = 'rsp0,rsp4,rsp8' SubRck = 'sub0,sub1,sub2' if opts.rsp_nr == 24: RspBrd = 'rsp0,rsp1,rsp2,rsp3,rsp4,rsp5,rsp6,rsp7,rsp8,rsp9,rsp10,rsp11,rsp12,rsp13,rsp14,rsp15,rsp16,rsp17,rsp18,rsp19,rsp20,rsp21,rsp22,rsp23' SubBrd = 'rsp0,rsp4,rsp8,rsp12,rsp16,rsp20' SubRck = 'sub0,sub1,sub2,sub3,sub4,sub5' ############################################################################### # Define subrack testlog class for pass/fail and logging vlev = opts.verbosity testId = '' appLev = False logName = '/opt/stationtest/data/SUBR-%05d-%05d.dat' % (opts.rsp_nr, opts.tbb_nr) cli.command('rm -f /opt/stationtest/data/SUBR-%05d-%05d.dat', appLev) sr = testlog.Testlog(vlev, testId, logName) sr.setResult('PASSED') sr.setId('Station - ') sr.appendLog(11, '') sr.appendLog(1, 'Station production test %s' % logName) sr.appendLog(11, '') ################################################################################ sr.setId('RSP version - ') sr.appendLog(21, '') sr.appendLog( 21, '### Verify LCU - RSP ethernet link by getting the RSP version info') sr.appendLog(21, '')
def pihole(): return Response(cli.command('pihole', 'install_pihole'))
logName = 'i2c_spu.log' tlog = testlog.Testlog(vlev, testId, logName) tlog.setResult('PASSED') tlog.appendLog(11,'') tlog.appendLog(1,'Read SPU sensor to verify the RSP - SPU I2C interface for subrack %s' % subId) tlog.appendLog(11,'') ################################################################################ # Command line appLev = False cli.command('rm -f spustat.log',appLev) cli.command('rspctl --spustat > spustat.log',appLev) # Echo spustat.log into i2c_spu.log tlog.appendFile(21,'spustat.log') ################################################################################ # Verify result f=open('spustat.log','r') f.readline() # skip title line data_str = f.readline() # read measured data line j = 0 while data_str != '':
tlog.setResult('PASSED') tlog.appendLog(11, '') tlog.appendLog(1, 'Read RSP status information for the station RAD interface') tlog.appendLog(11, '') ################################################################################ # Command line repeat loop appLev = False for rep in range(repeat): tlog.appendLog(11, 'Rep-%d' % rep) # Do rspctl --status and grep for RAD lane or ri error (any case) into one.log cli.command( 'rspctl --status | egrep \'(lane| ri)\' | egrep [Ee][Rr][Rr][Oo][Rr] > one.log', appLev) # Verify result, this one.log file should be empty f = open('one.log', 'r') if f.readline() != '': # Preserve the RAD error(s) into the test log tlog.appendFile(21, 'one.log') tlog.setResult('FAILED') # Stop repeat loop after first error # f.close() # break f.close() tlog.sleep(950) tlog.appendLog(0, tlog.getResult()) tlog.closeLog()
def build(): return Response(cli.command('build', ''))
if opts.rsp_nr == 24: RspBrd = 'rsp0,rsp1,rsp2,rsp3,rsp4,rsp5,rsp6,rsp7,rsp8,rsp9,rsp10,rsp11,rsp12,rsp13,rsp14,rsp15,rsp16,rsp17,rsp18,rsp19,rsp20,rsp21,rsp22,rsp23' SubBrd = 'rsp0,rsp4,rsp8,rsp12,rsp16,rsp20' SubRck = 'sub0,sub1,sub2,sub3,sub4,sub5' # Define subrack testlog class for pass/fail and logging vlev = opts.verbosity testId = '' appLev = False # logName = '/opt/stationtest/data/SUBR-%05d-%05d.dat' % (opts.rsp_nr, opts.tbb_nr) # cli.command('rm -f /opt/stationtest/data/SUBR-%05d-%05d.dat', appLev) # logName = '/localhome/data/PPS-OPT-%s-%05s.dat' % (StID,tme) logName = '/localhome/data/PPS-OPT-%s-%s.dat' % (StID, tme) configName = '/opt/lofar/etc/%s-PPSdelays.conf' % (StID) # logName = '/localhome/data/SUBR-%05d.dat' % (opts.rsp_nr) cli.command('rm -f /localhome/data/SUBR-%05d.dat', appLev) sr = testlog.Testlog(vlev, testId, logName) sr.setResult('PASSED') sr.setId('Station - ') sr.appendLog(11, '') sr.appendLog(1, ' Station AP delay test %s' % logName) sr.appendLog(11, '') # Define config file st_log = open(configName, 'w') st_log.write('#\n') st_log.write('# APdelay.conf for %s\n' % StID)
def setup(): return Response(cli.command('setup', ''))