コード例 #1
0
ファイル: ucl.py プロジェクト: mull3rcw/python_mt_unitTest
def read_stest_count():
    if (get_ser().isOpen() == False):
        get_log_cm().error("serial not available")
        return -1

    # send UART request
    input = '/opt/maxim-ic/basic/examples/ucl_example'
    get_ser().write(input.encode('ascii') + '\n')
    time.sleep(1)

    out = get_ser().readlines()
    #generator: creates "matches list" only if parsed TMP info present.
    #print "Out is %s" % out
    valid = [v for v in out if "DES" in v]
    passed = [x for x in out if "PASSED" in x]
    fails = [z for z in out if "FAILED" in z]
    #if not matches:
    if not valid:
        get_log_cm().error("\t\t\t(read_stest_count)Possible reset")
        return -1
    elif not fails:
        #Passes
        count = 0
    else:
        count = 0
        #Count each Failure detected
        for y in fails:
            count += 1
    return count
コード例 #2
0
def read_smart_card(card_id):
	x = isCardPresent(card_id)
	time.sleep(1)
	if(x < 0):
		#Card failed to read
		get_log_cm().error("\t\tcard %d failed to read" % (card_id))
		run = handle_failed_card_read()
		if run == False:
			return -1
		return 1
	elif x == 0:
		get_log_cm().error("\t\t\tcard %d is Missing" % (card_id))
		return 1
	elif x == 1:
		#Get ATR
		set_fail_count(0)
		if x > 0:
			if x == True:
				emv_data = getEnvData(card_id)
				get_log_cm().debug("Card %d ATR %s" % (card_id, emv_data))
				if "No EMV Support" not in str(emv_data):
					characters = emv_data.replace(' ', '')
					get_log_cm().debug("Card %d ATR string %s" % (card_id, characters.decode('hex')))
					return 0
				else:
					get_log_cm().error("x is %d UNKNOWN") % (x)
					return 1
コード例 #3
0
def card_bay_open():
    power_on()
    pull_off()
    time.sleep(1)
    power_off()
    #print "card_bay_open -Plunger pushed forward, locked by magnet"
    get_log_cm().debug(" ---card_bay_open---")
コード例 #4
0
ファイル: ucl.py プロジェクト: mull3rcw/python_mt_unitTest
def read_stest_count():
	if (get_ser().isOpen()==False):
		get_log_cm().error("serial not available")
		return -1

	# send UART request
	input = '/opt/maxim-ic/basic/examples/ucl_example'
	get_ser().write(input.encode('ascii')+'\n')
	time.sleep(1)

	out = get_ser().readlines()
	#generator: creates "matches list" only if parsed TMP info present.
	#print "Out is %s" % out
	valid = [v for v in out if "DES" in v]
	passed = [x for x in out if "PASSED" in x]
	fails = [z for z in out if "FAILED" in z]
	#if not matches:
	if not valid:
		get_log_cm().error("\t\t\t(read_stest_count)Possible reset")
		return -1
	elif not fails:	
		#Passes
		count = 0
	else:
		count = 0
		#Count each Failure detected
		for y in fails:
			count += 1
	return count
コード例 #5
0
def read_secdiag_val_old():
    if (get_ser().isOpen() == False):
        get_log_cm().info("\t\t\t(read_secdiag_val)serial not available")
        return -1

    print "read_secdiag_val Here"
    input = '/opt/maxim-ic/hcr4/apps/secmon /dev/secmon0 5 ffe0200c'
    get_ser().write(input.encode('ascii') + '\n')
    time.sleep(1)
    out = get_ser().readlines()

    print out
    count = -1
    if not out:
        get_log_cm().error("\t\t\t(read_secdiag_val)Possible reset")
    elif len(out) < 15:
        get_log_cm().error("\t\t\t(read_secdiag_val)Possible reset, too short")
    elif 'Error reading' in out:
        get_log_cm().error("\t\t\t(read_secdiag_val)secdiag read error")
    elif 'fee0200c =' in out[15]:
        # Brute force index values
        print out[15][11:]
        count = int(out[15][11:], 16)
    else:
        get_log_cm().error("Tamper secdiag return not found.")
    return count
コード例 #6
0
def card_bay_locked():
    power_on()
    pull_on()
    time.sleep(1)
    power_off()
    #print "card_bay_locked -Plunger pulled back"
    get_log_cm().debug(" ---card_bay_lock---")
コード例 #7
0
def card_bay_open():
	power_on()
	pull_off()
	time.sleep(1)
	power_off()
	#print "card_bay_open -Plunger pushed forward, locked by magnet"
	get_log_cm().debug(" ---card_bay_open---")
コード例 #8
0
def read_smart_card(card_id):
    x = isCardPresent(card_id)
    time.sleep(1)
    if (x < 0):
        #Card failed to read
        get_log_cm().error("\t\tcard %d failed to read" % (card_id))
        run = handle_failed_card_read()
        if run == False:
            return -1
        return 1
    elif x == 0:
        get_log_cm().error("\t\t\tcard %d is Missing" % (card_id))
        return 1
    elif x == 1:
        #Get ATR
        set_fail_count(0)
        if x > 0:
            if x == True:
                emv_data = getEnvData(card_id)
                get_log_cm().debug("Card %d ATR %s" % (card_id, emv_data))
                if "No EMV Support" not in str(emv_data):
                    characters = emv_data.replace(' ', '')
                    get_log_cm().debug("Card %d ATR string %s" %
                                       (card_id, characters.decode('hex')))
                    return 0
                else:
                    get_log_cm().error("x is %d UNKNOWN") % (x)
                    return 1
コード例 #9
0
def card_bay_locked():
	power_on()
	pull_on()
	time.sleep(1)
	power_off()
	#print "card_bay_locked -Plunger pulled back"
	get_log_cm().debug(" ---card_bay_lock---")
コード例 #10
0
def set_tamper_trigger(num):
    input = 'secmon /dev/secmon0 4 ' + str(num)
    if (get_ser().isOpen() == False):
        get_log_cm().info("\t\t\tserial not available")
        return
    #get_ser().write(input.encode('ascii')+'\n')
    #time.sleep(1)
    #out = get_ser().readlines()
    out = Hcr4SendCMD(input)
    if 'Error Getting SEC_GET_STATUS' in out:
        get_log_cm().info("\t\t\tsecmon read error")
コード例 #11
0
def handle_failed_card_read():
	count=get_fail_count()
	set_fail_count(count+1)
	ret = True
	get_log_cm().error("\t\t\tFailed %d for Card", count)
	#if 5 failed reads in a row, the system may have reset.
	if get_fail_count() > MAX_COM_RETRY:
		get_log_cm().error("\t\t\tReading stopped, Reboot restarting script.\n\n\n")
		serial_close()
		ret = False
	return ret
コード例 #12
0
def handle_failed_card_read():
    count = get_fail_count()
    set_fail_count(count + 1)
    ret = True
    get_log_cm().error("\t\t\tFailed %d for Card", count)
    #if 5 failed reads in a row, the system may have reset.
    if get_fail_count() > MAX_COM_RETRY:
        get_log_cm().error(
            "\t\t\tReading stopped, Reboot restarting script.\n\n\n")
        serial_close()
        ret = False
    return ret
コード例 #13
0
def read_secdiag_val_obsolete():
    if (get_ser().isOpen() == False):
        get_log_cm().info("\t\t\t(read_secdiag_val)serial not available")
        return -1

    input = '/opt/maxim-ic/hcr4/apps/secmon /dev/secmon0 5 ffe0200c'
    get_ser().write(input.encode('ascii') + '\n')
    time.sleep(1)
    out = get_ser().readlines()

    #Filter all out for ifstatement
    matches = [x for x in out if "fee0200c" in x]

    if not matches:  #out:
        get_log_cm().error("\t\t\t(read_secdiag_val)Possible reset")
        val = -1
    else:
        conv = matches[0][12:]
        val = int(conv, 16)
    return val
