Commit 995410b8 authored by garciay's avatar garciay
Browse files

Add PX_CERT_FOR_TA to indicate which certificate the Test Adapter shall use

Add AcSecPrimitive/AcSecResponse support for DENM
parent 48752d73
Loading
Loading
Loading
Loading
+50 −10
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ module LibItsDenm_Functions {
    import from LibCommon_VerdictControl all;
    import from LibCommon_Time { modulepar PX_TNOAC ; function f_sleep };
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_Templates all;
    import from LibItsCommon_TypesAndValues all;
@@ -22,8 +26,8 @@ module LibItsDenm_Functions {
    import from LibItsDenm_TestSystem all;
    import from LibItsDenm_TypesAndValues all; 
    import from LibItsDenm_Templates all; 
    import from ITS_Container language "ASN.1:1997" all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from LibItsDenm_Pixits all; 
    import from LibItsDenm_Pics all; 
    
    group utFuntions { 
            
@@ -225,12 +229,39 @@ module LibItsDenm_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 ItsDenm {
            
            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 ItsDenm {
            
            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 ItsDenm return FncRetCode {
        function f_acTriggerSecEvent(
                                     in template (value) AcSecPrimitive p_event
        ) runs on ItsDenm return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            acPort.send(p_event);
@@ -291,7 +322,7 @@ module LibItsDenm_Functions {
            if (PICS_GNSS_SCENARIO_SUPPORT==true) {
                f_acTriggerGnssEvent(m_loadScenario(p_scenario));
            }
        } // end f_acLoadScenario
        } // End of function f_acLoadScenario
        
        /**
         * @desc    Starts a loaded scenario
@@ -302,7 +333,7 @@ module LibItsDenm_Functions {
                f_acTriggerGnssEvent(m_startScenario);
                vc_scenarioStarted := true;
            }
        } // end f_acStartScenario
        } // End of function f_acStartScenario
        
        /**
         * @desc    Stops a loaded scenario
@@ -313,7 +344,7 @@ module LibItsDenm_Functions {
                f_acTriggerGnssEvent(m_stopScenario);
                vc_scenarioStarted := false;
            }
        } // end f_acStopScenario
        } // End of function f_acStopScenario
        
        function f_acAwaitDistanceCovered(float p_distanceToCover) runs on ItsDenm return FncRetCode {
            var FncRetCode v_ret := e_success;
@@ -339,7 +370,7 @@ module LibItsDenm_Functions {
                
            }
            return v_ret;
        } // end f_acAwaitDistanceCovered
        } // End of function f_acAwaitDistanceCovered
        
    } // End of group adapterControl

@@ -347,27 +378,36 @@ module LibItsDenm_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 ItsDenm system ItsDenmSystem {
        function f_cfUp(
                        in charstring p_certificateId := PX_CERT_FOR_TA
        ) runs on ItsDenm system ItsDenmSystem {
            
            map(self:acPort, system:acPort);
            map(self:utPort, system:utPort);
            map(self:denmPort, system:denmPort);
            f_connect4SelfOrClientSync();
            
        } // end f_cfUp
            // Initialise secured mode
            f_initialiseSecuredMode(p_certificateId); 
            
        } // End of function f_cfUp
        
        /**
         * @desc    Deletes default configuration 
         */
        function f_cfDown() runs on ItsDenm system ItsDenmSystem {
            
            // Initialise secured mode
            f_uninitialiseSecuredMode();
            
            unmap(self:acPort, system:acPort);
            unmap(self:utPort, system:utPort);
            unmap(self:denmPort, system:denmPort);
            f_disconnect4SelfOrClientSync();
            
        } // end f_cfDown
        } // End of function f_cfDown
        
    } //end denmConfigurationFunctions
    
+13 −8
Original line number Diff line number Diff line
@@ -14,6 +14,11 @@ module LibItsDenm_Pixits {
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    
    /**
     * @desc The certificate identifier the TA shall use in case of secured IUT
     */
    modulepar charstring PX_CERT_FOR_TA := "CERT_TS_A_AT";
    
    modulepar  Oct8 PX_CERT_IUT_DENM_01 := '0000000000000000'O;

    modulepar  Oct8 PX_CERT_IUT_DENM_02 := '0000000000000000'O;