Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TTCN-3 Libraries
LibIts
Commits
3bc32831
Commit
3bc32831
authored
Jul 28, 2016
by
garciay
Browse files
Add PX_CERT_FOR_TA to indicate which certificate the Test Adapter shall use
Add AcSecPrimitive/AcSecResponse support for IS
parent
995410b8
Changes
17
Hide whitespace changes
Inline
Side-by-side
ttcn/CAM/LibItsCam_Functions.ttcn
View file @
3bc32831
...
...
@@ -120,14 +120,14 @@ module LibItsCam_Functions {
}
}
// End of group utFunctions
group
adapterControl
{
/**
* @desc Initialise secure mode if required
*/
function
f_initialiseSecuredMode
(
in
charstring
p_certificateId
:=
"
CERT_
TS_A_AT"
// TODO To be refined
in
charstring
p_certificateId
:=
PX_
CERT_
FOR_TA
)
runs
on
ItsCam
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
...
...
ttcn/DENM/LibItsDenm_Functions.ttcn
View file @
3bc32831
...
...
@@ -233,7 +233,7 @@ module LibItsDenm_Functions {
* @desc Initialise secure mode if required
*/
function
f_initialiseSecuredMode
(
in
charstring
p_certificateId
:=
"
CERT_
TS_A_AT"
// TODO To be refined
in
charstring
p_certificateId
:=
PX_
CERT_
FOR_TA
)
runs
on
ItsDenm
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
...
...
ttcn/GeoNetworking/LibItsGeoNetworking_Functions.ttcn
View file @
3bc32831
...
...
@@ -772,7 +772,7 @@ module LibItsGeoNetworking_Functions {
* @desc Initialise secure mode if required
*/
function
f_initialiseSecuredMode
()
runs
on
ItsBaseGeoNetworking
{
if
(
PICS_GN_SECURITY
==
true
)
{
if
(
(
PICS_GN_SECURITY
==
true
)
or
(
PICS_IS_IUT_SECURED
==
true
))
{
if
(
e_success
!=
f_acEnableSecurity
()){
log
(
"*** INFO: TEST CASE NOW STOPPING ITSELF! ***"
);
stop
;
...
...
@@ -781,8 +781,7 @@ module LibItsGeoNetworking_Functions {
}
// End of function f_initialiseSecuredMode()
function
f_uninitialiseSecuredMode
()
runs
on
ItsBaseGeoNetworking
{
if
(
PICS_GN_SECURITY
==
true
)
{
if
((
PICS_GN_SECURITY
==
true
)
or
(
PICS_IS_IUT_SECURED
==
true
))
{
f_acDisableSecurity
();
}
}
// End of function f_initialiseSecuredMode()
...
...
@@ -1775,17 +1774,19 @@ module LibItsGeoNetworking_Functions {
// Local variables
// Load certificates
if
(
not
f_loadCertificates
(
PX_IUT_SEC_CONFIG_NAME
)
)
{
return
e_error
;
}
// Initialize vc_location
f_setGenerationLocation
(
f_getTsLatitude
(),
f_getTsLongitude
()
);
return
f_acTriggerSecEvent
(
m_acEnableSecurity
(
cc_taCert_A
));
if
(
PICS_GN_SECURITY
)
{
if
(
not
f_loadCertificates
(
PX_IUT_SEC_CONFIG_NAME
)
)
{
return
e_error
;
}
// Initialize vc_location
f_setGenerationLocation
(
f_getTsLatitude
(),
f_getTsLongitude
()
);
return
f_acTriggerSecEvent
(
m_acEnableSecurity
(
cc_taCert_A
));
}
return
f_acTriggerSecEvent
(
m_acEnableSecurity
(
PX_CERT_FOR_TA
));
}
/**
...
...
ttcn/GeoNetworking/LibItsGeoNetworking_Pics.ttcn
View file @
3bc32831
...
...
@@ -65,8 +65,10 @@ module LibItsGeoNetworking_Pics {
modulepar
integer
PICS_GN_LIFETIME_LOC_TE
:=
20
;
/**
* @desc GN Security enabled or disabled
* @desc GN Security
support
enabled or disabled
* @see ETSI TS 102 871-2 Table 4
* @remark This PIC is different than PICS_IS_IUT_SECURED.
* When set to true, this PIC indicates that the GeoNetworking is running with security against a secured device
*/
modulepar
boolean
PICS_GN_SECURITY
:=
true
;
...
...
@@ -351,11 +353,13 @@ module LibItsGeoNetworking_Pics {
*/
modulepar
MacAddress
PICS_IUT_MAC_ADDRESS
:=
'
FFFFFFFFFFFF
'
O
;
/**
* @desc Is the IUT running in secured mode?
*/
modulepar
boolean
PICS_IS_IUT_SECURED
:=
false
;
}
// end geoNwPics
/**
* @desc Is the IUT running in secured mode?
* @remark This PIC is different than PICS_GN_SECURITY.
* When set to true, this PIC indicates that the GeoNetworking is running without security against a secured device
*/
modulepar
boolean
PICS_IS_IUT_SECURED
:=
false
;
}
// end LibItsGeoNetworking_Pics
\ No newline at end of file
ttcn/GeoNetworking/LibItsGeoNetworking_Pixits.ttcn
View file @
3bc32831
...
...
@@ -200,4 +200,10 @@ module LibItsGeoNetworking_Pixits {
}
// end geoNetworkingPixits
/**
* @desc The certificate identifier the TA shall use in case of secured IUT. Default: CERT_IUT_A_AT
* @remark If the IUT cannot use the test certificates, set this PIXIT to CERT_NONE
*/
modulepar
charstring
PX_CERT_FOR_TA
:=
"CERT_TS_A_AT"
;
}
// end LibItsGeoNetworking_Pixits
ttcn/IVIM/LibItsIvim_Functions.ttcn
View file @
3bc32831
...
...
@@ -29,6 +29,7 @@ module LibItsIvim_Functions {
import
from
LibItsIvim_TestSystem
all
;
import
from
LibItsIvim_TypesAndValues
all
;
import
from
LibItsIvim_Templates
all
;
import
from
LibItsIvim_Pics
all
;
import
from
LibItsIvim_Pixits
all
;
group
itsFunction
{
...
...
@@ -175,18 +176,43 @@ module LibItsIvim_Functions {
group
adapterControl
{
/**
* @desc Initialise secure mode if required
*/
function
f_initialiseSecuredMode
(
in
charstring
p_certificateId
:=
PX_CERT_FOR_TA
)
runs
on
ItsIvim
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
if
(
e_success
!=
f_acTriggerSecEvent
(
m_acEnableSecurity
(
p_certificateId
)))
{
log
(
"*** INFO: TEST CASE NOW STOPPING ITSELF! ***"
);
stop
;
}
}
}
// End of function f_initialiseSecuredMode()
function
f_uninitialiseSecuredMode
()
runs
on
ItsIvim
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
f_acTriggerSecEvent
(
m_acDisableSecurity
);
}
}
// End of function f_initialiseSecuredMode()
/**
* @desc Triggers event in the test system adaptation.
* @param p_event The event to trigger
* @return FncRetCode
*/
function
f_acTrigger
Gnss
Event
(
template
(
value
)
Ac
Gnss
Primitive
p_event
)
runs
on
ItsIvim
return
FncRetCode
{
function
f_acTrigger
Sec
Event
(
template
(
value
)
Ac
Sec
Primitive
p_event
)
runs
on
ItsIvim
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
acPort
.
send
(
p_event
);
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_ac
Gnss
ResponseSuccess
)
{
[]
acPort
.
receive
(
m_ac
Sec
ResponseSuccess
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
...
...
@@ -203,80 +229,26 @@ module LibItsIvim_Functions {
return
v_ret
;
}
/**
* @desc Loads the given scenario
*
* @param p_scenario The scenario to load.
*/
function
f_acLoadScenario
(
Scenario
p_scenario
)
runs
on
ItsIvim
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
)
{
f_acTriggerGnssEvent
(
m_loadScenario
(
p_scenario
));
}
}
// End of function f_acLoadScenario
/**
* @desc Starts a loaded scenario
*/
function
f_acStartScenario
()
runs
on
ItsIvim
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
)
{
f_acTriggerGnssEvent
(
m_startScenario
);
vc_scenarioStarted
:=
true
;
}
}
// End of function f_acStartScenario
/**
* @desc Stops a loaded scenario
*/
function
f_acStopScenario
()
runs
on
ItsIvim
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_stopScenario
);
vc_scenarioStarted
:=
false
;
}
}
// End of function f_acStopScenario
function
f_acAwaitDistanceCovered
(
float
p_distanceToCover
)
runs
on
ItsIvim
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_distanceToCover
(
p_distanceToCover
));
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_acGnssDistanceCovered
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
tc_ac
.
stop
;
log
(
"*** "
&
__SCOPE__
&
": ERROR: Received unexpected message ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_error
);
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
__SCOPE__
&
": ERROR: Timeout while waiting for covered distance indication ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
}
}
return
v_ret
;
}
// End of function f_acAwaitDistanceCovered
}
// End of group adapterControl
group
ivimConfigurationFunctions
{
/**
* @desc Setups default configuration
* @param p_certificateId The certificate identifier the TA shall use in case of secured IUT
*/
function
f_cfUp
()
runs
on
ItsIvim
system
ItsIvimSystem
{
function
f_cfUp
(
in
charstring
p_certificateId
:=
PX_CERT_FOR_TA
)
runs
on
ItsIvim
system
ItsIvimSystem
{
map
(
self
:
acPort
,
system
:
acPort
);
map
(
self
:
utPort
,
system
:
utPort
);
map
(
self
:
ivimPort
,
system
:
ivimPort
);
f_connect4SelfOrClientSync
();
// Initialise secured mode
f_initialiseSecuredMode
(
p_certificateId
);
}
// End of function f_cfUp
/**
...
...
@@ -284,6 +256,9 @@ module LibItsIvim_Functions {
*/
function
f_cfDown
()
runs
on
ItsIvim
system
ItsIvimSystem
{
// Initialise secured mode
f_uninitialiseSecuredMode
();
unmap
(
self
:
acPort
,
system
:
acPort
);
unmap
(
self
:
utPort
,
system
:
utPort
);
unmap
(
self
:
ivimPort
,
system
:
ivimPort
);
...
...
@@ -365,9 +340,6 @@ module LibItsIvim_Functions {
f_utInitializeIut
(
m_ivimStructureInitialize
);
f_acLoadScenario
(
valueof
(
p_scenario
));
f_acStartScenario
();
f_prDefault
();
return
v_ret
;
...
...
@@ -381,8 +353,7 @@ module LibItsIvim_Functions {
* @desc The default postamble.
*/
function
f_poDefault
()
runs
on
ItsIvim
{
var
FncRetCode
v_ret
:=
e_success
;
f_acStopScenario
();
// Nothing TODO
}
/**
...
...
ttcn/IVIM/LibItsIvim_Pixits.ttcn
View file @
3bc32831
...
...
@@ -20,4 +20,9 @@ module LibItsIvim_Pixits {
providerIdentifier
:=
0
}
/**
* @desc The certificate identifier the TA shall use in case of secured IUT
*/
modulepar
charstring
PX_CERT_FOR_TA
:=
"CERT_TS_A_AT"
;
}
// End of module LibItsIvim_Pixits
\ No newline at end of file
ttcn/IVIM/LibItsIvim_TestSystem.ttcn
View file @
3bc32831
...
...
@@ -31,9 +31,9 @@ module LibItsIvim_TestSystem {
*/
type
port
AdapterControlPort
message
{
out
AcGnssPrimitive
;
AcGnssPrimitive
,
AcSecPrimitive
;
in
AcGnssResponse
,
AcGnssDistanceCovered
;
AcGnssResponse
,
AcGnssDistanceCovered
,
AcSecResponse
;
}
// end AdapterControlPort
/**
...
...
ttcn/MapemSpatem/LibItsMapemSpatem_Functions.ttcn
View file @
3bc32831
...
...
@@ -17,13 +17,16 @@ module LibItsMapemSpatem_Functions {
import
from
DSRC
language
"ASN.1:1997"
all
;
// LibItsCommon
import
from
LibItsCommon_Functions
all
;
import
from
LibItsCommon_TypesAndValues
all
;
import
from
LibItsCommon_Templates
all
;
import
from
LibItsCommon_Functions
all
;
// LibItsMapemSpatem
import
from
LibItsMapemSpatem_TestSystem
all
;
import
from
LibItsMapemSpatem_TypesAndValues
all
;
import
from
LibItsMapemSpatem_Templates
all
;
import
from
LibItsMapemSpatem_Pics
all
;
import
from
LibItsMapemSpatem_Pixits
all
;
group
utFuntions
{
...
...
@@ -84,6 +87,63 @@ module LibItsMapemSpatem_Functions {
}
}
// End of group utFuntions
group
adapterControl
{
/**
* @desc Initialise secure mode if required
*/
function
f_initialiseSecuredMode
(
in
charstring
p_certificateId
:=
PX_CERT_FOR_TA
)
runs
on
ItsMapemSpatem
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
if
(
e_success
!=
f_acTriggerSecEvent
(
m_acEnableSecurity
(
p_certificateId
)))
{
log
(
"*** INFO: TEST CASE NOW STOPPING ITSELF! ***"
);
stop
;
}
}
}
// End of function f_initialiseSecuredMode()
function
f_uninitialiseSecuredMode
()
runs
on
ItsMapemSpatem
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
f_acTriggerSecEvent
(
m_acDisableSecurity
);
}
}
// End of function f_initialiseSecuredMode()
/**
* @desc Triggers event in the test system adaptation.
* @param p_event The event to trigger
* @return FncRetCode
*/
function
f_acTriggerSecEvent
(
template
(
value
)
AcSecPrimitive
p_event
)
runs
on
ItsMapemSpatem
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
acPort
.
send
(
p_event
);
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_acSecResponseSuccess
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
tc_ac
.
stop
;
log
(
"*** "
&
__SCOPE__
&
": ERROR: Received unexpected message ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_error
);
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
__SCOPE__
&
": ERROR: Timeout while waiting for adapter control event result ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
}
return
v_ret
;
}
}
// End of group adapterControl
group
altsteps
{
/**
...
...
@@ -156,9 +216,13 @@ module LibItsMapemSpatem_Functions {
/**
* @desc Setups default configuration
* @param p_certificateId The certificate identifier the TA shall use in case of secured IUT
*/
function
f_cfUp
()
runs
on
ItsMapemSpatem
{
function
f_cfUp
(
in
charstring
p_certificateId
:=
PX_CERT_FOR_TA
)
runs
on
ItsMapemSpatem
{
map
(
self
:
acPort
,
system
:
acPort
);
map
(
self
:
utPort
,
system
:
utPort
);
map
(
self
:
mapemSpatemPort
,
system
:
mapemSpatemPort
);
...
...
@@ -166,6 +230,9 @@ module LibItsMapemSpatem_Functions {
f_connect4SelfOrClientSync
();
activate
(
a_cf01Down
());
// Initialise secured mode
f_initialiseSecuredMode
(
p_certificateId
);
//Initialze the IUT
f_prInitialState
();
...
...
@@ -176,7 +243,11 @@ module LibItsMapemSpatem_Functions {
*/
function
f_cfDown
()
runs
on
ItsMapemSpatem
{
// Initialise secured mode
f_uninitialiseSecuredMode
();
unmap
(
self
:
utPort
,
system
:
utPort
);
unmap
(
self
:
acPort
,
system
:
acPort
);
unmap
(
self
:
mapemSpatemPort
,
system
:
mapemSpatemPort
);
f_disconnect4SelfOrClientSync
();
...
...
ttcn/MapemSpatem/LibItsMapemSpatem_Pixits.ttcn
View file @
3bc32831
...
...
@@ -42,5 +42,9 @@ module LibItsMapemSpatem_Pixits {
*/
modulepar
SignalGroupID
PX_SIGNAL_GROUP_ID
:=
128
;
/**
* @desc The certificate identifier the TA shall use in case of secured IUT
*/
modulepar
charstring
PX_CERT_FOR_TA
:=
"CERT_TS_A_AT"
;
}
// end LibItsMapemSpatem_Pixits
ttcn/MapemSpatem/LibItsMapemSpatem_TestSystem.ttcn
View file @
3bc32831
...
...
@@ -27,7 +27,17 @@ module LibItsMapemSpatem_TestSystem {
import
from
LibItsMapemSpatem_TypesAndValues
all
;
group
portDefinitions
{
/**
* @desc Adapter control port
*/
type
port
AdapterControlPort
message
{
out
AcSecPrimitive
;
in
AcSecResponse
;
}
// end AdapterControlPort
/**
* @desc Upper Tester port
*/
...
...
@@ -64,6 +74,7 @@ module LibItsMapemSpatem_TestSystem {
*/
type
component
ItsMapemSpatem
extends
ItsBaseComponent
{
port
AdapterControlPort
acPort
;
port
UpperTesterPort
utPort
;
port
MapemSpatemPort
mapemSpatemPort
;
//timers
...
...
ttcn/SremSsem/LibItsSremSsem_Functions.ttcn
View file @
3bc32831
...
...
@@ -17,13 +17,16 @@ module LibItsSremSsem_Functions {
import
from
DSRC
language
"ASN.1:1997"
all
;
// LibItsCommon
import
from
LibItsCommon_Functions
all
;
import
from
LibItsCommon_TypesAndValues
all
;
import
from
LibItsCommon_Templates
all
;
import
from
LibItsCommon_Functions
all
;
// LibItsSremSsem
import
from
LibItsSremSsem_TestSystem
all
;
import
from
LibItsSremSsem_TypesAndValues
all
;
import
from
LibItsSremSsem_Templates
all
;
import
from
LibItsSremSsem_Pics
all
;
import
from
LibItsSremSsem_Pixits
all
;
group
utFuntions
{
...
...
@@ -66,7 +69,39 @@ module LibItsSremSsem_Functions {
[]
utPort
.
receive
(
UtSremTriggerResult
:?
)
->
value
v_result
{
tc_wait
.
stop
;
if
(
not
v_result
)
{
f_selfOrClientSyncAndVerdict
(
"MapSpat Trigger failed"
,
e_error
);
f_selfOrClientSyncAndVerdict
(
"SREM Trigger failed"
,
e_error
);
}
}
[]
tc_wait
.
timeout
{
log
(
"*** "
&
testcasename
()
&
": INFO: Could not receive expected UT message from IUT in time ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
[
else
]
{
// Shortcut defaults
//f_sleep(0.050); // 50 ms
repeat
;
}
}
return
;
}
/**
* @desc Updates an event from the application layer
* @param p_event The event to trigger.
*/
function
f_utUpdateEvent
(
in
template
(
value
)
UtSremUpdate
p_event
)
runs
on
ItsSremSsem
{
var
UtSremUpdateResult
v_result
;
utPort
.
send
(
p_event
);
tc_wait
.
start
;
alt
{
[]
utPort
.
receive
(
UtSremUpdateResult
:?
)
->
value
v_result
{
tc_wait
.
stop
;
if
(
not
v_result
)
{
f_selfOrClientSyncAndVerdict
(
"SREM Update failed"
,
e_error
);
}
}
...
...
@@ -82,8 +117,66 @@ module LibItsSremSsem_Functions {
return
;
}
}
// End of group utFuntions
group
adapterControl
{
/**
* @desc Initialise secure mode if required
*/
function
f_initialiseSecuredMode
(
in
charstring
p_certificateId
:=
PX_CERT_FOR_TA
)
runs
on
ItsSremSsem
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
if
(
e_success
!=
f_acTriggerSecEvent
(
m_acEnableSecurity
(
p_certificateId
)))
{
log
(
"*** INFO: TEST CASE NOW STOPPING ITSELF! ***"
);
stop
;
}
}
}
// End of function f_initialiseSecuredMode()
function
f_uninitialiseSecuredMode
()
runs
on
ItsSremSsem
{
if
(
PICS_IS_IUT_SECURED
==
true
)
{
f_acTriggerSecEvent
(
m_acDisableSecurity
);
}
}
// End of function f_initialiseSecuredMode()
/**
* @desc Triggers event in the test system adaptation.
* @param p_event The event to trigger
* @return FncRetCode
*/
function
f_acTriggerSecEvent
(
template
(
value
)
AcSecPrimitive
p_event
)
runs
on
ItsSremSsem
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
acPort
.
send
(
p_event
);
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_acSecResponseSuccess
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
tc_ac
.
stop
;
log
(
"*** "
&
__SCOPE__
&
": ERROR: Received unexpected message ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_error
);
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
__SCOPE__
&
": ERROR: Timeout while waiting for adapter control event result ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
}
return
v_ret
;
}
}
// End of group adapterControl
group
altsteps
{
/**
...
...
@@ -156,9 +249,13 @@ module LibItsSremSsem_Functions {
/**
* @desc Setups default configuration
* @param p_certificateId The certificate identifier the TA shall use in case of secured IUT
*/
function
f_cfUp
()
runs
on
ItsSremSsem
{
function
f_cfUp
(
in
charstring
p_certificateId
:=
PX_CERT_FOR_TA
)
runs
on
ItsSremSsem
{
map
(
self
:
acPort
,
system
:
acPort
);
map
(
self
:
utPort
,
system
:
utPort
);
map
(
self
:
sremSsemPort
,
system
:
sremSsemPort
);
...
...
@@ -166,6 +263,9 @@ module LibItsSremSsem_Functions {
f_connect4SelfOrClientSync
();