コード例 #14
0
ファイル: ping.py プロジェクト: mull3rcw/python_mt_unitTest
def can_addr_ping(addr):		
	response = os.system('ping -n 1 %s > temp.txt' % addr)
	time.sleep(1)
	ret = False
	if response != 0:
		get_log_cm().info("Ping to %s Failed" % (addr))
		return ret
	txt = open("temp.txt")
	out = txt.readlines()
	if "Destination host unreachable" in str(out):
		get_log_cm().error("Ping Dest Unreachable")
		return ret
	elif "Lost = 0" not in str(out):
		print 'Ping Lost'
		return ret
	else:	
		ret = True
	txt.close()			
	response = os.remove('temp.txt')
	return ret
コード例 #15
0
def read_tamper_count():
    if (get_ser().isOpen() == False):
        get_log_cm().error("serial not available")
        return -1

    # send UART request
    input = '/opt/maxim-ic/hcr4/apps/secmon /dev/secmon0 3'
    get_ser().write(input.encode('ascii') + '\n')
    time.sleep(1)

    out = get_ser().readlines()
    #generator: creates "matches list" only if parsed TMP info present.
    matches = [x for x in out if "TMP" in x]
    if not matches:
        get_log_cm().error("\t\t\t(read_tamper_count)Possible reset")
        return -1
    else:
        count = 0
        for y in matches:
            count += int(y[7:])
    return count
コード例 #16
0
def read_rtc_count():
    if (get_ser().isOpen() == False):
        get_log_cm().error("serial not available")
        return -1

    # send UART request
    input = '/opt/maxim-ic/hcr4/apps/secmon /dev/secmon0 3'
    get_ser().write(input.encode('ascii') + '\n')
    time.sleep(1)

    out = (get_ser().readlines())
    #generator: creates "matches list" only if parsed TMP info present.
    lRtc = [x for x in out if "RTC:" in x]
    #s_index = 5 #smatch.find('RTC:\\t\\t')+8
    #print("lRtc is %s\n" % lRtc)
    #print("lRtc[s_index:] is %s\n" % lRtc[0][5:])
    count = -1

    try:
        if not lRtc:
            get_log_cm().error("\t\t\t(read_rtc_count)Possible reset")
        else:
            count = int(lRtc[0][5:])
    except ValueError:
        get_log_cm().error("\t\t\t(read_rtc_count)Possible reset error")
    return count
コード例 #17
0
def become_root ():
	# check list for NOK or OK
	rootDone = False
	check = True

	while check:
		state = await_boot_complete()
		if "Pending" in state:
			rootDone = False
			check = True
		elif "BootDone" in state:
			rootDone = False
			check = False
		else:
			rootDone = True
			check = False

	if rootDone == False:
		out = str(get_ser().readlines())
		get_log_cm().info("Out is %s", out)
		get_log_cm().info("Send Password")
		input = 'root'
		get_ser().write(input.encode('ascii')+'\n')
		time.sleep(1)
		get_ser().write(input.encode('ascii')+'\n')

    #Make all passes go through this (move out of if)
	time.sleep(3)
	input = 'cd /opt/maxim-ic/hcr4/apps'
	get_ser().write(input.encode('ascii')+'\n')
    # end
	time.sleep(1)

	#Check if in the correct directory
	input = 'ls'
	get_ser().write(input.encode('ascii')+'\n')
	time.sleep(2)
	out = get_ser().readlines()

	if "sci" in str(out):
		return True
	else:
		get_log_cm().debug("FAIL to find SCIBASIC")
		input = 'pwd'
		get_ser().write(input.encode('ascii')+'\n')
		time.sleep(1)
		get_log_cm().info("%s" % str(get_ser().readlines()))
		return False
コード例 #18
0
def setCardFacilitator():
    #This statys running until completes
    ser = get_ser()
    input = '/opt/maxim-ic/basic/examples/card_facilitator'
    ser.write(input.encode('ascii') + '\n')
    #Wait 2 seconds for Sam card
    get_log_cm().info("Pull out MSR read within 10 seconds")
    out = str(ser.readlines())
    get_log_cm().info(out)
    time.sleep(10)
    #Control-C
    input = '\x03'
    ser.write(input.encode('ascii'))  #+'\n')
    get_log_cm().info("DONE")
