LibItsSremSsem_Templates.ttcn 26.5 KB
Newer Older
garciay's avatar
garciay committed
/**
garciay's avatar
garciay committed
 *    @author   ETSI / STF517
garciay's avatar
garciay committed
 *    @version  $URL$
 *              $Id$
 *    @desc     Module containing base template definitions for SREM SSEM
garciay's avatar
garciay committed
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
garciay's avatar
garciay committed
 *
 */
module LibItsSremSsem_Templates {

    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from SREM_PDU_Descriptions language "ASN.1:1997" all;
    import from SSEM_PDU_Descriptions language "ASN.1:1997" all;
    import from DSRC language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
garciay's avatar
garciay committed
    import from LibItsCommon_Functions all;
    import from LibItsCommon_ASN1_NamedNumbers all;
garciay's avatar
garciay committed
    
    // LibItsSremSsem
    import from LibItsSremSsem_TestSystem all;
    import from LibItsSremSsem_TypesAndValues all;
    import from LibItsSremSsem_Pixits all;

    group primitivesTemplates {
        
        /**
         * @desc    Send template for SREM Message (SremSsemPort Primitive)
         * @param   p_sremMsg    The SREM Message to be sent
         */
        template (value) SremReq m_sremReq(
                                            in template (value) SREM p_sremMsg
        ) := {
            msgOut := p_sremMsg
        }
        
        /**
         * @desc    Receive template for SREM Message (SremSsemPort Primitive)
         * @param   p_sremMsg    The expected SREM Message
         */
        template (present) SremInd mw_sremInd(
                                              template (present) SREM p_sremMsg
garciay's avatar
garciay committed
        ) := {
            msgIn := p_sremMsg,
            gnNextHeader        := *,
            gnHeaderType        := *,
            gnHeaderSubtype     := *,
            gnLifetime          := *,
            gnTrafficClass      := *,
            btpDestinationPort  := *,
            btpInfo             := *,
            ssp                 := *,
            its_aid             := * 
        }
        
        /**
         * @desc    Receive template for SREM Message (SremSsemPort Primitive)
         * @param   p_sremMsg          The expected SREM Message
         * @param   p_gnNextHeader      GN next header value
         * @param   p_gnHeaderType      GN header type value
         * @param   p_gnHeaderSubtype   GN header subtype value
         * @param   p_gnLifetime        GN packet lifetime value (ms)
         * @param   p_gnTrafficClass    GN traffic class value
         */
        template (present) SremInd mw_sremIndWithGnParameters(
                                                               template (present) SREM p_sremMsg,
                                                               in template UInt8 p_gnNextHeader := *,
                                                               in template UInt8 p_gnHeaderType := *,
                                                               in template UInt8 p_gnHeaderSubtype := *,
                                                               in template UInt32 p_gnLifetime := *,
                                                               in template UInt8 p_gnTrafficClass := *
        ) modifies mw_sremInd := { 
            gnNextHeader    := p_gnNextHeader,
            gnHeaderType    := p_gnHeaderType,
            gnHeaderSubtype := p_gnHeaderSubtype,
            gnLifetime      := p_gnLifetime,
            gnTrafficClass  := p_gnTrafficClass
        }
        
        /**
         * @desc    Receive template for SREM Message (SremSsemPort Primitive)
         * @param   p_sremMsg              Expected SREM Message
         * @param   p_btpDestinationPort    BTP destination port value
         * @param   p_btpInfo               BTP destination port info value (if BTP-B) or BTP source port value (if BTP-A)
         */
        template SremInd mw_sremIndWithBtpParameters(
                                                      template (present) SREM p_sremMsg,
                                                      in template UInt16 p_btpDestinationPort := *,
                                                      in template UInt16 p_btpInfo := *
        ) modifies mw_sremInd := { 
            btpDestinationPort  := p_btpDestinationPort,
            btpInfo             := p_btpInfo
        };
        
        /**
         * @desc    Receive template for SREM Message (SremSsemPort Primitive)
         * @param   p_sremMsg  The expected SREM Message
         * @param   p_ssp       SSP value
         * @param   p_its_aid   ITS-AID value
         */
        template (present) SremInd mw_sremIndWithSecurityParameters(
                                                                     template (present) SREM p_sremMsg,
                                                                     template Bit256 p_ssp := *,
garciay's avatar
garciay committed
        ) modifies mw_sremInd := { 
            ssp     := p_ssp,
            its_aid := p_its_aid
        }
        
        /**
         * @desc    Send template for SSEM Message (SremSsemPort Primitive)
         * @param   p_ssemMsg    The SSEM Message to be sent
         */
        template (value) SsemReq m_ssemReq(
                                           in template (value) SSEM p_ssemMsg
garciay's avatar
garciay committed
        ) := {
            msgOut := p_ssemMsg
        }
        
        /**
         * @desc    Receive template for SSEM Message (SremSsemPort Primitive)
         * @param   p_ssemMsg    The expected SSEM Message
         */
        template (present) SsemInd mw_ssemInd(
                                              template (present) SSEM p_ssemMsg
        ) := {
            msgIn               := p_ssemMsg,
            gnNextHeader        := *,
            gnHeaderType        := *,
            gnHeaderSubtype     := *,
            gnLifetime          := *,
            gnTrafficClass      := *,
            btpDestinationPort  := *,
            btpInfo             := *,
            its_aid             := * 
        };

        /**
         * @desc    Receive template for SSEM Message (SremSsemPort Primitive)
         * @param   p_ssemMsg         The expected SSEM Message
         * @param   p_gnNextHeader      GN next header value
         * @param   p_gnHeaderType      GN header type value
         * @param   p_gnHeaderSubtype   GN header subtype value
         * @param   p_gnLifetime        GN packet lifetime value (ms)
         * @param   p_gnTrafficClass    GN traffic class value
         */
        template (present) SsemInd mw_ssemIndWithGnParameters(
                                                              template (present) SSEM p_ssemMsg,
                                                              in template UInt8 p_gnNextHeader := *,
                                                              in template UInt8 p_gnHeaderType := *,
                                                              in template UInt8 p_gnHeaderSubtype := *,
                                                              in template UInt32 p_gnLifetime := *,
                                                              in template UInt8 p_gnTrafficClass := *
        ) modifies mw_ssemInd := { 
            gnNextHeader    := p_gnNextHeader,
            gnHeaderType    := p_gnHeaderType,
            gnHeaderSubtype := p_gnHeaderSubtype,
            gnLifetime      := p_gnLifetime,
            gnTrafficClass  := p_gnTrafficClass
        }
        
        /**
         * @desc    Receive template for SSEM Message (SremSsemPort Primitive)
         * @param   p_ssemMsg             Expected SREM Message
         * @param   p_btpDestinationPort    BTP destination port value
         * @param   p_btpInfo               BTP destination port info value (if BTP-B) or BTP source port value (if BTP-A)
         */
        template SsemInd mw_ssemIndWithBtpParameters(
                                                     template (present) SSEM p_ssemMsg,
                                                     template UInt16 p_btpDestinationPort := *,
                                                     template UInt16 p_btpInfo := *
        ) modifies mw_ssemInd := { 
            btpDestinationPort  := p_btpDestinationPort,
            btpInfo             := p_btpInfo
        };

        /**
         * @desc    Receive template for SSEM Message (SremSsemPort Primitive)
         * @param   p_ssemMsg  The expected SSEM Message
         * @param   p_ssp        SSP value
         * @param   p_its_aid    ITS-AID value
         */
        template (present) SsemInd mw_ssemIndWithSecurityParameters(
garciay's avatar
garciay committed
                                                                    template (present) SSEM p_ssemMsg,
                                                                    template Bit256 p_ssp := *,
garciay's avatar
garciay committed
                                                                    template UInt32 p_its_aid := *
garciay's avatar
garciay committed
        ) modifies mw_ssemInd := { 
            ssp     := p_ssp,
            its_aid := p_its_aid
        }
        
    }

