Commit 0d175e25 authored by garciay's avatar garciay
Browse files

Add AcSecPrimitive/AcSecResponse support for CAM (DENM to be done)

parent 34d8b001
......@@ -12,17 +12,22 @@ module LibItsCam_Functions {
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
// LibIts
import from LibItsCam_TestSystem all;
import from LibItsCam_Templates all;
import from LibItsCam_TypesAndValues all;
// Libits
import from ITS_Container language "ASN.1:1997" all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_Pixits all;
import from LibItsCommon_Templates all;
import from LibItsCommon_Functions all;
import from LibItsCommon_TypesAndValues all;
import from ITS_Container language "ASN.1:1997" all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
// LibItsCam
import from LibItsCam_TestSystem all;
import from LibItsCam_Templates all;
import from LibItsCam_TypesAndValues all;
import from LibItsCam_Pics all;
group utFuntions {
......@@ -117,6 +122,31 @@ module LibItsCam_Functions {
group adapterControl {
/**
* @desc Initialise secure mode if required
*/
function f_initialiseSecuredMode(
in charstring p_certificateId := "CERT_TS_A_AT" // TODO To be refined
) runs on ItsCam {
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 ItsCam {
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
......@@ -254,13 +284,18 @@ module LibItsCam_Functions {
/**
* @desc Setups default configuration
*/
function f_cfUp() runs on ItsCam {
function f_cfUp(
in charstring p_certificateId := "CERT_TS_A_AT" // TODO To be refined
) runs on ItsCam {
map(self:utPort, system:utPort);
map(self:acPort, system:acPort);
map(self:camPort, system:camPort);
f_connect4SelfOrClientSync();
// Initialise secured mode
f_initialiseSecuredMode(p_certificateId);
} // end f_cfUp
/**
......@@ -268,6 +303,9 @@ module LibItsCam_Functions {
*/
function f_cfDown() runs on ItsCam {
// Initialise secured mode
f_uninitialiseSecuredMode();
unmap(self:utPort, system:utPort);
unmap(self:acPort, system:acPort);
unmap(self:camPort, system:camPort);
......
......@@ -16,12 +16,25 @@ module LibItsCommon_Templates {
template (value) AcSecResponse m_acSecResponseSuccess := true;
template (value) AcSecPrimitive m_setAtCertificate(
in charstring p_atCertifcate) := {
acSetAtCertificate := {
atCertificateName := p_atCertifcate
/**
* @desc Enable security support
*/
template (value) AcSecPrimitive m_acEnableSecurity(
in charstring p_certificateId
) := {
acEnableSecurity := {
certificateId := p_certificateId
}
}
} // End of template m_acEnableSecurity
/**
* @desc Disable security support
*/
template (value) AcSecPrimitive m_acDisableSecurity := {
acDisableSecurity := {
disable := true
}
} // End of template m_acDisableSecurity
template AcGnssResponse m_acGnssResponseSuccess := true;
......
......@@ -87,20 +87,28 @@ module LibItsCommon_TypesAndValues {
/**
* @desc TA primitives for security support
* @member acSetCertificate Set the AT certificate to be used by the TA
* @member acSetCertificate Primitive used to activate security support
* @member acDisableSecurity Primitive used to deactiate security support
*/
type union AcSecPrimitive {
AcSetAtCertificate acSetAtCertificate
AcEnableSecurity acEnableSecurity,
AcDisableSecurity acDisableSecurity
} // End of type AcSecPrimitive
/**
* @desc Describes the AT certificate to be used by the TA
* @member atCertificateName The AT certificate name
* @desc Primitive used to activate security support
* @member certificateId The certificate identifier to be used
*/
type record AcSetAtCertificate {
charstring atCertificateName
} // End of type AcSetAtCertificate
type record AcEnableSecurity {
charstring certificateId
} // End of type AcEnableSecurity
/**
* @desc Primitive used to deactiate security support
*/
type record AcDisableSecurity {
boolean disable
} // End of type AcDisableSecurity
/**
* @desc Primitive for receiving response from TA
......@@ -108,7 +116,7 @@ module LibItsCommon_TypesAndValues {
type boolean AcSecResponse;
/**
* @desc TA primitives for DENM
* @desc TA primitives for GNSS
* @member loadScenario -
* @member startScenario -
* @member stopScenario -
......
......@@ -15,12 +15,12 @@ module LibItsGeoNetworking_Functions {
import from LibCommon_Time all;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
import from LibItsExternal_TypesAndValues all;
import from LibItsCommon_Templates all;
import from LibItsCommon_Functions all;
import from LibItsCommon_Pixits all;
import from LibItsCommon_Templates all;
import from LibItsCommon_TestSystem all;
import from LibItsCommon_TypesAndValues all;
import from LibItsExternal_TypesAndValues {type MacAddress};
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
......@@ -150,7 +150,7 @@ module LibItsGeoNetworking_Functions {
* - Area2 which only includes NodeB
* NodeB being close to the area center
*/
function f_cf01Up(Scenario p_scenario := e_staticPosition) runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
function f_cf01Up(Scenario p_scenario := e_staticPosition) runs on ItsGeoNetworking {
// Variables
var PositionTable v_positionTable := {};
......@@ -178,7 +178,7 @@ module LibItsGeoNetworking_Functions {
} // end f_cf01Up
function f_cf01Down() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
function f_cf01Down() runs on ItsGeoNetworking {
f_uninitialiseSecuredMode();
......@@ -203,7 +203,7 @@ module LibItsGeoNetworking_Functions {
*
* @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
*/
function f_cf02Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf02Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc {
// Variables
var PositionTable v_positionTable := {};
......@@ -262,7 +262,7 @@ module LibItsGeoNetworking_Functions {
/**
* @desc Deletes configuration cf02
*/
function f_cf02Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf02Down() runs on ItsMtc mtc ItsMtc {
// Local variables
var integer i;
......@@ -293,7 +293,7 @@ module LibItsGeoNetworking_Functions {
* NodeB being close to the area center
* @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
*/
function f_cf03Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf03Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc {
// Variables
var PositionTable v_positionTable := {};
......@@ -352,7 +352,7 @@ module LibItsGeoNetworking_Functions {
/**
* @desc Deletes configuration cf03
*/
function f_cf03Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf03Down() runs on ItsMtc mtc ItsMtc {
// Local variables
var integer i;
......@@ -385,7 +385,7 @@ module LibItsGeoNetworking_Functions {
* NodeB being close to the area center
* @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
*/
function f_cf04Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf04Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc {
// Variables
var PositionTable v_positionTable := {};
......@@ -444,7 +444,7 @@ module LibItsGeoNetworking_Functions {
/**
* @desc Deletes configuration cf04
*/
function f_cf04Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf04Down() runs on ItsMtc mtc ItsMtc {
// Local variables
var integer i;
......@@ -473,7 +473,7 @@ module LibItsGeoNetworking_Functions {
* - Area1 which only includes NodeB, NodeD and IUT
* @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
*/
function f_cf05Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf05Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc {
// Variables
var PositionTable v_positionTable := {};
......@@ -531,7 +531,7 @@ module LibItsGeoNetworking_Functions {
/**
* @desc Deletes configuration cf05
*/
function f_cf05Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf05Down() runs on ItsMtc mtc ItsMtc {
// Local variables
var integer i;
......@@ -561,7 +561,7 @@ module LibItsGeoNetworking_Functions {
* - IUT not in sectorial area of NodeB-NodeF
* @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
*/
function f_cf06Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf06Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc {
// Variables
var PositionTable v_positionTable := {};
......@@ -619,7 +619,7 @@ module LibItsGeoNetworking_Functions {
/**
* @desc Deletes configuration cf06
*/
function f_cf06Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf06Down() runs on ItsMtc mtc ItsMtc {
// Local variables
var integer i;
......@@ -648,7 +648,7 @@ module LibItsGeoNetworking_Functions {
* - Area1 which only includes NodeB, NodeD and IUT
* @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
*/
function f_cf07Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf07Up(in charstring p_mainUtComponent := c_compMTC, Scenario p_scenario := e_staticPosition) runs on ItsMtc mtc ItsMtc {
// Variables
var PositionTable v_positionTable := {};
......@@ -706,7 +706,7 @@ module LibItsGeoNetworking_Functions {
/**
* @desc Deletes configuration cf06
*/
function f_cf07Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
function f_cf07Down() runs on ItsMtc mtc ItsMtc {
// Local variables
var integer i;
......@@ -1785,11 +1785,7 @@ module LibItsGeoNetworking_Functions {
f_getTsLongitude()
);
return f_acTriggerEvent(
AcGnPrimitive:{ acEnableSecurity := m_enableSecurity(
cc_taCert_A
) }
);
return f_acTriggerSecEvent(m_acEnableSecurity(cc_taCert_A));
}
/**
......@@ -1800,10 +1796,40 @@ module LibItsGeoNetworking_Functions {
f_unloadCertificates();
return f_acTriggerEvent(AcGnPrimitive:{ acDisableSecurity := m_disableSecurity } );
return f_acTriggerSecEvent(m_acDisableSecurity);
}
/**
* @desc Triggers event in the test system adaptation.
* @param p_event The event to trigger
* @return FncRetCode
*/
function f_acTriggerSecEvent(
in template (value) AcSecPrimitive p_event
) runs on ItsBaseGeoNetworking 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;
}
/**
* @desc Triggers event in the test system adaptation.
* @param p_event The event to trigger
......
......@@ -33,9 +33,9 @@ module LibItsGeoNetworking_TestSystem {
*/
type port AdapterControlPort message {
out
AcGnPrimitive, AcGn6Primitive, AcGnssPrimitive;
AcGnPrimitive, AcGn6Primitive, AcGnssPrimitive, AcSecPrimitive;
in
AcGnResponse, AcGn6Response, AcGnssResponse, AcGnssDistanceCovered;
AcGnResponse, AcGn6Response, AcGnssResponse, AcGnssDistanceCovered, AcSecResponse;
} // end AdapterControlPort
/**
......
......@@ -1010,8 +1010,9 @@ module LibItsGeoNetworking_TypesAndValues {
* @member startBeaconingMultipleNeighbour -
* @member stopBeaconingMultipleNeighbour -
* @member getLongPosVector -
* @member acEnableSecurity -
* @member acDisableSecurity -
// TODO To be removed
// * @member acEnableSecurity -
// * @member acDisableSecurity -
*/
type union AcGnPrimitive {
AcStartBeaconing startBeaconing,
......@@ -1020,9 +1021,9 @@ module LibItsGeoNetworking_TypesAndValues {
AcStopPassBeaconing stopPassBeaconing,
AcStartBeaconingMultipleNeighbour startBeaconingMultipleNeighbour,
AcStopBeaconingMultipleNeighbour stopBeaconingMultipleNeighbour,
AcGetLongPosVector getLongPosVector,
AcGetLongPosVector getLongPosVector/*, TODO To be removed
AcEnableSecurity acEnableSecurity,
AcDisableSecurity acDisableSecurity
AcDisableSecurity acDisableSecurity*/
}
/**
......
......@@ -188,7 +188,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
v_str := v_str & "Prefix=" & oct2str(vc_gvlTable[i].prefix) & "/" & int2str(vc_gvlTable[i].prefixLength) & " "
& "Area=" & vc_gvlTable[i].area & c_CRLF;
if (isvalue(p_validLifetimes) and lengthof(p_validLifetimes)>=(i+1)) {
v_str := " Lifetime=" & v_str & int2str(p_validLifetimes[i]);
v_str := " Lifetime=" & v_str & int2str(valueof(p_validLifetimes[i]));
}
v_str := v_str & c_CRLF;
}
......@@ -198,7 +198,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
else {
for (i:=0; i<lengthof(p_gvls); i:=i+1) {
if (isvalue(p_validLifetimes) and lengthof(p_validLifetimes)>=(i+1)) {
v_validLifetime := p_validLifetimes[i];
v_validLifetime := valueof(p_validLifetimes[i]);
}
f_sendGeoBroadcastWithRtAdv(vc_gvlTable[i], c_compNodeA, v_validLifetime);
}
......@@ -709,7 +709,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
var Oct2 v_checksum := 'FFFF'O;
log("*** " & testcasename() & ": INFO: calling fx_computeIPv6CheckSum() ***");
v_checksum := fx_computeIPv6CheckSum(p_sourceAddress, p_destinationAddress, p_payloadLength, p_payload, p_nextHdr);
v_checksum := fx_computeIPv6CheckSum(valueof(p_sourceAddress), valueof(p_destinationAddress), valueof(p_payloadLength), valueof(p_payload), valueof(p_nextHdr));
return v_checksum;
}
......
......@@ -2613,26 +2613,27 @@ module LibItsSecurity_Templates {
} // End of group profileCertificates
group taPrimitives {
/**
* @desc Enable security support
*/
template (value) AcEnableSecurity m_enableSecurity(
in charstring p_certificateId
) := {
certificateId := p_certificateId
} // End of template m_enableSecurity
/**
* @desc Disable security support
*/
template (value) AcDisableSecurity m_disableSecurity := {
disable := true
} // End of template m_disableSecurity
} // End of group taPrimitives
// TODO To be removed
// group taPrimitives {
//
// /**
// * @desc Enable security support
// */
// template (value) AcEnableSecurity m_acEnableSecurity(
// in charstring p_certificateId
// ) := {
// certificateId := p_certificateId
// } // End of template m_acEnableSecurity
//
// /**
// * @desc Disable security support
// */
// template (value) AcDisableSecurity m_acDisableSecurity := {
// disable := true
// } // End of template m_acDisableSecurity
//
// } // End of group taPrimitives
//
group utPrimitives {
template UtInitialize m_secGnInitialize(
......
......@@ -974,25 +974,26 @@ module LibItsSecurity_TypesAndValues {
} // End of group taConfiguration
group taPrimitives {
/**
* @desc Primitive used to activate security support
* @member certificateId The certificate identifier to be used
*/
type record AcEnableSecurity {
charstring certificateId
} // End of type AcEnableSecurity
/**
* @desc Primitive used to deactiate security support
*/
type record AcDisableSecurity {
boolean disable
} // End of type AcDisableSecurity
} // End of group taPrimitives
// TODO To be removed
// group taPrimitives {
//
// /**
// * @desc Primitive used to activate security support
// * @member certificateId The certificate identifier to be used
// */
// type record AcEnableSecurity {
// charstring certificateId
// } // End of type AcEnableSecurity
//
// /**
// * @desc Primitive used to deactiate security support
// */
// type record AcDisableSecurity {
// boolean disable
// } // End of type AcDisableSecurity
//
// } // End of group taPrimitives
//
group utPrimitives {
}
......
......@@ -233,7 +233,7 @@ module LibItsSremSsem_Functions {
m_ssemReq(
m_ssemPdu(
m_ssem(
p_signalRequestMessage
valueof(p_signalRequestMessage)
))));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment