ItsRSUsSimulator_TestCases.ttcn 5.82 KB
Newer Older
garciay's avatar
garciay committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module ItsRSUsSimulator_TestCases {
    
    // Libcommon
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    
    // LibItsCommon
    import from LibItsCommon_Functions all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from LibItsGeoNetworking_Templates all;
    
    // LibItsDenm
    import from LibItsDenm_Templates all;
    
    // AtsRSUsSimulator
    import from ItsRSUsSimulator_TypesAndValues all;
    import from ItsRSUsSimulator_Templates all;
    import from ItsRSUsSimulator_TestSystem all;
    import from ItsRSUsSimulator_Functions all;
garciay's avatar
garciay committed
23
    import from ItsRSUsSimulator_Pics all;
garciay's avatar
garciay committed
24
25
    import from ItsRSUsSimulator_Pixits all;
    
26
    testcase TC_RSUSIMU_BV_01() runs on ItsRSUsSimulator system ItsRSUsSimulatorSystem {
garciay's avatar
garciay committed
27
28
29
        // Local variables
        var template (value) Payload v_payload;
        var GeoNetworkingInd v_gnInd;
30
        var CfEvent v_cfEvent;
garciay's avatar
garciay committed
31
32
33
34
35
36
37
38
39
40
41
42
        
        // Test control
        
        // Test component configuration
        f_cf01Up();
            
        // Test adapter configuration
        
        // Preamble
        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
        
        // Test Body
43
44
45
        if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].beacon)) {
            tc_beacon.start;
        }
46
        if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].cam)) {
garciay's avatar
garciay committed
47
48
            tc_cam.start;
        }
49
        if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].denms)) {
garciay's avatar
garciay committed
50
51
            tc_denm.start;
        }
52
        if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].mapem)) {
garciay's avatar
garciay committed
53
54
            tc_mapem.start;
        }
55
        if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].spatems)) {
garciay's avatar
garciay committed
56
57
            tc_spatem.start;
        }
58
        if (ispresent(vc_rsuMessagesValueList[vc_rsu_id].ivim)) {
garciay's avatar
garciay committed
59
60
            tc_ivim.start;
        }
garciay's avatar
garciay committed
61

garciay's avatar
garciay committed
62
63
64
65
        alt {
            [] geoNetworkingPort.receive(
                mw_geoNwInd(
                    mw_geoNwPdu(
garciay's avatar
garciay committed
66
                        mw_geoNwTsbPacketWithNextHeader_srem(
garciay's avatar
garciay committed
67
68
69
70
                            ?,
                            ?,
                            e_btpB
            )))) -> value v_gnInd { // Receive a SREM message
71
                log("*** " & testcasename() & ": DEBUG: Processing SREM ***");
garciay's avatar
garciay committed
72
73
74
                f_processSrem(v_gnInd.msgIn);
                repeat;
            }
75
76
77
78
79
80
81
82
83
84
85
86
            [] geoNetworkingPort.receive(
                mw_geoNwInd(
                    mw_geoNwPdu(
                        mw_geoNwTsbPacketWithNextHeader_denm(
                            ?,
                            ?,
                            e_btpB // TODO Refined to exclude RSU StationID
            )))) -> value v_gnInd { // Receive a DENM message
                log("*** " & testcasename() & ": DEBUG: Processing DENM ***");
                // Nothing to do, just for logging purposes
                repeat;
            }
garciay's avatar
garciay committed
87
            [] geoNetworkingPort.receive(mw_geoNwInd(?)) -> value v_gnInd { // Receive a message
88
                log("*** " & testcasename() & ": DEBUG: Recieving unsollicited message ***");
garciay's avatar
garciay committed
89
90
91
                // Nothing to do, just for logging purposes
                repeat;
            }
92
93
94
95
96
97
            [] cfPort.receive(CfEvent:?) -> value v_cfEvent {
                log("*** " & testcasename() & ": DEBUG: Configuration port command:", v_cfEvent, " ***");
                if (f_process_cf_event(v_cfEvent) == true) {
                    repeat;
                }
            }
98
99
100
101
102
103
104
            [PICS_GENERATE_BEACON] tc_beacon.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing BEACON ***");
                f_prepare_beacon(v_payload);
                f_send(v_payload, PICS_CAM_ITS_AID);
                tc_beacon.start;
                repeat;
            }
garciay's avatar
garciay committed
105
            [PICS_GENERATE_CAM] tc_cam.timeout {
garciay's avatar
garciay committed
106
                log("*** " & testcasename() & ": DEBUG: Processing CAM ***");
garciay's avatar
garciay committed
107
                f_prepare_cam(v_payload);
108
                f_send(v_payload, PICS_CAM_ITS_AID);
garciay's avatar
garciay committed
109
110
111
                tc_cam.start;
                repeat;
            }
garciay's avatar
garciay committed
112
            [PICS_GENERATE_DENM] tc_denm.timeout {
garciay's avatar
garciay committed
113
                log("*** " & testcasename() & ": DEBUG: Processing DENM ***");
114
115
116
117
                for (var integer v_i := 0; v_i < lengthof(vc_rsuMessagesValueList[vc_rsu_id].denms); v_i := v_i + 1) {
                    f_prepare_denm(v_payload);
                    f_send(v_payload, PICS_DENM_ITS_AID);
                } // End of 'for' 
garciay's avatar
garciay committed
118
                tc_denm.start;
garciay's avatar
garciay committed
119
120
                repeat;
            }
garciay's avatar
garciay committed
121
122
123
            [PICS_GENERATE_MAPEM] tc_mapem.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing MAPEM ***");
                f_prepare_mapem(v_payload);
124
                f_send(v_payload, PICS_MAPEM_ITS_AID);
garciay's avatar
garciay committed
125
126
127
128
129
                tc_mapem.start;
                repeat;
            }
            [PICS_GENERATE_SPATEM] tc_spatem.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing SPATEM ***");
130
131
                for (var integer v_counter := 0; v_counter < lengthof(vc_rsuMessagesValueList[PX_RSU_ID - 1].spatems); v_counter := v_counter + 1) {
                    f_prepare_spatem(vc_rsuMessagesValueList[PX_RSU_ID - 1].spatems[v_counter], v_payload);
132
                    f_send(v_payload, PICS_SPATEM_ITS_AID);
133
                }
garciay's avatar
garciay committed
134
135
136
137
138
139
                tc_spatem.start;
                repeat;
            }
            [PICS_GENERATE_IVIM] tc_ivim.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing IVIM ***");
                f_prepare_ivim(v_payload);
140
                f_send(v_payload, PICS_IVIM_ITS_AID);
garciay's avatar
garciay committed
141
142
143
                tc_ivim.start;
                repeat;
            }
garciay's avatar
garciay committed
144
145
146
147
148
149
150
151
152
        } // End of 'alt' statement
        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
        
        // Postamble
        f_cf01Down();
        
    }
    
} // End of module ItsRSUsSimulator_TestCases