コード例 #19
0
def setCardFacilitator ():
	#This statys running until completes
	ser = get_ser()
	input = '/opt/maxim-ic/basic/examples/card_facilitator'
	ser.write(input.encode('ascii')+'\n')
	#Wait 2 seconds for Sam card
	get_log_cm().info("Pull out MSR read within 10 seconds")
	out = str(ser.readlines())
	get_log_cm().info(out) 
	time.sleep(10)
	#Control-C
	input = '\x03'
	ser.write(input.encode('ascii')) #+'\n')
	get_log_cm().info("DONE")
コード例 #20
0
def find_dev_secmon_name():
    if (get_ser().isOpen() == False):
        get_log_cm().info("\t\t\tserial not available")
        return -1
    input = 'ls /dev/secm*'
    get_ser().write(input.encode('ascii') + '\n')
    time.sleep(2)
    out = get_ser().readlines()

    if not out:
        get_log_cm().error("\t\t\t(find_dev_secmon_name)Possible Reset")
    elif "ls" is out:
        get_log_cm().error("\t\t\t/dev/secmon not found")
    else:
        print out
        s_index = out[1].find('dev') + 4
        e_index = out[1].find(r"\x1b", s_index)
        print out[1][s_index:e_index]
コード例 #21
0
def isCardPresent(num):
    # check list for NOK or OK
    ser = get_ser()
    input = '/opt/maxim-ic/hcr4/apps/sci /dev/sc 3'
    index = input.find(' 3')
    input2 = input[:index] + str(num) + input[index:]

    ser.write(input2.encode('ascii') + '\n')
    out = ser.readlines()
    if "NOK" in str(out):
        get_log_cm().error("Card Missing")
        return False
    elif " OK" in str(out):
        get_log_cm().debug("Card Present")
        return True
    else:
        get_log_cm().error("Failed to read")
        return -1
コード例 #22
0
def isCardPresent (num):
	# check list for NOK or OK
	ser = get_ser()
	input = '/opt/maxim-ic/hcr4/apps/sci /dev/sc 3'
	index = input.find(' 3')
	input2 = input[:index] + str(num) + input[index:]

	ser.write(input2.encode('ascii')+'\n')
	out = ser.readlines()
	if "NOK" in str(out):
		get_log_cm().error("Card Missing")
		return False
	elif " OK" in str(out):
		get_log_cm().debug("Card Present")
		return True
	else:
		get_log_cm().error("Failed to read")
		return -1
コード例 #23
0
def _ser_init():

	wait4ser=True

	while wait4ser:
		try:
			set_ser(serial.Serial(port, baud, timeout=1))
			get_ser().close()
			get_ser().open()
			wait4ser=False
		except serial.SerialException:
			get_log_cm().info("Oops! waiting 15 seconds. Is the serial port %s available" % port)
			wait4ser=True
			set_ser(0)
			time.sleep(15)

	if get_ser().isOpen():
		get_log_cm().info(get_ser().name + ' is open...')
	else:
		get_log_cm().error('Another UART blocking '+get_ser().name)
コード例 #24
0
ファイル: hcr4.py プロジェクト: mull3rcw/python_mt_unitTest
						print ("Reading stopped, Reboot suspected")
						get_ser().close()
						run = 0
						break
				else:	
					#Get Transition Change
					count = 0
					if isCardP[i] != x:
						isCardP[i] = x
						ts = time.time()
						st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
						if isCardP[i] == True:
							if i == 1:
								card_bay_locked() #plunger is pulled
								print "%s Card %d Present & Locked" % (st, i)
								get_log_cm().info("%s Card %d Present & Locked" % (st, i))
							else:
								print "%s Card %d Present" % (st, i)
								get_log_cm().info("%s Card %d Present" % (st, i))
							emv_data = getEnvData(i)
							print ("%s Card %d ATR %s" % (st, i, emv_data))
							get_log_cm().info("%s Card %d ATR %s" % (st, i, emv_data))
							#Print ASCII, if data is available
							if "No EMV Support" not in str(emv_data):
								characters = emv_data.replace(' ', '')
								print "%s Card %d ATR string %s" % (st, i, characters.decode('hex'))
							if i == 1:
								card_bay_open() #Plunger goes forward
								print "%s Card %d Bay opened, Remove Card Quickly!!" % (st, i)
								get_log_cm().info("%s Card %d Bay opened, Remove Card Quickly!!" % (st, i))
						else:
コード例 #25
0
def power_off():
    latch_config(POWER_DOWN)
    get_log_cm().debug("power_off")
    return True
コード例 #26
0
def pull_off():
    latch_config(PULL_OFF)
    get_log_cm().debug("pull_off")
    return True
コード例 #27
0
def latched_close():
    latch_config(LATCHED_CLOSE)
    get_log_cm().debug("\n latched_close\n")
    return True
コード例 #28
0
if __name__ == '__main__':
    ##############USER DEFINED##################################################################################
    ##Overwrite Log location
    my_path = '..\\solenoid_log\\'
    my_name = 'solendoid_test'
    test_count = 10
    ##############USER DEFINED##################################################################################

    ##One time setup
    while True:
        test_count = 0
        ########Passing Counters########
        total_count = 0
        run = 1
        ################################

        ##############INIT #################
        set_log_info(my_path, my_name)
        ser_Init()
        #card_bay_init()
        ##############INIT END##############
        get_log_cm().info('Start %s Test', my_name)
        get_log_cm().info('Test :\n Solenoid')

        while run:
            #Total Test Cycles
            #get_log_cm().info( "\n")
            total_count += 1
            get_log_cm().debug("Total Test Cycles = %d", total_count)
            time.sleep(1)
コード例 #29
0
def get_fail_count():
	global fail_count
	if 'fail_count' not in globals():
		get_log_cm().error("Error: fail_count not init")
		fail_count=0
	return fail_count
コード例 #30
0
##One time setup
	while True:
		test_count 			= 0
########Passing Counters########
		total_count 	= 0
		smart_card_count = 0
		MAX_COM_RETRY	= 5

################################

##############INIT #################
		ser_Init()
		run = 1
		#card_bay_init()
##############INIT END##############
		get_log_cm().info('Start %s Test', my_name)
		get_log_cm().info('Test: Smart Card')

		while run:
			total_count+=1
			get_log_cm().debug( "Total Test Cycles = %d", total_count)

			#SMARTCARD Test:##########################################################
			for i in range(1,2):
					val = read_smart_card(i)
					if val == -1:
						run = 0
						break
					if val == 0:
						smart_card_count+=1
			#SMARTCARD Test:##########################################################
コード例 #31
0
		smart_card_count 	= 0
		tamper_count 	= 0
		rtc_stamp 	= 0
		total_count 	= 0
		MAX_COM_RETRY	= 5	
################################		
	

##############INIT #################					
		prev_dev = "Not Init"
		ser_Init()
		#Requires Serial init
		hostname = find_ip_addr('eth0')
		set_tamper_trigger(tamper_flag)
##############INIT END##############		
		get_log_cm().info('Start FCC Test')
		get_log_cm().info('Test :\n UART, Ethernet, USB, SmartCard')

		while run:
			#Total Test Cycles
			#get_log_cm().info( "\n")
			total_count+=1
			get_log_cm().debug( "Total Test Cycles = %d", total_count)
			
			#Ethernet Test:###########################################################
			###Find HCR-4 IP Address####
			if hostname != -1:
				ret = can_addr_ping(hostname)
				if ret == True:
					ethernet_count+=1
					