    group utPrimitives {
            
        /**
         * @desc    Send template for Upper Tester event initialization
         * @member hashedId8 In case of secured mode set, hashedId8 indicate which certificate the IUT shall use
        */
        template (value) UtInitialize m_sremSsemInitialize := {
            hashedId8 := '0000000000000000'O
        }

        /**
        * @desc    Send template for Upper Tester Trigger event
        */
        template (value) UtSremTrigger m_utTriggerEvent( 
                                                        in template (value) BasicVehicleRole p_basicVehicleRole,
                                                        in template (value) RequestImportanceLevel p_requestImportanceLevel 
        ) := {
            basicVehicleRole        := p_basicVehicleRole,
            requestImportanceLevel  := p_requestImportanceLevel
        }
        
        template (value) UtSremUpdate m_utUpdateEvent(
                                                      in template (value) RequestID p_requestID,
                                                      in template (value) BasicVehicleRole p_basicVehicleRole,
                                                      in template (value) RequestImportanceLevel p_requestImportanceLevel
        ) := {
            requestID               := p_requestID,
            basicVehicleRole        := p_basicVehicleRole,
            requestImportanceLevel  := p_requestImportanceLevel
garciay's avatar
garciay committed
    group sremSsemPduTemplates {
garciay's avatar
garciay committed
        
        /**
         * @desc    Send template for SREM PDU
         * @param   p_map  The SREM Message
         */
        template (value) SREM m_sremPdu(
                                          in template (value) SignalRequestMessage p_srm
        ) := {
            header  := m_itsPduHeader( - , - ,ItsPduHeader_messageID_srem_ ),
            srm    := p_srm
        }
        
        /**
         * @desc    Receive template for SREM PDU
         * @param   p_map  The SREM Message
         */
        template (present) SREM mw_sremPdu(
                                            template (present) SignalRequestMessage p_srm := ?
        ) := {
            header  := mw_itsPduHeaderSrem,
            srm     := p_srm
        }
        
        /**
         * @desc    Send template for SSEM PDU
         * @param   p_spat  The SSEM Message
         */
        template (value) SSEM m_ssemPdu(
                                        in template (value) SignalStatusMessage p_ssm
        ) := {
            header  := m_itsPduHeader( - , - , ItsPduHeader_messageID_ssem_),
            ssm     := p_ssm
        }
        
        /**
         * @desc    Receive template for SSEM PDU
         * @param   p_spat  The SSEM Message
         */
        template (present) SSEM mw_ssemPdu(
                                           template (present) SignalStatusMessage p_ssm := ?
        ) := {
            header  := mw_itsPduHeaderSsem,
            ssm     := p_ssm
        }
        
garciay's avatar
garciay committed
    } // End of group sremSsemPduTemplates
garciay's avatar
garciay committed
    
    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 SREM SSEM protocol version)
         * @param   p_messageID         The message Id (Default: SREM SSEM id)
         */
        template (value) ItsPduHeader m_itsPduHeader(
                                                     in template (value) StationID p_stationID := f_getTsStationId(),
                                                     in template (value) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                                     in template (value) ItsPduHeader.messageID p_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 SREM SSEM protocol version)
         * @param   p_messageID         The expected message id (Default: SREM SSEM message id)
         */
        template ItsPduHeader mw_itsPduHeader(
                                              template (present) StationID p_stationID := ?,
                                              template (present) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                              template (present) ItsPduHeader.messageID p_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 SREM SSEM protocol version)
         * @param   p_messageID         The expected message id (Default: SREM id)
         */
        template ItsPduHeader mw_itsPduHeaderSrem(
                                                   template (present) StationID p_stationID := ?,
                                                   template (present) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                                   template (present) ItsPduHeader.messageID p_messageID := ItsPduHeader_messageID_srem_
        ) := {
            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 SREM SSEM protocol version)
         * @param   p_messageID         The expected message id (Default: SSEM id)
         */
        template ItsPduHeader mw_itsPduHeaderSsem(
                                                    template (present) StationID p_stationID := ?,
                                                    template (present) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                                    template (present) ItsPduHeader.messageID p_messageID := ItsPduHeader_messageID_ssem_
        ) := {
            protocolVersion := p_protocolVersion,
            messageID       := p_messageID,
            stationID       := p_stationID
        }
        
        /**
         * @desc    Default receive template for the station id
         */
        template (present) StationID mw_anyStationId := ?;
        
    } // End of group headerTemplates

