Project

General

Profile

Bug #182 » my_timeissue_normal.py

Veronique bouzid, 09/07/2014 10:33 AM

 
1
# -*- coding: utf-8 *-*
2

    
3
################################################################################
4
# activateLfrMode
5
# SVS-0034 (REQ-LFR-SRS-5509)
6
# SSS-CP-FS-320
7
################################################################################
8
# execfile('/opt/PYTHON/lfrverif/LFR_SVS/SVS-0034/activateLfrModeTiming.py')
9
#import sys
10

    
11
## To ensure the imported modified files are properly reloaded.
12
#for mod in sys.modules.values():
13
    #strmod = str(mod)
14
    #if not ('\'PythonQt' in strmod) and not ('\'sys\'' in strmod) and \
15
        #not ('\'pygments.' in strmod) and \
16
        #not ('\'__main__\'' in strmod) and not ('\'paste\'' in strmod) and \
17
        #not ('\'/usr/lib64/python2.7/' in strmod) and not(mod is None):
18
    ##if ('\'lfrverif' in strmod):
19
        #print mod
20
        #reload(mod)
21

    
22
import inspect
23
from lfrverif.common.param import *
24
#import time
25
from datetime import datetime
26

    
27
# setting up LPPMON plugins
28
from __main__ import proxy
29
if not(proxy.instanceExists("RMAPPlugin0")):
30
    proxy.loadSysDriver("RMAPPlugin", "RMAPPlugin0")
31
    from lfrverif.BridgeDef.bridge_def import bridge_id
32

    
33
    proxy.loadSysDriverToParent("dsu3plugin", "RMAPPlugin0")
34
    dsu3plugin0.openFile(LFR_FSW_PATH)
35
    dsu3plugin0.loadFile()
36
    dsu3plugin0.run()
37

    
38
from __main__ import RMAPPlugin0
39

    
40
from lfrverif.common.actions_tc_lfr_launcher import *
41
from lfrverif.common.test_monitor import time_sent
42
from lfrverif.common.miscellaneous.fun_misc import *
43

    
44
ACK_EXECUTION_COMPLETION = 1
45
ACK_ACCEPTANCE = 1
46
SOURCE_ID = SOURCE_ID_ENUM[0]
47

    
48
rk10 = SPW_HEADER_SIZE + 10
49
rk11 = SPW_HEADER_SIZE + 11
50
rk12 = SPW_HEADER_SIZE + 12
51
rk14 = SPW_HEADER_SIZE + 14
52
rk16 = SPW_HEADER_SIZE + 16
53
rk18 = SPW_HEADER_SIZE + 18
54
log_time = ""
55

    
56
current_file = inspect.currentframe().f_code.co_filename
57

    
58
test_launcher = TestLauncher(RMAPPlugin0, bridge_id)
59
test_launcher.test_monitor.progress_memo += (
60
    "SocExplorerEngine.getSocExplorer: Version = " + SocExplorerEngine.getSocExplorerVersion() +
61
    ", Branch = " + SocExplorerEngine.getSocExplorerBranch() +
62
    ", Changeset = " + SocExplorerEngine.getSocExplorerChangeset() + '\n')
63

    
64
test_launcher.test_monitor.log_memo(current_file)
65
postponeNextTimeBeforeTc(1)
66

    
67
tc_lfr_enter_mode = TcLfrEnterMode()
68
tc_lfr_update_time = TcLfrUpdateTime()
69

    
70
init_tc_header([tc_lfr_enter_mode, tc_lfr_update_time],
71
    ACK_EXECUTION_COMPLETION, ACK_ACCEPTANCE, SOURCE_ID)
72

    
73
# For this TC, Msb of byte 11 is used (for spare)
74
spare = tc_lfr_enter_mode.SpW[SPW_HEADER_SIZE + 11] & 0xf0
75

    
76
# Initial mode is NORMAL (ie cp_lfr_mode=1):
77
tc_lfr_enter_mode.SpW[rk11] = spare | 1
78
tc_lfr_enter_mode.ComputeCrc()
79

    
80
#tc_lfr_enter_mode.SpW[rk12:rk18] = CUC0[:]
81
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
82
surveyAnyTmPacket(test_launcher, 2)  # delay to verify the current mode
83

    
84
#    cp_rpw_time_aux = 0x7fffffff & random.randrange(0xffffffff)
85
#    tc_lfr_update_time.SpW[rk10:rk14] =\
86
#        [(cp_rpw_time_aux >> 24) & 0xff, (cp_rpw_time_aux >> 16) & 0xff,
87
#        (cp_rpw_time_aux >> 8) & 0xff, cp_rpw_time_aux & 0xff]
88
#    tc_lfr_update_time.ComputeCrc()
89
#    displayInfoSendTc(test_launcher, tc_lfr_update_time)
90
#    surveyAnyTmPacket(test_launcher, SY_RPW_CTR_FREQUENCY)
91

    
92
# je me mets au 1er juillet 2014
93
# 23h10 = 0x1B45 FD97 0000
94
tc_lfr_update_time.SpW[rk10:rk14] = [ 0x1B,0x45,0xfd,0x97]
95
tc_lfr_update_time.ComputeCrc()
96
dispCrcSendSpwTcSurvey(test_launcher, tc_lfr_update_time)
97
surveyAnyTmPacket(test_launcher, .3)
98

    
99
RMAPPlugin0.sendOneTimecode()
100
surveyAnyTmPacket(test_launcher, 340)
101

    
102
f_detail = open('lfr_internal_time.txt', 'w')
103
f_detail.write(log_time)
104
f_detail.close()
105

    
106
# Final mode in STANDBY (ie cp_lfr_mode=0):
107
tc_lfr_enter_mode.SpW[rk11] = spare
108
tc_lfr_enter_mode.SpW[rk12:rk18] = CUC0[:]
109
dispCrcSendSpwTcWaitVerifPkt(test_launcher, tc_lfr_enter_mode)
110
surveyAnyTmPacket(test_launcher, 1)  # delay to verify the current mode
111

    
112
test_launcher.test_monitor.log_memo("End(" + current_file + ")")
113
test_launcher.test_monitor.archivalRecord()
(1-1/8)