コード例 #32
0
def await_boot_complete():
	input = 'root'
	get_ser().write(input.encode('ascii')+'\n')
	time.sleep(3)
	out = str(get_ser().readlines())

	if "jibe-eek login" in out:
		get_log_cm().info("Boot up Complete")
		return "BootDone"
	elif "root@jibe-eek examples" in out:
		get_log_cm().info("Root up Complete")
		return "RootDone"
	elif "SecureBoot/disabled (EvKit-revC-B5)>" in out:
		get_log_cm().info("U-Boot detected, reset u-boot and wait 40 seconds")
		input = 'reset'
		get_ser().write(input.encode('ascii')+'\n')
		time.sleep(40)
		get_log_cm().info("Go Back to listening")
		return "Pending"
	elif "root@jibe" in out:
		get_log_cm().info("Root Log Complete")
		return "RootDone"
	elif "#" in out:
		get_log_cm().info("Root Log Complete")
		return "RootDone"
	elif "Password" in out:
		input = 'ls'
		get_ser().write(input.encode('ascii')+'\n')
		time.sleep(5)
		get_log_cm().info("Boot up Complete:PW")
		return "BootDone"
	else:
		get_log_cm().info("%s: Awaiting Bootup", port )
		input = 'cd /root'
		get_ser().write(input.encode('ascii')+'\n')
		time.sleep(2)
		get_log_cm().info("Awaiting2 Bootup")
		get_log_cm().info("%s" % out)
		return "Pending"
コード例 #33
0
        smart_card_count = 0
        tamper_count = 0
        rtc_stamp = 0
        cdc_count = 0
        total_count = 0
        MAX_COM_RETRY = 5
        ################################

        ##############INIT #################
        prev_dev = "Not Init"
        ser_Init()
        #Requires Serial init
        hostname = find_ip_addr('eth0')
        set_tamper_trigger(tamper_flag)
        ##############INIT END##############
        get_log_cm().info('Start FCC Test')
        get_log_cm().info('Test :\n UART, Ethernet, USB, SmartCard')

        while run:
            #Total Test Cycles
            #get_log_cm().info( "\n")
            total_count += 1
            get_log_cm().debug("Total Test Cycles = %d", total_count)

            #Ethernet Test:###########################################################
            ###Find HCR-4 IP Address####
            if hostname != -1:
                ret = can_addr_ping(hostname)
                if ret == True:
                    ethernet_count += 1
コード例 #34
0
    SLEEP_DURATION = 2
    CUSTOMER_DELAY = 5

    while True:
        ########Passing Counters########
        total_count = 0
        smart_card_count = 0
        run = 1
        ################################

        ##############INIT #################

        ser_Init()
        card_bay_init()
        ##############INIT END##############
        get_log_cm().info('Start %s Test', my_name)
        while run:
            total_count += 1
            if total_count >= test_count:
                card_bay_init()  #
                run = 0

            get_log_cm().info("Total Test Cycles = %d Sleep for %d seconds!",
                              total_count, CUSTOMER_DELAY)
            time.sleep(CUSTOMER_DELAY)
            #card_bay_locked()
            latched_close()
            #SMARTCARD Test:##########################################################
            for i in range(1, 2):
                val = read_smart_card(i)
                if val == -1:
コード例 #35
0
def latched_open():
    latch_config(LATCHED_OPEN)
    get_log_cm().debug("\n latched_open\n")
    return True
コード例 #36
0
known_val = "Hexadecimal VendorID=0x525 & ProductID=0xa4ac"

usb_count = 0;


while (1):
	dev = usb.core.find(find_all=True)
	time.sleep(1)
	if prev_dev == "Not Init":
		for cfg in dev:
			sys.stdout.write("idVendor %s\n\n" % cfg.idVendor)
			if cfg.idVendor == 0x0525:
				prev_dev = cfg
				usb_count += 1
	elif prev_dev != "Not Init":
		for cfg in dev:
			if cfg is None:
				get_log_cm().error('\t\t\tUSB Device not found')
			elif cfg is 'NoneType':
				get_log_cm().error('\t\t\tUSB Device noneType found')
			else:
				sys.stdout.write( "PREV VENDOR %s\n" % prev_dev.idVendor)
				sys.stdout.write("cfg VENDOR %s\n" % cfg.idVendor)
				if prev_dev.idVendor == cfg.idVendor and prev_dev.idProduct == cfg.idProduct:
					usb_count += 1
					
	sys.stdout.write("count %d\n\n" % usb_count)

  
  
  
コード例 #37
0
def pull_on():
    latch_config(PULL_ON)
    get_log_cm().debug("pull_on")
    return True
コード例 #38
0
def latched_open ():
	latch_config(LATCHED_OPEN)
	get_log_cm().debug("\n latched_open\n")
	return True