    group sremSsemTemplates {
        
garciay's avatar
garciay committed
        template (omit) IntersectionReferenceID m_intersectionReferenceID(
                                                                          in template (value) IntersectionID p_intersectionID := 0,
                                                                          in template (omit) RoadRegulatorID p_roadRegulatorID := omit
        ) := {
            region  := p_roadRegulatorID,   // a globally unique regional assignment value typical assigned to a regional DOT authority the value zero shall be used for testing needs
            id      := p_intersectionID     // a unique mapping to the intersection in question within the above region of use
        }
        
garciay's avatar
garciay committed
        group sremTemplates {
            
garciay's avatar
garciay committed
            group sremTemplatesSend {
                
                /**
                 * @desc    Send template for SREM Message
                 */
                template (value) SignalRequestMessage m_defaultSrem := {
                    timeStamp       := omit,
                    second          := PX_SECOND,
                    sequenceNumber  := omit,
                    requests        := { 
                        m_signalRequestPackage(
                            m_signalRequest(
                                m_intersectionReferenceID,
                                1,
garciay's avatar
garciay committed
                                priorityRequestTypeReserved,
garciay's avatar
garciay committed
                                { lane := 1 }
                    )) },
                    requestor       := m_requestorDescription(m_vehicleID(f_getIutStationId())),
                    regional        := omit
                }
                
                template (value) SignalRequestPackage m_signalRequestPackage(
                                                                            in template (value) SignalRequest p_request
                ) := {
                    request     := p_request,
                    minute      := omit,
                    second      := omit,
garciay's avatar
garciay committed
                    duration    := omit,
garciay's avatar
garciay committed
                    regional    := omit
                }
                
                template (omit) SignalRequest m_signalRequest(
                                                               in template (value) IntersectionReferenceID p_id,
                                                               in template (value) RequestID p_requestID,
                                                               in template (value) PriorityRequestType p_requestType,
                                                               in template (value) IntersectionAccessPoint p_inBoundLane,
                                                               in template (omit) IntersectionAccessPoint p_outBoundLane := omit
                ) := {
                    id              := p_id,
                    requestID       := p_requestID,
                    requestType     := p_requestType,
                    inBoundLane     := p_inBoundLane,
                    outBoundLane    := p_outBoundLane,
                    regional        := omit
                }
                
                template (omit) RequestorDescription m_requestorDescription(
                                                                            in template (value) VehicleID p_id,
                                                                            in template (omit) RequestorType p_type := omit,
                                                                            in template (omit) RequestorPositionVector p_position := omit,
                                                                            in template (omit) TransitVehicleStatus p_transitStatus := omit,
                                                                            in template (omit) TransitVehicleOccupancy p_transitOccupancy := omit
                ) := {
                    id                  := p_id,                // The ID used in the BSM or CAM of the requestor
                    type_               := p_type,              // Information regarding all type and class data about the requesting vehicle 
                    position            := p_position,          // The location of the requesting vehicle
                    name                := omit,                // A human readable name for debugging use
                    routeName           := omit,                // A string for transit operations use
                    transitStatus       := p_transitStatus,     // current vehicle state (loading, etc.)
                    transitOccupancy    := p_transitOccupancy,  // current vehicle occupancy 
                    transitSchedule     := omit,                // current vehicle schedule adherence 
                    regional            := omit
                }
                
                template (value) VehicleID m_vehicleID(
                                                       in template (value) StationID p_stationID
                ) := {
                    stationID   := p_stationID
                }
                
                template (omit) RequestorType m_requestorType(
                                                              in template (value) BasicVehicleRole p_role,
                                                              in template (omit) RequestSubRole p_subrole := omit,
                                                              in template (omit) RequestImportanceLevel p_request := omit
                ) := {
                    role        := p_role,      // Basic role of this user at this time
                    subrole     := p_subrole,   // A local list with role based items 
                    request     := p_request,   // A local list with request items 
                    iso3883     := omit,
                    hpmsType    := omit,        // HPMS classification types
                    regional    := omit
                }
                
            } // End of  group sremTemplatesSend
garciay's avatar
garciay committed
            group sremTemplatesRecv {
                
                /**
                 * @desc    Receive template for SREM Message
                 */
                template (present) SignalRequestMessage mw_defaultSrem := {
                    timeStamp       := *,
                    second          := ?,
                    sequenceNumber  := *,
                    requests        := *,
                    requestor       := ?,
                    regional        := *
                }
                
                /**
                 * @desc    Receive template for SREM Message with no LayerType
                 */
                template (present) SignalRequestMessage mw_sremWellFormatted modifies mw_defaultSrem := {
                }
                
                template (present) SignalRequestMessage mw_srem_sequenceNumber(
                                                                               in MsgCount p_sequenceNumber
                ) 
                modifies mw_sremWellFormatted := {
                    sequenceNumber := p_sequenceNumber
                }
                
            } // End of  group sremTemplatesRecv
garciay's avatar
garciay committed
        } // End of group sremTemplates 
        
        group ssemTemplates {
            
            /**
             * @desc    Send template for SignalStatusMessage Message
             */
            template (value) SignalStatusMessage m_defaultSsem := {
                timeStamp       := omit,
                second          := PX_SECOND,
                sequenceNumber  := omit,
garciay's avatar
garciay committed
                status          := { m_signalStatus(PX_STATUS) },
                regional        := omit
            }
            
            /**
             * @desc    Send template for SignalStatusMessage Message
             */
            template (value) SignalStatusMessage m_ssem(
                                                        in SignalRequestMessage p_signalRequestMessage
            ) modifies m_defaultSsem := {
                second      := p_signalRequestMessage.second,
garciay's avatar
garciay committed
                status      := { m_signalStatus(p_signalRequestMessage.requests[0].request.id) },
                regional    := omit
            }
            
            
            template (value) SignalStatus m_signalStatus(
garciay's avatar
garciay committed
                                                         in IntersectionReferenceID p_id
            ) := {
                sequenceNumber  := 1, // FIXME To be reviewed
garciay's avatar
garciay committed
                id              := p_id,
                sigStatus       := { m_signalStatusPackage },
                regional        := omit
            }
            
            template (value) SignalStatusPackage m_signalStatusPackage 
            := {
                requester   := omit,
                inboundOn   := {
                    approach := 0
                },
                outboundOn  := omit,
                minute      := omit,
                second      := omit,
                duration    := omit,
                status      := processing,
                regional    := omit
garciay's avatar
garciay committed
            }
            
            /**
             * @desc    Receive template for SSEM Message
             */
garciay's avatar
garciay committed
            template (present) SignalStatusMessage mw_defaultSsem(
                                                                  template MsgCount p_sequenceNumber := *
            ) := {
garciay's avatar
garciay committed
                timeStamp       := *,
                second          := ?,
garciay's avatar
garciay committed
                sequenceNumber  := p_sequenceNumber,
garciay's avatar
garciay committed
                status          := ?,
                regional       := *
            }
            
garciay's avatar
garciay committed
            template (present) SignalStatusMessage mw_ssemWellFormatted(
                                                                        template MsgCount p_sequenceNumber := *
            ) modifies mw_defaultSsem := {
garciay's avatar
garciay committed
            }
            
            template (present) SignalStatusMessage mw_ssem_with_region_id(
garciay's avatar
garciay committed
                                                                          template MsgCount p_sequenceNumber := *,
                                                                          template (present) SignalStatusMessage.regional p_regional := ?
garciay's avatar
garciay committed
            ) modifies mw_defaultSsem := {
garciay's avatar
garciay committed
                regional       := p_regional 
garciay's avatar
garciay committed
            }
            
        } // End of group ssemTemplates
        
    } // End of group sremSsemTemplates

} // End of module LibItsSremSsem_Templates