Commit 2872303d authored by wattelet's avatar wattelet
Browse files

MAP SPAT development first phase

parent 82371377
Loading
Loading
Loading
Loading
+141 −0
Original line number Diff line number Diff line
@@ -21,5 +21,146 @@ module LibItsMapSpat_Functions {
    import from DSRC language "ASN.1:1997" all;
    import from EU language "ASN.1:1997" 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 ItsMapSpat {
            
            utPort.send(p_init);
            tc_wait.start;
            alt {
                [] utPort.receive(UtInitializeResult:true) {
                    tc_wait.stop;
                    log("*** " & testcasename() & ": INFO: IUT initialized ***");
                }
                [] tc_wait.timeout {
	                log("*** " & testcasename() & ": INFO: Could not receive expected UT message from IUT in time ***");
	                f_selfOrClientSyncAndVerdict("error", e_timeout);
	            }
	            [else] { // Shortcut defaults
	                repeat; 
	            }
            }            
        }
    } // end group utFuntions
    
    group altsteps {
        
        /**
         * @desc The base default.
         */
        altstep a_default() runs on ItsMapSpat {
            [] mapSpatPort.receive ( mw_mapInd ( mw_mapPdu ( ? , mw_anyMap ) ) ) { 
                log("*** " & testcasename() & ": INFO: MAP message received in default ***");
                vc_mapReceived := true;
                repeat;
            }
            [] mapSpatPort.receive ( mw_spatInd ( mw_spatPdu ( ? , mw_anySpat ) ) ) { 
                log("*** " & testcasename() & ": INFO: MAP message received in default ***");
                vc_spatReceived := true;
                repeat;
            }
            [] mapSpatPort.receive {
                log("*** " & testcasename() & ": ERROR: Received an unexpected message ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] any timer.timeout {
                log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_poDefault();
                f_cfDown();
                log("*** " & testcasename() & ": INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;   
            }
        }
        
        /**
         * @desc The default for handling upper tester messages.
         */
        altstep a_utDefault() runs on ItsMapSpat {
            var UtMapEventInd v_mapevent;
            var UtSpatEventInd v_spatevent;
            [] utPort.receive(UtMapEventInd:?) -> value v_mapevent {
                //store every upper tester indication received
                vc_utMapEvents[lengthof(vc_utMapEvents)] := v_mapevent;
                repeat;
            }
            [] utPort.receive(UtSpatEventInd:?) -> value v_spatevent {
                //store every upper tester indication received
                vc_utSpatEvents[lengthof(vc_utSpatEvents)] := v_spatevent;
                repeat;
            }
            [] utPort.receive {
                tc_wait.stop;
                log("*** " & testcasename() & ": INFO: Received unexpected UT message from IUT ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
        }
        
    } // end group altsteps

    group mapSpatConfigurationFunctions {
        
        /**
         * @desc    Setups default configuration   
         */
        function f_cfUp() runs on ItsMapSpat {
            
            map(self:utPort, system:utPort);
            map(self:mapSpatPort, system:mapSpatPort);
            f_connect4SelfOrClientSync();
        } // end f_cfUp
        
        /**
         * @desc    Deletes default configuration 
         */
        function f_cfDown() runs on ItsMapSpat {
            
            unmap(self:utPort, system:utPort);
            unmap(self:mapSpatPort, system:mapSpatPort);
            f_disconnect4SelfOrClientSync();
        } // end f_cfDown
        
    } // end of mapSpatConfigurationFunctions
    
    group preambles {
        
        /**
         * @desc The default preamble.
         */
        function f_prDefault() runs on ItsMapSpat {
            vc_default := activate(a_default());
            activate(a_utDefault());
        }
        
        /**
         * @desc Brings the IUT into an initial state.
         * @return FncRetCode 
         */
        function f_prInitialState() runs on ItsMapSpat return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            f_utInitializeIut(m_mapSpatInitialize);
            f_prDefault();
            return v_ret;
        }
        
    } // end group preambles

    group postambles {
        
        /**
         * @desc The default postamble.
         */
        function f_poDefault() runs on ItsMapSpat {
            //empty
        }
        
    } // end group postambles

} // end LibItsMapSpat_Functions
 No newline at end of file
+166 −0
Original line number Diff line number Diff line
@@ -15,6 +15,172 @@ module LibItsMapSpat_Templates {
    import from ITS_Container language "ASN.1:1997" all;
    import from DSRC language "ASN.1:1997" all;
    import from EU language "ASN.1:1997" all;
    import from MAP_SPAT_CEN language "ASN.1:1997" all;
    
    group primitivesTemplates {
        
        /**
         * @desc    Send template for MAP Message (MapSpatPort Primitive)
         * @param   p_mapMsg    The MAP Message to be sent
         */
        template (value) MapReq m_mapReq ( template (value) MAP p_mapMsg ) := {  msgOut := p_mapMsg }
        
        /**
         * @desc    Receive template for MAP Message (MapSpatPort Primitive)
         * @param   p_mapMsg    The expected MAP Message
         */
        template (present) MapInd mw_mapInd ( template (present) MapMsg p_mapMsg ) := { msgIn := p_mapMsg }
        
        /**
         * @desc    Send template for SPAT Message (MapSpatPort Primitive)
         * @param   p_mapMsg    The SPAT Message to be sent
         */
        template (value) SpatReq m_spatReq ( template (value) SPAT p_spatMsg ) := { msgOut := p_spatMsg }
        
        /**
         * @desc    Receive template for SPAT Message (MapSpatPort Primitive)
         * @param   p_mapMsg    The expected SPAT Message
         */
       template (present) SpatInd mw_spatInd ( template (present) SpatMsg p_spatMsg ) := { msgIn := p_spatMsg };

	}

	group utPrimitives {
            
		/**
		* @desc    Send template for Upper Tester event initialization
		*/
		template (value) UtInitialize m_mapSpatInitialize := {
    	}
	}

    group mapSpatPduTemplates {
        
        /**
         * @desc    Send template for MAP PDU
         * @param   p_denm  The MAP Message
         */
        template (value) MAP m_mapPdu (
            template (value) MapData p_map
        ) := {
            header := m_itsPduHeader,
            mapM := p_map
        }

        /**
         * @desc    Send template for SPAT PDU
         * @param   p_denm  The SPAT Message
         */
        template (value) SPAT m_spatPdu (
            template (value) SpatData p_spat
        ) := {
            header := m_itsPduHeader,
            spat := p_spat
        }
        
        /**
         * @desc    Default receive template for MAP PDU
         * @param   p_itsPduHeader  The expected ITS PDU header (Default: any)
         * @param   p_denm          The expected MAP Message (Default: any)
         */
        template MapMsg mw_mapPdu (
            template (present) ItsPduHeader p_itsPduHeader := ?,
            template (present) MapData p_map := ?
        ) := {
            msg := {
                header := p_itsPduHeader,
            	mapM := p_map },
            rawData := ?
        }
        
        /**
         * @desc    Default receive template for SPAT PDU
         * @param   p_itsPduHeader  The expected ITS PDU header (Default: any)
         * @param   p_denm          The expected SPAT Message (Default: any)
         */
        template SpatMsg mw_spatPdu (
            template (present) ItsPduHeader p_itsPduHeader := ?,
            template (present) SpatData p_spat := ?
        ) := {
            msg := {
                header := p_itsPduHeader,
            	spat := p_spat },
            rawData := ?
        }
        
    } // end mapSpatPduTemplates
    
    group headerTemplates {
        
        /**
         * @desc    Default send template for ITS PDU header
         * @param   p_stationID         The source station ID (Default: test system station id)
         * @param   p_protocolVersion   The protocol version (Default: current DEN protocol version)
         * @param   p_messageID         The message Id (Default: DEN message id)
         */
        template (value) ItsPduHeader m_itsPduHeader(
            template (value) StationID p_stationID := f_getTsStationId(),
            template (value) ItsPduHeader.protocolVersion p_protocolVersion := c_protocolVersionMapSpat,
            template (value) ItsPduHeader.messageID p_messageID := c_messageId
        ) := {
            protocolVersion := p_protocolVersion,
            messageID := p_messageID,
            stationID := p_stationID
        }
        
        /**
         * @desc    Default receive template for ITS PDU header
         * @param   p_stationID         The expected station id (Default: any)
         * @param   p_protocolVersion   The expected protocol version (Default: current DEN protocol version)
         * @param   p_messageID         The expected message id (Default: DEN message id)
         */
        template ItsPduHeader mw_itsPduHeader(
            template (present) StationID p_stationID := ?,
            template (present) ItsPduHeader.protocolVersion p_protocolVersion := c_protocolVersionMapSpat,
            template (present) ItsPduHeader.messageID p_messageID := c_messageId
        ) := {
            protocolVersion := p_protocolVersion,
            messageID := p_messageID,
            stationID := p_stationID
        }
        
        /**
         * @desc    Default receive template for the station id
         */
        template (present) StationID mw_anyStationId := ?;
        
    } // end headerTemplates

    group mapSpatTemplates {
        
        /**
         * @desc    Receive template for MAP Message
         */
        template (present) MapData mw_anyMap := {
            msgID             := mapData_P,
            msgSubID          := *,  
            msgIssueRevision  := ?,
            layerType         := *,
            layerID           := *,
            intersections     := *,
            roadSegments      := *,
            dataParameters    := *,
            restrictionList   := *,
            regional          := *,
            crc               := *
        }
        
        /**
         * @desc    Receive template for SPAT Message
         */
        template (present) SpatData mw_anySpat := {
            msgID          := signalPhaseAndTimingMessage_P,
            msgSubID       := *,
            name           := *, 
            intersections  := ?,
            regional       := *
        }

    } // end mapSpatTemplates

} // end LibItsMapSpat_Templates
+21 −6
Original line number Diff line number Diff line
@@ -25,7 +25,12 @@ module LibItsMapSpat_TestSystem {
        /**
         * @desc Upper Tester port
         */
        type port UpperTesterPort message { out UtInitialize ; in UtInitializeResult }
        type port UpperTesterPort message {
            out 
                UtInitialize, UtMapSpatTrigger;
            in 
                UtInitializeResult, UtMapSpatTriggerResult, UtMapEventInd , UtSpatEventInd;
        } // end UpperTesterPort

    } // end portDefinitions

@@ -38,7 +43,6 @@ module LibItsMapSpat_TestSystem {
    
    } // End of group interfacePorts


	/**
	* @desc ITS System Adapter
	*/
@@ -61,6 +65,8 @@ module LibItsMapSpat_TestSystem {
        //component variables
        var MapInd vc_mapMsg;
		var SpatInd vc_spatMsg;
        var UtMapEventIndList vc_utMapEvents := {};
        var UtSpatEventIndList vc_utSpatEvents := {};
		
        //default
        var default vc_default := null;
@@ -75,14 +81,23 @@ module LibItsMapSpat_TestSystem {
		/**
		* @desc Appl MAP and SPAT Indication Primitive 
		*/
        type record MapInd { MAP msgIn }
		type record SpatInd { SPAT msgIn }
        type octetstring RawData;
        type record MapMsg {
            MAP		msg,
            RawData	rawData
        }
        type record SpatMsg {
            SPAT	msg,
            RawData	rawData
        }
        type record MapInd { MapMsg msgIn };
		type record SpatInd { SpatMsg msgIn };
                
        /**
        * @desc Appl MAP and SPAT Request Primitive 
        */
        type record MapReq { MAP msgOut }
        type record SpatReq { SPAT msgOut }
        type record MapReq { MAP msgOut };
        type record SpatReq { SPAT msgOut };
            
	} // end ApplPrimitives

+38 −0
Original line number Diff line number Diff line
@@ -19,4 +19,42 @@ module LibItsMapSpat_TypesAndValues {
        type UtChangePosition
    };
    
    group mapSpatConstants {
        
        const ItsPduHeader.protocolVersion c_protocolVersionMapSpat := 1;
        const ItsPduHeader.messageID c_messageId := 1;
        
    } // end group mapSpatConstants
    
    group utPrimitives {
        
        /**
         * @desc Upper Tester message to request triggering of an event at IUT 
         */
        type record UtMapSpatTrigger {
        }
        /**
         * @desc Upper Tester result message of request of triggering of an event at IUT 
         */
        type record UtMapSpatTriggerResult {
            boolean result
        }
        
        /**
         * @desc Upper Tester message to check event/status at IUT 
         */
        type record UtMapEventInd {
            MapData mapMsg
        }
        type record UtSpatEventInd {
            SpatData spatMsg
        }
        
        /**
         * @desc List of Upper Tester messages to check event/status on MAP SPAT IUT 
         */
        type record of UtMapEventInd UtMapEventIndList;
        type record of UtSpatEventInd UtSpatEventIndList;
    }

} // end LibItsMapSpat_TypesAndValues
 No newline at end of file