コード例 #39
0
def power_on():
    latch_config(POWER_ON)
    get_log_cm().debug("power_on")
    return True
コード例 #40
0
def pull_on ():
	latch_config(PULL_ON)
	get_log_cm().debug("pull_on")
	return True
コード例 #41
0
########Passing Counters########
		uart_count 		= 0
		tamper_count 	= 0
		rtc_stamp 	= 0
		total_count 	= 0
		MAX_COM_RETRY	= 5
################################


##############INIT #################
		prev_dev = "Not Init"
		ser_Init()
		#Requires Serial init
		set_tamper_trigger(tamper_flag)
##############INIT END##############
		get_log_cm().info('Start TAMPER Monitor Test')

		while run:
			total_count+=1
			get_log_cm().debug( "Total Test Cycles = %d", total_count)


			#UART:####################################################################
			ret = uart_self_test()
			if ret == False:
				uart_count += 1
			get_log_cm().info( "UART Count = \t\t\t%d of %d", uart_count, total_count)
			#UART end:################################################################

			#TAMPER:####################################################################
			if tamper_flag != 0:
コード例 #42
0
def power_on ():
	latch_config(POWER_ON)
	get_log_cm().debug("power_on")
	return True
コード例 #43
0
		crypto_count = 0
		total_count 	= 0
		MAX_COM_RETRY	= 5
		SECONDS_PMIN = 60
		MINUTES_DELAY = (SECONDS_PMIN * DELAY_PER_CYCLE)
################################


##############INIT #################
		prev_dev = "Not Init"
		ser_Init()
		#Requires Serial init
		hostname = find_ip_addr('eth0')
		set_tamper_trigger(tamper_flag)
##############INIT END##############
		get_log_cm().info('Start FCC Test')
		get_log_cm().info('Test :\n UART, Ethernet, USB, SmartCard')

		while run:
			#Total Test Cycles
			#get_log_cm().info( "\n")
			total_count+=1
			get_log_cm().debug( "Total Test Cycles = %d", total_count)

			#Ethernet Test:###########################################################
			###Find HCR-4 IP Address####
			if hostname != -1:
				ret = can_addr_ping(hostname)
				if ret == True:
					ethernet_count+=1
コード例 #44
0
def get_fail_count():
    global fail_count
    if 'fail_count' not in globals():
        get_log_cm().error("Error: fail_count not init")
        fail_count = 0
    return fail_count
コード例 #45
0
	test_count = 10
##############USER DEFINED##################################################################################

##One time setup
	while True:
		test_count 			= 0
########Passing Counters########
		total_count 	= 0
		run = 1
################################		
	

##############INIT #################					
		set_log_info(my_path, my_name, 1)
		ser_Init()
		#card_bay_init()
##############INIT END##############		
		get_log_cm().info('Start %s Test', my_name)
		get_log_cm().info('Test :\n Solenoid')
		card_bay_init()

		while run:
			#Total Test Cycles
			#get_log_cm().info( "\n")
			total_count+=1
			pull_off()
			get_log_cm().debug( "Total Test Cycles = %d", total_count)
			time.sleep(5)
			pull_on()
			get_log_cm().debug( "Total Test Cycles = %d", total_count)
			
コード例 #46
0
	CUSTOMER_DELAY		=	5
	
	
	while True:
########Passing Counters########
		total_count 		=	0
		smart_card_count 	=	0
		run 				=	1
################################		

##############INIT #################
		
		ser_Init()
		card_bay_init()
##############INIT END##############		
		get_log_cm().info('Start %s Test', my_name)
		while run:
			total_count+=1
			if total_count >= test_count:
				card_bay_init() # 
				run = 0
				
			get_log_cm().info( "Total Test Cycles = %d Sleep for %d seconds!", total_count, CUSTOMER_DELAY)
			time.sleep(CUSTOMER_DELAY)
			#card_bay_locked()
			latched_close()
			#SMARTCARD Test:##########################################################
			for i in range(1,2):
					val = read_smart_card(i)
					if val == -1:
						run = 0
コード例 #47
0
def latched_close ():
	latch_config(LATCHED_CLOSE)
	get_log_cm().debug("\n latched_close\n")
	return True
