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

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

parent 34d8b001
Loading
Loading
Loading
Loading
+46 −8
Original line number Original line Diff line number Diff line
@@ -12,17 +12,22 @@ module LibItsCam_Functions {
    import from LibCommon_VerdictControl all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    import from LibCommon_Sync all;
    
    
    // LibIts
    // Libits
    import from LibItsCam_TestSystem all;
    import from ITS_Container language "ASN.1:1997" all;
    import from LibItsCam_Templates all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from LibItsCam_TypesAndValues all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;    
    
    // LibItsCommon
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_Templates all;
    import from LibItsCommon_Templates all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_TypesAndValues 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;
    // LibItsCam
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;    
    import from LibItsCam_TestSystem all;
    import from LibItsCam_Templates all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCam_Pics all;


    group utFuntions { 
    group utFuntions { 
            
            
@@ -117,6 +122,31 @@ module LibItsCam_Functions {


    group adapterControl {
    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.
         * @desc    Triggers event in the test system adaptation.
         * @param   p_event The event to trigger
         * @param   p_event The event to trigger
@@ -254,13 +284,18 @@ module LibItsCam_Functions {
        /**
        /**
         * @desc    Setups default configuration   
         * @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:utPort, system:utPort);
            map(self:acPort, system:acPort);
            map(self:acPort, system:acPort);
            map(self:camPort, system:camPort);
            map(self:camPort, system:camPort);
            f_connect4SelfOrClientSync();
            f_connect4SelfOrClientSync();
            
            
            // Initialise secured mode
            f_initialiseSecuredMode(p_certificateId); 
            
        } // end f_cfUp
        } // end f_cfUp
        
        
        /**
        /**
@@ -268,6 +303,9 @@ module LibItsCam_Functions {
         */
         */
        function f_cfDown() runs on ItsCam {
        function f_cfDown() runs on ItsCam {
            
            
            // Initialise secured mode
            f_uninitialiseSecuredMode();
            
            unmap(self:utPort, system:utPort);
            unmap(self:utPort, system:utPort);
            unmap(self:acPort, system:acPort);
            unmap(self:acPort, system:acPort);
            unmap(self:camPort, system:camPort);
            unmap(self:camPort, system:camPort);
+18 −5
Original line number Original line Diff line number Diff line
@@ -16,12 +16,25 @@ module LibItsCommon_Templates {
        
        
        template (value) AcSecResponse m_acSecResponseSuccess := true;
        template (value) AcSecResponse m_acSecResponseSuccess := true;
        
        
        template (value) AcSecPrimitive m_setAtCertificate(
        /**
                                                           in charstring p_atCertifcate) := {
         * @desc Enable security support
            acSetAtCertificate := {
         */
                atCertificateName := p_atCertifcate
        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;
        template AcGnssResponse m_acGnssResponseSuccess := true;
        
        
+16 −8
Original line number Original line Diff line number Diff line
@@ -87,20 +87,28 @@ module LibItsCommon_TypesAndValues {
        
        
        /**
        /**
         * @desc TA primitives for security support
         * @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 {
        type union AcSecPrimitive {
            AcSetAtCertificate acSetAtCertificate
            AcEnableSecurity acEnableSecurity,
            AcDisableSecurity acDisableSecurity
        } // End of type AcSecPrimitive
        } // End of type AcSecPrimitive
        
        
        /**
        /**
         * @desc Describes the AT certificate to be used by the TA
         * @desc    Primitive used to activate security support
         * @member atCertificateName The AT certificate name
         * @member  certificateId The certificate identifier to be used
         */
         */
        type record AcSetAtCertificate {
        type record AcEnableSecurity {
            charstring atCertificateName
            charstring certificateId
        } // End of type AcSetAtCertificate
        } // 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
         * @desc    Primitive for receiving response from TA
@@ -108,7 +116,7 @@ module LibItsCommon_TypesAndValues {
        type boolean AcSecResponse;
        type boolean AcSecResponse;
        
        
        /**
        /**
         * @desc    TA primitives for DENM
         * @desc    TA primitives for GNSS
         * @member  loadScenario                -
         * @member  loadScenario                -
         * @member  startScenario               -
         * @member  startScenario               -
         * @member  stopScenario                -
         * @member  stopScenario                -
+49 −23
Original line number Original line Diff line number Diff line
@@ -15,12 +15,12 @@ module LibItsGeoNetworking_Functions {
    import from LibCommon_Time all;
    import from LibCommon_Time all;
    
    
    // LibItsCommon
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    import from LibItsExternal_TypesAndValues all;
    import from LibItsCommon_Templates all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_Templates all;
    import from LibItsCommon_TestSystem all;
    import from LibItsCommon_TestSystem all;
    import from LibItsCommon_TypesAndValues all;
    import from LibItsExternal_TypesAndValues {type MacAddress};
    
    
    // LibItsSecurity
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_TypesAndValues all;
@@ -150,7 +150,7 @@ module LibItsGeoNetworking_Functions {
         *       - Area2 which only includes NodeB
         *       - Area2 which only includes NodeB
         *         NodeB being close to the area center
         *         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
            // Variables
            var PositionTable v_positionTable := {};
            var PositionTable v_positionTable := {};
@@ -178,7 +178,7 @@ module LibItsGeoNetworking_Functions {
            
            
        } // end f_cf01Up
        } // end f_cf01Up
        
        
        function f_cf01Down() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
        function f_cf01Down() runs on ItsGeoNetworking {
            
            
            f_uninitialiseSecuredMode();
            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
         * @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
            // Variables
            var PositionTable v_positionTable := {};
            var PositionTable v_positionTable := {};
@@ -262,7 +262,7 @@ module LibItsGeoNetworking_Functions {
        /**
        /**
         * @desc Deletes configuration cf02
         * @desc Deletes configuration cf02
         */
         */
        function f_cf02Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
        function f_cf02Down() runs on ItsMtc mtc ItsMtc {
            
            
            // Local variables
            // Local variables
            var integer i;
            var integer i;
@@ -293,7 +293,7 @@ module LibItsGeoNetworking_Functions {
         *         NodeB being close to the area center
         *         NodeB being close to the area center
         * @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
         * @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
            // Variables
            var PositionTable v_positionTable := {};
            var PositionTable v_positionTable := {};
@@ -352,7 +352,7 @@ module LibItsGeoNetworking_Functions {
        /**
        /**
         * @desc Deletes configuration cf03
         * @desc Deletes configuration cf03
         */
         */
        function f_cf03Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
        function f_cf03Down() runs on ItsMtc mtc ItsMtc {
            
            
            // Local variables
            // Local variables
            var integer i;
            var integer i;
@@ -385,7 +385,7 @@ module LibItsGeoNetworking_Functions {
         *         NodeB being close to the area center
         *         NodeB being close to the area center
         * @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
         * @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
            // Variables
            var PositionTable v_positionTable := {};
            var PositionTable v_positionTable := {};
@@ -444,7 +444,7 @@ module LibItsGeoNetworking_Functions {
        /**
        /**
         * @desc Deletes configuration cf04
         * @desc Deletes configuration cf04
         */
         */
        function f_cf04Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
        function f_cf04Down() runs on ItsMtc mtc ItsMtc {
            
            
            // Local variables
            // Local variables
            var integer i;
            var integer i;
@@ -473,7 +473,7 @@ module LibItsGeoNetworking_Functions {
         *       - Area1 which only includes NodeB, NodeD and IUT
         *       - Area1 which only includes NodeB, NodeD and IUT
         * @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
         * @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
            // Variables
            var PositionTable v_positionTable := {};
            var PositionTable v_positionTable := {};
@@ -531,7 +531,7 @@ module LibItsGeoNetworking_Functions {
        /**
        /**
         * @desc Deletes configuration cf05
         * @desc Deletes configuration cf05
         */
         */
        function f_cf05Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
        function f_cf05Down() runs on ItsMtc mtc ItsMtc {
            
            
            // Local variables
            // Local variables
            var integer i;
            var integer i;
@@ -561,7 +561,7 @@ module LibItsGeoNetworking_Functions {
         *       - IUT not in sectorial area of NodeB-NodeF
         *       - IUT not in sectorial area of NodeB-NodeF
         * @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
         * @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
            // Variables
            var PositionTable v_positionTable := {};
            var PositionTable v_positionTable := {};
@@ -619,7 +619,7 @@ module LibItsGeoNetworking_Functions {
        /**
        /**
         * @desc Deletes configuration cf06
         * @desc Deletes configuration cf06
         */
         */
        function f_cf06Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
        function f_cf06Down() runs on ItsMtc mtc ItsMtc {
            
            
            // Local variables
            // Local variables
            var integer i;
            var integer i;
@@ -648,7 +648,7 @@ module LibItsGeoNetworking_Functions {
         *       - Area1 which only includes NodeB, NodeD and IUT
         *       - Area1 which only includes NodeB, NodeD and IUT
         * @param p_mainUtComponent Name of the component that will initialize IUT and handle default UT messages
         * @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
            // Variables
            var PositionTable v_positionTable := {};
            var PositionTable v_positionTable := {};
@@ -706,7 +706,7 @@ module LibItsGeoNetworking_Functions {
        /**
        /**
         * @desc Deletes configuration cf06
         * @desc Deletes configuration cf06
         */
         */
        function f_cf07Down() runs on ItsMtc mtc ItsMtc system ItsGeoNetworkingSystem {
        function f_cf07Down() runs on ItsMtc mtc ItsMtc {
            
            
            // Local variables
            // Local variables
            var integer i;
            var integer i;
@@ -1785,11 +1785,7 @@ module LibItsGeoNetworking_Functions {
                f_getTsLongitude()
                f_getTsLongitude()
            );
            );
            
            
            return f_acTriggerEvent(
            return f_acTriggerSecEvent(m_acEnableSecurity(cc_taCert_A));
                AcGnPrimitive:{ acEnableSecurity := m_enableSecurity(
                    cc_taCert_A
                ) } 
            );
        }
        }
        
        
        /**
        /**
@@ -1800,8 +1796,38 @@ module LibItsGeoNetworking_Functions {
            
            
            f_unloadCertificates();
            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;
        }
        }
        
        
        /**
        /**
+2 −2
Original line number Original line Diff line number Diff line
@@ -33,9 +33,9 @@ module LibItsGeoNetworking_TestSystem {
         */
         */
        type port AdapterControlPort message {
        type port AdapterControlPort message {
            out
            out
                AcGnPrimitive, AcGn6Primitive, AcGnssPrimitive;
                AcGnPrimitive, AcGn6Primitive, AcGnssPrimitive, AcSecPrimitive;
            in
            in
                AcGnResponse, AcGn6Response, AcGnssResponse, AcGnssDistanceCovered;
                AcGnResponse, AcGn6Response, AcGnssResponse, AcGnssDistanceCovered, AcSecResponse;
        } // end AdapterControlPort
        } // end AdapterControlPort
        
        
        /**
        /**
Loading