Commit 641a5f04 authored by reinaortega's avatar reinaortega
Browse files

ITS lib refactoring

parent 29d65b03
......@@ -13,18 +13,115 @@
import from LibCommon_VerdictControl all;
// LibIts
import from LibIts_Interface all;
import from LibItsCommon_Functions all;
import from LibItsBtp_TestSystem all;
import from LibItsBtp_TypesAndValues all;
import from LibItsBtp_Templates all;
import from LibItsBtp_Pixits all;
import from LibItsCommon_Functions all;
group utFuntions {
/**
* @desc Requests to bring the IUT in an initial state
* @param p_init The initialisation to trigger.
*/
function f_utInitializeIut(template (value) UtInitialize p_init) runs on ItsBtp {
utPort.send(p_init);
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT initialized ***");
}
[] utPort.receive {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
*/
function f_utTriggerEvent(template (value) UtEvent p_event) runs on ItsBtp {
var template (value) UtTrigger v_utMsg := { p_event };
utPort.send(v_utMsg);
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
}
[] utPort.receive {
tc_wait.stop;
}
[] tc_wait.timeout {
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Checks that the event was indicated at the application layer
* @param p_event The event to check.
* @param p_discard The event should not appear. Default value: FALSE.
*/
function f_utCheckEvent(template (value) UtEvent p_event, boolean p_discard) runs on ItsBtp {
var template (value) UtCheck v_utMsg := { p_event };
utPort.send(v_utMsg);
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: INFO: Event correctly indicated at application layer ***");
}
else {
log("*** f_utCheckEvent: ERROR: Event indicated at application layer where it should be discarded ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
}
[] utPort.receive(UtResult:false) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: ERROR: Event not correctly indicated at application layer ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
else {
log("*** f_utCheckEvent: INFO: Event not indicated at application layer***");
}
}
[] tc_wait.timeout {
log("*** f_utCheckEvent: ERROR: Timeout while waiting for event check result ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
repeat;
}
}
}
} // End of group utFunctions
group configurationFunctions {
/**
* @desc Setups default configuration
*/
function f_cfUp() runs on ItsNt {
function f_cfUp() runs on ItsBtp {
map(self:utPort, system:utPort);
map(self:btpPort, system:btpPort);
......@@ -35,7 +132,7 @@
/**
* @desc Deletes default configuration
*/
function f_cfDown() runs on ItsNt {
function f_cfDown() runs on ItsBtp {
unmap(self:utPort, system:utPort);
unmap(self:btpPort, system:btpPort);
......@@ -50,7 +147,7 @@
/**
* @desc The base default.
*/
altstep a_default() runs on ItsNt {
altstep a_default() runs on ItsBtp {
[] btpPort.receive {
log("*** a_default: ERROR: Received an unexpected message ***");
......@@ -78,14 +175,14 @@
/**
* @desc The default preamble.
*/
function f_prDefault() runs on ItsNt {
function f_prDefault() runs on ItsBtp {
activate(a_default());
}
/**
* @desc Brings the IUT into an initial state.
*/
function f_prInitialState() runs on ItsNt {
function f_prInitialState() runs on ItsBtp {
f_utInitializeIut(m_btpInitialize);
f_prDefault();
......@@ -100,7 +197,7 @@
/**
* @desc The default postamble.
*/
function f_poDefault() runs on ItsNt {
function f_poDefault() runs on ItsBtp {
//empty
}
......
......@@ -8,7 +8,6 @@
module LibItsBtp_Pixits {
// LibIts
import from LibIts_Interface all;
import from LibItsBtp_TypesAndValues all;
......
......@@ -8,10 +8,9 @@
module LibItsBtp_Templates {
// LibIts
import from LibIts_Interface all;
import from LibItsBtp_TestSystem all;
import from LibItsBtp_TypesAndValues all;
import from LibItsBtp_Pixits all;
import from LibItsCommon_TypesAndValues all;
group btpPrimitivesTemplates {
......
/**
* @author ETSI / STF405
* @version $URL: svn+ssh://vcs.etsi.org/TTCN3/LIB/LibIts/trunk/ttcn/LibIts_TestSystem.ttcn $
* $Id: LibIts_TestSystem.ttcn 408 2012-02-28 13:49:56Z garciay $
* @desc Test System module for ITS BTP
*
*/
module LibItsBtp_TestSystem {
// LibCommon
import from LibCommon_Time {modulepar all};
import from LibCommon_Sync all;
// LibIts
import from LibItsCommon_TestSystem all;
import from LibItsBtp_TypesAndValues all;
group portDefinitions {
/**
* @desc Upper Tester port
*/
type port UpperTesterPort message {
out
UtInitialize, UtTrigger, UtCheck;
in
UtResult;
} // end UpperTesterPort
} // end portDefinitions
group interfacePorts {
group networkAndTransportPorts {
group nt1Ports {
/**
* @desc NT1 BTP Port (BTP/GeoNet/G5)
*/
type port BtpPort message {
in BtpInd;
out BtpReq;
} // end BtpPort
} // End of group nt1Ports
} // End of group networkAndTransportPorts
} // End of group interfacePorts
group componentDefinitions {
/**
* @desc ITS System Adapter
*/
type component ItsBtpSystem {
port UpperTesterPort utPort;
// NT1 ports
port BtpPort btpPort;
} // end component ItsAdapter
} // End of group componentDefinitions
/**
* @desc Test component for ITS Network and Transport layer
*/
type component ItsBtp extends ItsBaseComponent {
port UpperTesterPort utPort;
// NT1 ports
port BtpPort btpPort;
// timers
} // End of component ItsBtp
group networkAndTransportPrimitives {
group nt1Primitives {
/**
* @desc NT1 BTP Indication Primitive
*/
type record BtpInd {
BtpPacket msgIn
}
/**
* @desc NT1 BTP Request Primitive
*/
type record BtpReq {
BtpPacket msgOut
}
} // end nt1Primitives
} // End of group networkAndTransportPrimitives
with {
encode "LibIts_Interface"
} // end interfacePrimitives
} // End of module LibItsBtp_TestSystem
......@@ -97,7 +97,46 @@ module LibItsBtp_TypesAndValues {
} //end btpPayload
group utPrimitives {
group utCommonPrimitives {
/**
* @desc Upper Tester message to initialize IUT
*/
type union UtInitialize {
UtBtpInitialize utBtpInitialize
}
/**
* @desc Upper Tester message describing an action/event
*/
type union UtEvent {
UtBtpEvent utBtpEvent
}
/**
* @desc Upper Tester message to trigger an action on IUT
*/
type record UtTrigger {
UtEvent utEvent
}
/**
* @desc Upper Tester message to check event/status on IUT
*/
type record UtCheck {
UtEvent utEvent
}
/**
* @desc Upper Tester response message
*/
type boolean UtResult;
}
with {
encode "LibItsCommon_TypesAndValues"
}
/**
* @desc Upper Tester message to initialize BTP IUT
*/
......
......@@ -2,7 +2,7 @@
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc Module containing common functions for ITS
* @desc Module containing common functions for ITS CAM
*
*/
module LibItsCam_Functions {
......@@ -12,24 +12,117 @@ module LibItsCam_Functions {
import from LibCommon_VerdictControl all;
// LibIts
import from LibIts_TestSystem all;
import from LibIts_Interface all;
import from LibItsCam_TestSystem all;
import from LibItsCam_Templates all;
import from LibItsCam_Pixits all;
import from LibItsCam_TypesAndValues all;
import from LibItsCommon_Functions all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
// LibCommon
import from LibCommon_VerdictControl all;
group utFuntions {
/**
* @desc Requests to bring the IUT in an initial state
* @param p_init The initialisation to trigger.
*/
function f_utInitializeIut(template (value) UtInitialize p_init) runs on ItsCam {
utPort.send(p_init);
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT initialized ***");
}
[] utPort.receive {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
*/
function f_utTriggerEvent(template (value) UtEvent p_event) runs on ItsCam {
var template (value) UtTrigger v_utMsg := { p_event };
utPort.send(v_utMsg);
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
}
[] utPort.receive {
tc_wait.stop;
}
[] tc_wait.timeout {
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Checks that the event was indicated at the application layer
* @param p_event The event to check.
* @param p_discard The event should not appear. Default value: FALSE.
*/
function f_utCheckEvent(template (value) UtEvent p_event, boolean p_discard) runs on ItsCam {
var template (value) UtCheck v_utMsg := { p_event };
utPort.send(v_utMsg);
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: INFO: Event correctly indicated at application layer ***");
}
else {
log("*** f_utCheckEvent: ERROR: Event indicated at application layer where it should be discarded ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
}
[] utPort.receive(UtResult:false) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: ERROR: Event not correctly indicated at application layer ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
else {
log("*** f_utCheckEvent: INFO: Event not indicated at application layer***");
}
}
[] tc_wait.timeout {
log("*** f_utCheckEvent: ERROR: Timeout while waiting for event check result ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
repeat;
}
}
}
} // End of group utFunctions
group camConfigurationFunctions {
/**
* @desc Setups default configuration
*/
function f_cfUp() runs on ItsFa {
function f_cfUp() runs on ItsCam {
map(self:utPort, system:utPort);
map(self:camPort, system:camPort);
......@@ -40,7 +133,7 @@ module LibItsCam_Functions {
/**
* @desc Deletes default configuration
*/
function f_cfDown() runs on ItsFa {
function f_cfDown() runs on ItsCam {
unmap(self:utPort, system:utPort);
unmap(self:camPort, system:camPort);
......@@ -55,7 +148,7 @@ module LibItsCam_Functions {
/**
* @desc basic default behaviour handling
*/
altstep a_default() runs on ItsFa {
altstep a_default() runs on ItsCam {
[] camPort.receive(mw_camInd ( mw_camMsg_any )){
log("*** a_default: INFO: CAM message received in default ***");
......@@ -88,7 +181,7 @@ module LibItsCam_Functions {
* @desc Initialize the IUT
* @remark No specific actions specified in the base standard
*/
function f_prInitialState() runs on ItsFa {
function f_prInitialState() runs on ItsCam {
f_utInitializeIut(m_camInitialize);
......@@ -104,7 +197,7 @@ module LibItsCam_Functions {
/**
* @desc The default postamble.
*/
function f_poDefault() runs on ItsFa {
function f_poDefault() runs on ItsCam {
//empty
}
......
......@@ -7,12 +7,11 @@
*/
module LibItsCam_Templates {
import from LibItsCam_TestSystem all;
import from LibItsCam_TypesAndValues all;
import from LibIts_Interface all;
import from LibItsCam_Pixits all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
import from LibItsCommon_TypesAndValues all;
group camPrimitives {
......
/**
* @author ETSI / STF405
* @version $URL: svn+ssh://vcs.etsi.org/TTCN3/LIB/LibIts/trunk/ttcn/LibIts_TestSystem.ttcn $
* $Id: LibIts_TestSystem.ttcn 408 2012-02-28 13:49:56Z garciay $
* @desc Test System module for ITS CAM
*
*/
module LibItsCam_TestSystem {
// LibCommon
import from LibCommon_Time {modulepar all};
import from LibCommon_Sync all;
// LibIts
import from LibItsCommon_TestSystem all;
import from LibItsCam_TypesAndValues all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
group portDefinitions {
/**
* @desc Upper Tester port
*/
type port UpperTesterPort message {
out
UtInitialize, UtTrigger, UtCheck;
in
UtResult;
} // end UpperTesterPort
} // end portDefinitions
group interfacePorts {
group facilityPorts {
group fa1Ports {
/**
* @desc FA1 CAM Port (CAM/BTP/GeoNet/G5)
*/
type port CamPort message {
in CamInd;
out CamReq;
} // End of port CamPort
} // end fa1Ports
} // End of group facilityPorts
} // End of group interfacePorts
group componentDefinitions {
/**
* @desc ITS System Adapter
*/
type component ItsCamSystem {
port UpperTesterPort utPort;
// FA1 ports
port CamPort camPort;
} // end component ItsAdapter
} // End of group componentDefinitions
/**
* @desc Test component for ITS Facility layer
*/
type component ItsCam extends ItsBaseComponent {
port UpperTesterPort utPort;
// FA1 ports
port CamPort camPort;
//timers
//component variables
var CamInd vc_camMsg;
//default
var default vc_default := null;
//global variables
var SequenceNo vc_sequenceNo := 0;
var boolean vc_camReceived := false;
} // End of component ItsCam
group facilityPrimitives {
group fa1Primitives {
/**