コード例 #48
0
        rtc_stamp = 0
        crypto_count = 0
        total_count = 0
        MAX_COM_RETRY = 5
        SECONDS_PMIN = 60
        MINUTES_DELAY = (SECONDS_PMIN * DELAY_PER_CYCLE)
        ################################

        ##############INIT #################
        prev_dev = "Not Init"
        ser_Init()
        #Requires Serial init
        hostname = find_ip_addr('eth0')
        set_tamper_trigger(tamper_flag)
        ##############INIT END##############
        get_log_cm().info('Start FCC Test')
        get_log_cm().info('Test :\n UART, Ethernet, USB, SmartCard')

        while run:
            #Total Test Cycles
            #get_log_cm().info( "\n")
            total_count += 1
            get_log_cm().debug("Total Test Cycles = %d", total_count)

            #Ethernet Test:###########################################################
            ###Find HCR-4 IP Address####
            if hostname != -1:
                ret = can_addr_ping(hostname)
                if ret == True:
                    ethernet_count += 1
コード例 #49
0
def pull_off ():
	latch_config(PULL_OFF)
	get_log_cm().debug("pull_off")
	return True
コード例 #50
0
ファイル: ping.py プロジェクト: mull3rcw/python_mt_unitTest
##################################################
#Main Code Here
##################################################
if __name__=='__main__':
	
	while True:
		run = 1
		ethernet_count = 0
		total_count = 0
		my_path = '..\\ping_log\\'
		my_name = 'ping_test'
		set_log_info(my_path, my_name, 0)
		ser_Init()
		
		while run:
			#Total Test Cycles
			get_log_cm().info("\n")
			total_count+=1
		
			#Ethernet Test:###########################################################
			###Find HCR-4 IP Address####
			hostname = find_ip_addr('eth0')
			if hostname != -1:
				ret = can_addr_ping(hostname)
				if ret == True:
					ethernet_count+=1
					
			get_log_cm().info( "Ethernet Count = \t\t%d of %d", ethernet_count, total_count)
			#Ethernet Test end:#######################################################
			
コード例 #51
0
def power_off ():
	latch_config(POWER_DOWN)
	get_log_cm().debug("power_off")
	return True
コード例 #52
0
		smart_card_count 	= 0
		tamper_count 	= 0
		rtc_stamp 	= 0
		total_count 	= 0
		MAX_COM_RETRY	= 5
################################


##############INIT #################
		prev_dev = "Not Init"
		ser_Init()
		#Requires Serial init
		hostname = find_ip_addr('eth0')
		set_tamper_trigger(tamper_flag)
##############INIT END##############
		get_log_cm().info('Start FCC Test')
		get_log_cm().info('Test :\n UART, Ethernet, USB, SmartCard')

		while run:
			#Total Test Cycles
			#get_log_cm().info( "\n")
			total_count+=1
			get_log_cm().debug( "Total Test Cycles = %d", total_count)

			#Ethernet Test:###########################################################
			###Find HCR-4 IP Address####
			if hostname != -1:
				ret = can_addr_ping(hostname)
				if ret == True:
					ethernet_count+=1
コード例 #53
0
		#print e_index - s_index
		return out[s_index:e_index]
	else:
		return -1

##################################################
#Main Code Here
##################################################
if __name__=='__main__':
	while True:
		run = 1
		cdc_count = 0
		total_count = 0
		my_path = '..\\ping_log\\'
		my_name = 'ping_test'
		set_log_info(my_path, my_name, 0)
		ser_Init()

		while run:
			#Total Test Cycles
			get_log_cm().info("\n")
			total_count+=1

			#Ethernet Test:###########################################################
			###Find HCR-4 IP Address####
			if find_cdc_rsp_data() != -1:
				cdc_count = cdc_count+1
			get_log_cm().info( "CDC Count = \t\t%d of %d", cdc_count, total_count)
			#Ethernet Test end:#######################################################

コード例 #54
0
def ser_Init():
	_ser_init()

	while become_root() == False:
		get_log_cm().debug("\t\t\t\tChecking for ROOT\n")
	get_log_cm().info("\tROOT Detected!!")