ItsFsap_TestCases.ttcn3 239 KB
Newer Older
4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355
                    f_deregClient(f_getIutApplicationId());
                    f_stopServiceProvider();
                    f_poDefault();
                    f_cf02Down();
                    
                } // End of testcase TC_FSAP_SU_RO_BV_01
                
                /**
                 * @desc    Reception of SAM with need for a session with need to send CTX
                 * <pre>
                 * Pics Selection: PICS_FSAP_ROLE_SU AND (PICS_ROLE_RONLY OR (PICS_ROLE_RH AND PICS_ITS_S_INW)) AND PICS_SIP_W_CTX
                 * Config Id: CF01
                 * Initial conditions: 
                 *  with {
                 *      the IUT having received GCregClient, 
                 *      and having properly registered any ITS-S application without a session 
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when { 
                 *          the IUT having received a SAM containing the expected ITS-AID
                 *      }
                 *      then {
                 *          the IUT forwards the related message to the ITS-S application using GCsam via Inter-ITS-SCU communications
                 *      }
                 *  }
                 * </pre>
                 * 
                 * @version 1.1.2
                 * @see     ETSI TS 102 797-2 v1.1.2 TP/FSAP/SU/RO/BV/02
                 */
                testcase TC_FSAP_SU_RO_BV_02() runs on ItsCalm system ItsCalmSystem {
                    // Local variables
                    var UtFsapEventInd v_utFsapEventInd;
                    var FNTPNPDU v_fntpNpdu;
                    var FsapInd v_fsapInd;
                    var CTX v_ctx;
                    
                    // Test control
                    if (not(PICS_FSAP_ROLE_SU and (PICS_ROLE_RONLY or (PICS_ROLE_RH and PICS_ITS_S_INW)) and PICS_SIP_W_CTX)) {
                        log("*** TC_FSAP_SU_RO_BV_02: ERROR: 'PICS_FSAP_ROLE_SU and (PICS_ROLE_HONLY or (PICS_ROLE_RH and PICS_ITS_S_INW)) and PICS_SIP_W_CTX' required for executing the TC ***");
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf02Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    // Clause 'Initial conditions'
                    f_regClient(
                        f_getIutApplicationId(), 
                        f_getIutServiceId(), 
                        m_gCregClientWithSessionAndCtx( 
                            f_getIutApplicationId(), 
                            f_getIutServiceId(), 
                            f_getContextData() 
                        )                    
                    );
                    f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_success); 
                    log("*** TC_FSAP_SU_RO_BV_02: INFO: GCregServer registration request done ***");
                    
                    // Test Body
                    // Clause 'when'
                    f_startServiceProvider( 
                        f_getIutServicelistWithSessionAndNoChangeChannel(), 
                        { portLong := c_portSam }, 
                        { portLong := c_portSam } 
                    );
                    log("*** TC_FSAP_SU_RO_BV_02: INFO: SAM messages sent ***");
                    
                    // Clause 'then'
                    tc_ac.start;
                    alt { 
                        [] utPort.receive( 
                            mw_fsapGcSamCtx( 
                                mw_gcSamCtx( 
                                    f_getIutApplicationId(), 
                                    f_getIutClientId(), 
                                    mw_serviceInfo_nonipService( 
                                        f_getIutServiceId(), 
                                        f_getIutSessionPort() 
                                    ), 
                                    mw_llServiceAddr(mw_linkId(f_getIutRemoteDestCiidBc(), ?))
                        ))) -> value v_utFsapEventInd { // 1. The IUT forwards the related message to the ITS-S application using GCsamctx
                            tc_ac.stop;
                            log("*** TC_FSAP_SU_RO_BV_02: INFO: GCsamctx notification as expected, acknowledged providing a port number ", v_utFsapEventInd.faSapPrimitivesUp.servPrimitive.GCsamctx.serviceInfo.info.nonipService.providerPort, " ***");
                            f_fsapGenerateFaPrimitiveWithoutConfirm( // 2. With is acknowledged providing a port number for the session
                                m_generateFaSapPrimitivesDown( 
                                    m_faSapPrimitivesDown_gcSamCtxConf( 
                                        m_gcSamCtxConf( 
                                            f_getIutApplicationId(), 
                                            v_utFsapEventInd.faSapPrimitivesUp.servPrimitive.GCsamctx.link, 
                                            f_getIutSessionPort() 
                                        ) 
                                    ) 
                                ) 
                            );
                            log("*** TC_FSAP_SU_RO_BV_02: INFO: Start waiting for CTX on fsap port now ***");
                            tc_ac.start;
                            repeat; 
                        }
                        [] utPort.receive(UtFsapEventInd:?) -> value v_utFsapEventInd { 
                            tc_ac.stop;
                            log("*** TC_FSAP_SU_RO_BV_02: FAIL: Unexpected FA.indication primitive: ,", v_utFsapEventInd, " ***");
                            f_deregClient(f_getIutApplicationId());
                            f_stopServiceProvider();
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                        }
                        [PICS_FSAP_FNTP == true] fsapPort.receive( 
                            mw_fsapInd_inSap( 
                                mw_fsapInSapPrimitiveReq( 
                                    mdw_inUnitDataReq( 
                                        mw_linkId(
                                            (c_dniCiid, ?), // See ISO 21218 Table 6 - Address parameters in e.g. IN-UNITDATA.request for CIs using 48-bit MAC addresses
                                            ? 
                                        ), 
                                        mw_linkId(f_getIutRemoteDestCiidBc(), ?) 
                         )))) -> value v_fsapInd { // 3. The IUT sends the requested CTX
                            tc_ac.stop;
                            f_oct2npdu(v_fsapInd.msgIn.msgIn_in.servPrimitive.IN_UNITDATA_request.data, c_tbDone, v_fntpNpdu);
                            log("*** TC_FSAP_SU_RO_BV_02: INFO: FNTPPDU: ", v_fntpNpdu, " ***");
                            f_oct2ctx(v_fntpNpdu.body, c_tbDone, v_ctx);
                            log(
                                "*** TC_FSAP_SU_RO_BV_02: INFO: Expected CTX: ", 
                                mdw_ctx_nonIpContext( 
                                    f_getIutClientId(), 
                                    mw_nonIpContext_contextdata( 
                                        f_getIutServiceId(), 
                                        f_getIutSessionPort(), 
                                        f_getContextData() 
                                )), 
                                " ***");
                            log("*** TC_FSAP_SU_RO_BV_02: INFO: CTX: ", v_ctx, " ***");
                            if (match(
                                v_ctx, 
                                mdw_ctx_nonIpContext( 
                                    f_getIutClientId(), 
                                    mw_nonIpContext_contextdata( 
                                        f_getIutServiceId(), 
                                        f_getIutSessionPort(), 
                                        f_getContextData() 
                                    )
                                ))) {  
                                log("*** TC_FSAP_SU_RO_BV_02: PASS: CTX notification as expected ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                            } else {
                                log("*** TC_FSAP_SU_RO_BV_02: FAIL: Unexpected CTX notification ***");
                                f_deregClient(f_getIutApplicationId());
                                f_stopServiceProvider();
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                            }
                        }
                        [] fsapPort.receive(?) {
                            tc_ac.stop;
                            log("*** TC_FSAP_SU_RO_BV_02: FAIL: Unexpected IN-SAP primitive ***");
                            f_deregClient(f_getIutApplicationId());
                            f_stopServiceProvider();
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                        }
                        [] tc_ac.timeout {
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                            log("*** TC_FSAP_SU_RO_BV_02: INCONC: Expected management message not received ***");
                        }
                    } // End of 'alt' statement
                    log("*** TC_FSAP_SU_RO_BV_02: INFO: Test body done ***");
                    
                    // Postamble
                    f_deregClient(f_getIutApplicationId());
                    f_stopServiceProvider();
                    f_poDefault();
                    f_cf02Down();
                    
                } // End of testcase TC_FSAP_SU_RO_BV_02
                
                /**
                 * @desc    Reception of SAM with need for a session with need to send CTX with need to change communication channel
                 * <pre>
                 * Pics Selection: PICS_FSAP_ROLE_SU AND (PICS_ROLE_RONLY OR (PICS_ROLE_RH AND PICS_ITS_S_INW)) AND PICS_SIP_W_CTX
                 * Config Id: CF01
                 * Initial conditions: 
                 *  with {
                 *      the IUT having received GCregClient, 
                 *      and having properly registered any ITS-S application with session initialisation using CTX
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when { 
                 *          the IUT having received a SAM containing the expected ITS-AID
                 *      }
                 *      then {
                 *          the IUT forwards the related message to the ITS-S application using GCsamctx via Inter-ITS-SCU communications
                 *      }
                 *  }
                 * </pre>
                 * 
                 * @version 1.1.2
                 * @see     ETSI TS 102 797-2 v1.1.2 TP/FSAP/SU/RO/BV/03
                 */
                testcase TC_FSAP_SU_RO_BV_03() runs on ItsCalm system ItsCalmSystem {
                    // Local variables
                    var UtFsapEventInd v_utFsapEventInd;
                    var FNTPNPDU v_fntpNpdu;
                    var FsapInd v_fsapInd;
                    var CTX v_ctx;
                    
                    // Test control
                    if (not(PICS_FSAP_ROLE_SU and (PICS_ROLE_RONLY or (PICS_ROLE_RH and PICS_ITS_S_INW)) and PICS_SIP_W_CTX)) {
                        log("*** TC_FSAP_SU_RO_BV_03: ERROR: 'PICS_FSAP_ROLE_SU and (PICS_ROLE_HONLY or (PICS_ROLE_RH and PICS_ITS_S_INW)) and PICS_SIP_W_CTX' required for executing the TC ***");
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf02Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    // Clause 'Initial conditions'
                    f_regClient(
                        f_getIutApplicationId(), 
                        f_getIutServiceId(), 
                        m_gCregClientWithSessionAndCtx( 
                            f_getIutApplicationId(), 
                            f_getIutServiceId(), 
                            f_getContextData() 
                        )                    
                    );
                    f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_success); 
                    log("*** TC_FSAP_SU_RO_BV_03: INFO: GCregServer registration request done ***");
                    
                    // Test Body
                    // Clause 'when'
                    f_startServiceProvider( 
                        f_getIutServicelistWithSessionAndChangeChannel(), 
                        { portLong := c_portSam }, 
                        { portLong := c_portSam } 
                    );
                    log("*** TC_FSAP_SU_RO_BV_03: INFO: SAM messages sent ***");
                    
                    // Clause 'then'
                    tc_ac.start;
                    alt { 
                        [] utPort.receive( 
                            mw_fsapGcSamCtx( 
                                mw_gcSamCtx( 
                                    f_getIutApplicationId(), 
                                    f_getIutClientId(), 
                                    mw_serviceInfo_nonipService( 
                                        f_getIutServiceId(), 
                                        f_getIutSessionPort() 
                                    ), 
                                    mw_llServiceAddr(mw_linkId(f_getIutRemoteDestCiidBc(), ?))
                        ))) -> value v_utFsapEventInd { // 1. The IUT forwards the related message to the ITS-S application using GCsamctx
                            tc_ac.stop;
                            log("*** TC_FSAP_SU_RO_BV_03: INFO: GCsamctx notification as expected, acknowledged providing a port number ", v_utFsapEventInd.faSapPrimitivesUp.servPrimitive.GCsamctx.serviceInfo.info.nonipService.providerPort, " ***");
                            f_fsapGenerateFaPrimitiveWithoutConfirm( // 2. With is acknowledged providing a port number for the session
                                m_generateFaSapPrimitivesDown( 
                                    m_faSapPrimitivesDown_gcSamCtxConf( 
                                        m_gcSamCtxConf( 
                                            f_getIutApplicationId(), 
                                            v_utFsapEventInd.faSapPrimitivesUp.servPrimitive.GCsamctx.link, 
                                            f_getIutSessionPort() 
                                        ) 
                                    ) 
                                ) 
                            );
                            log("*** TC_FSAP_SU_RO_BV_03: INFO: Start waiting for CTX on fsap port now ***");
                            tc_ac.start;
                            repeat; 
                        }
                        [] utPort.receive(UtFsapEventInd:?) -> value v_utFsapEventInd { 
                            tc_ac.stop;
                            log("*** TC_FSAP_SU_RO_BV_03: FAIL: Unexpected FA.indication primitive: ,", v_utFsapEventInd, " ***");
                            f_deregClient(f_getIutApplicationId());
                            f_stopServiceProvider();
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                        }
                        [PICS_FSAP_FNTP == true] fsapPort.receive( 
                            mw_fsapInd_inSap( 
                                mw_fsapInSapPrimitiveReq( 
                                    mdw_inUnitDataReq( 
                                        mw_linkId(
                                            (c_dniCiid, ?), // See ISO 21218 Table 6 - Address parameters in e.g. IN-UNITDATA.request for CIs using 48-bit MAC addresses
                                            ? 
                                        ), 
                                        mw_linkId(f_getIutRemoteDestCiidBc(), ?) 
                         )))) -> value v_fsapInd { // 3. The IUT sends the requested CTX
                            tc_ac.stop;
                            f_oct2npdu(v_fsapInd.msgIn.msgIn_in.servPrimitive.IN_UNITDATA_request.data, c_tbDone, v_fntpNpdu);
                            log("*** TC_FSAP_SU_RO_BV_03: INFO: FNTPPDU: ", v_fntpNpdu, " ***");
                            f_oct2ctx(v_fntpNpdu.body, c_tbDone, v_ctx);
                            log(
                                "*** TC_FSAP_SU_RO_BV_03: INFO: Expected CTX: ", 
                                mdw_ctx_nonIpContext( 
                                    f_getIutClientId(), 
                                    mw_nonIpContext_contextdata( 
                                        f_getIutServiceId(), 
                                        f_getIutSessionPort(), 
                                        f_getContextData() 
                                )), 
                                " ***");
                            log("*** TC_FSAP_SU_RO_BV_03: INFO: CTX: ", v_ctx, " ***");
                            if (match(
                                v_ctx, 
                                mdw_ctx_nonIpContext( 
                                    f_getIutClientId(), 
                                    mw_nonIpContext_contextdata( 
                                        f_getIutServiceId(), 
                                        f_getIutSessionPort(), 
                                        f_getContextData() 
                                    )
                                ))) {  
                                log("*** TC_FSAP_SU_RO_BV_03: PASS: CTX notification as expected ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                            } else {
                                log("*** TC_FSAP_SU_RO_BV_03: FAIL: Unexpected CTX notification ***");
                                f_deregClient(f_getIutApplicationId());
                                f_stopServiceProvider();
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                            }
                        }
                        [] fsapPort.receive(?) {
                            tc_ac.stop;
                            log("*** TC_FSAP_SU_RO_BV_03: FAIL: Unexpected IN-SAP primitive ***");
                            f_deregClient(f_getIutApplicationId());
                            f_stopServiceProvider();
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                        }
                        [] tc_ac.timeout {
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                            log("*** TC_FSAP_SU_RO_BV_03: INCONC: Expected management message not received ***");
                        }
                    } // End of 'alt' statement
                    log("*** TC_FSAP_SU_RO_BV_03: INFO: Test body done ***");
                    
                    // Postamble
                    f_deregClient(f_getIutApplicationId());
                    f_stopServiceProvider();
                    f_poDefault();
                    f_cf02Down();
                    
                } // End of testcase TC_FSAP_SU_RO_BV_03
                
            } // End of group validBehavior
            
            group invalidBehavior {
                
            } // End of group invalidBehavior
            
        } // End of group its_S_RouterOnly
        
    } // End of group serviceUser
    
filatov's avatar
filatov committed
} // End of module ItsFsap_TestCases