Skip to content
LibItsIvim_Templates.ttcn 30.9 KiB
Newer Older
garciay's avatar
garciay committed
 *  @author      ETSI / STF517
 *  @version     $URL$
 *               $Id$
 *  @desc        Module containing base template definitions for IVIM
 *  @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.
 *
 */
module LibItsIvim_Templates {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from IVIM_PDU_Descriptions language "ASN.1:1997" all;
    import from IVI language "ASN.1:1997" all;
    import from EfcDsrcApplication language "ASN.1:1997" all;
    import from AVIAEINumberingAndDataStructures language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_Pixits all;
    
    // LibItsIvim
    import from LibItsIvim_TestSystem all;
    import from LibItsIvim_TypesAndValues all;
    import from LibItsIvim_Functions all;
    
    group asn1Constants {
    } // End of group asn1Constants 
    
    group primitivesTemplates {
        
        /**
         * @desc    Send template for IVI Message (IvimPort Primitive)
         * @param   p_iviMsg    The IVI Message to be sent
         */
        template (value) IvimReq m_ivimReq(
                                           in template (value) IVIM p_iviMsg
        ) := {
            msgOut := p_iviMsg
        
        /**
         * @desc    Receive template for IVI Message (IvimPort Primitive)
         * @param   p_iviMsg    The expected IVI Message
         */
        template (present) IvimInd mw_ivimInd(
                                              template (present) IVIM p_iviMsg
        ) := {
            msgIn               := p_iviMsg,
            gnNextHeader        := *,
            gnHeaderType        := *,
            gnHeaderSubtype     := *,
            gnLifetime          := *,
            gnTrafficClass      := *,
            btpDestinationPort  := *,
            btpInfo             := *,
            ssp                 := *,
            its_aid             := *
        } // End of template mw_ivimInd

        /**
         * @desc    Receive template for IVI Message (IvimPort Primitive)
         * @param   p_iviMsg            The expected IVI 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 IvimInd mw_ivimIndWithGnParameters (
                                                     template (present) IVIM p_iviMsg,
                                                     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_ivimInd := { 
            gnNextHeader    := p_gnNextHeader,
            gnHeaderType    := p_gnHeaderType,
            gnHeaderSubtype := p_gnHeaderSubtype,
            gnLifetime      := p_gnLifetime,
            gnTrafficClass  := p_gnTrafficClass
        } // End of template mw_ivimIndWithGnParameters
        
        /**
         * @desc    Receive template for IVI Message (IvimPort Primitive)
         * @param   p_iviMsg                The expected IVI 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 IvimInd mw_ivimIndWithBtpParameters (
                                                      template (present) IVIM p_iviMsg,
garciay's avatar
garciay committed
                                                      template UInt16 p_btpDestinationPort := *,
                                                      template UInt16 p_btpInfo := *
        ) modifies mw_ivimInd := { 
            btpDestinationPort  := p_btpDestinationPort,
            btpInfo             := p_btpInfo
        } // End of template mw_ivimIndWithBtpParameters
        
        /**
         * @desc    Receive template for IVI Message (IvimPort Primitive)
         * @param   p_iviMsg    The expected IVI Message
         * @param   p_ssp       SSP security parameter
         * @param   p_its_aid   ITS-AID value
         */
        template IvimInd mw_ivimIndWithSecurityParameters (
                                                           template (present) IVIM p_iviMsg,
                                                           template Bit256 p_ssp := *,
        ) modifies mw_ivimInd := { 
            ssp             := p_ssp,
            its_aid         := p_its_aid
        } // End of template mw_ivimIndWithSecurityParameters
        
        group utPrimitives {
            
            /**
             * @desc    Send template for Upper Tester event initialization
             */
            template (value) UtInitialize m_ivimStructureInitialize := {
                hashedId8 := '0000000000000000'O
            } // End of template m_ivimStructureInitialize
            
            /**
             * @desc    Send template for Upper Tester Trigger event
garciay's avatar
garciay committed
             * @param   p_repetitionInterval        TODO (Default: 4 seconds)
             * @param   p_validFrom                 TODO (Default: omit)
             * @param   p_validTo                   TODO (Default: omit)
             * @param   p_connectedIviStructures    TODO (Default: omit)
             * @param   p_optional_                 TODO (Default: omit)
             */
            template (value) UtIvimTrigger m_utTriggerEvent(
garciay's avatar
garciay committed
                                                            template (omit) TimestampIts p_repetitionInterval := c_duration_4sec,
                                                            template (omit) TimestampIts p_validFrom := omit,
garciay's avatar
garciay committed
                                                            template (omit) TimestampIts p_validTo := omit/*,
                                                            template (omit) IVIManagementContainer.connectedIviStructures p_connectedIviStructures := omit,
garciay's avatar
garciay committed
                                                            template (omit) IviStructure.optional_ p_optional_ := omit*/
garciay's avatar
garciay committed
                validTo                 := p_validTo,
                repetitionInterval      := p_repetitionInterval/*,
                connectedIviStructures  := p_connectedIviStructures,
garciay's avatar
garciay committed
                optional_               := p_optional_*/
            } // End of template m_utTriggerEvent
            
            /**
             * @desc Send template for Upper Tester event update
             * @param   p_iviIdentificationNumber   The p_iviIVI identification number
             * @param   p_timeStamp                 TODO (Default: 2 seconds)
             * @param   p_validFrom                 TODO (Default: omit)
             * @param   p_validTo                   TODO (Default: omit)
             * @param   p_connectedIviStructures    TODO (Default: omit)
             * @param   p_optional_                 TODO (Default: omit)
             */
            template (value) UtIvimUpdate m_utUpdateEvent(
                                                          template (value) IviIdentificationNumber p_iviIdentificationNumber,
                                                          template (omit) TimestampIts p_timeStamp := c_duration_2sec,
                                                          template (omit) TimestampIts p_validFrom := omit,
                                                          template (omit) TimestampIts p_validTo := omit,
                                                          template (omit) IVIManagementContainer.connectedIviStructures p_connectedIviStructures := omit,
                                                          template (omit) IviStructure.optional_ p_optional_ := omit
            ) := {
                iviIdentificationNumber := p_iviIdentificationNumber,
                timeStamp               := p_timeStamp,
                validFrom               := p_validFrom,
                validTo                 := p_validTo,
                connectedIviStructures  := p_connectedIviStructures,
                optional_               := p_optional_
            } // End of template m_utUpdateEvent
            
            /**
             * @desc    Send template for Upper Tester event cancellation
             * @param   p_actionId  The action id
             */
            template (value) UtIvimTermination m_utEventCancellation(
                                                                     template (value) IviIdentificationNumber p_iviIdentificationNumber
            ) := {
                iviIdentificationNumber := p_iviIdentificationNumber
            } // End of template m_utEventCancellation
            
        } // End of group utPrimitives
      
    } // End of group primitivesTemplates
    
    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 IVI protocol version)
         * @param   p_messageID         The message Id (Default: IVI message id)
         */
        template (value) ItsPduHeader m_itsPduHeader(
                                                     template (value) StationID p_stationID := f_getTsStationId(),
                                                     template (value) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                                     template (value) ItsPduHeader.messageID p_messageID := ItsPduHeader_messageID_ivim_
        ) := {
            protocolVersion := p_protocolVersion,
            messageID       := p_messageID,
            stationID       := p_stationID
        } // End of template m_itsPduHeader
        
        /**
         * @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 IVI protocol version)
         * @param   p_messageID         The expected message id (Default: IVI 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 := ItsPduHeader_messageID_ivim_
        ) := {
            protocolVersion := p_protocolVersion,
            messageID       := p_messageID,
            stationID       := p_stationID
        } // End of template mw_itsPduHeader
        
        template (present) StationID mw_anyStationId := ?;
        
    } // End of group headerTemplates
    
    group ivimPduTemplates {
        
        /**
         * @desc    Send template for IVIM PDU
         * @param   p_ivim  The IVI Message
         */
        template (value) IVIM m_ivimStructurePdu(
                                                 template (value) IviStructure p_ivim
        ) := {
            header  := m_itsPduHeader,
            ivi     := p_ivim
        } // End of template m_ivimStructurePdu
        
        /**
         * @desc    Default receive template for IVIM PDU
         * @param   p_itsPduHeader  The expected ITS PDU header (Default: any)
         * @param   p_ivim          The expected IVI Message (Default: any)
         */
        template (present) IVIM mw_anyIvimPdu(
                                              template (present) ItsPduHeader p_itsPduHeader := ?,
                                              template (present) IviStructure p_ivim := ?
        ) := {
            header  := p_itsPduHeader,
            ivi     := p_ivim
        } // End of template mw_anyIvimPdu
        
        /**
         * @desc    Receive template for IVIM PDU
         * @param   p_ivim              The expected IVI Message 
         * @param   p_stationID         The expected station id (Default: any)
         * @param   p_protocolVersion   The expected protocol version (Default: current IVI protocol version)
         * @param   p_messageID         The expected message id (Default: IVI message id)
         */
        template (present) IVIM mw_ivimPdu(
                                           template (present) IviStructure p_ivim,
                                           template (present) StationID p_stationID := ?,
                                           template (present) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                           template (present) ItsPduHeader.messageID p_messageID := ItsPduHeader_messageID_ivim_
        ) := {
            header  := mw_itsPduHeader(p_stationID, p_protocolVersion, p_messageID),
            ivi     := p_ivim
        } // End of template mw_ivimPdu
        
    } // End of group ivimPduTemplates
    
    group iviStructureTemplates {
        
        /**
         * @desc    Send template for IVI Message
         * @param   p_mandatory    The Management Container
         * @param   p_optional_    A list of IVI Container (Default: omit)
         */
        template (omit) IviStructure m_ivimStructure(
                                                     in template (value) IVIManagementContainer p_mandatory,
                                                     in template (omit) IviStructure.optional_ p_optional_ := omit
        ) := {
            mandatory   := p_mandatory,
            optional_   := p_optional_
        } // End of template m_ivimStructure
        
        /**
         * @desc    Receive template for IVI Message
         * @param   p_mandatory    The Management Container
         * @param   p_optional_    A list of IVI Container (Default: omit)
         */
        template (present) IviStructure mw_ivimStructure(
                                                         template (present) IVIManagementContainer p_mandatory := ?,
                                                         template IviStructure.optional_ p_optional_ := *
        ) := {
            mandatory   := p_mandatory,
            optional_   := p_optional_
        } // End of template mw_ivimStructure
        
        /**
         * @desc    Send template for DEN Message for event termination.
         * @param   p_iviIdentificationNumber  The IVIM identification number
         */
        template (value) IviStructure m_ivimStructureCancellation(
                                                                  in template (value) IviIdentificationNumber p_iviIdentificationNumber
        ) := {
            mandatory   := m_iviManagementContainer(f_getProvider(), p_iviIdentificationNumber, IviStatus_cancellation_), 
            optional_   := omit
        } // End of template m_ivimStructureCancellation
        
    } // End of group iviStructureTemplates
    
    group iviManagementContainerGroup {
        
        /**
         * @desc Send template for IVIManagement container
         * @param p_serviceProviderId       The IUT provider description
         * @param p_iviIdentificationNumber The IVIM identification number
         * @param p_iviStatus               The IVIM status
         */
garciay's avatar
garciay committed
        template (omit) IVIManagementContainer m_iviManagementContainer(
                                                                        in template (value) Provider p_serviceProviderId, 
                                                                        in template (value) IviIdentificationNumber p_iviIdentificationNumber,
garciay's avatar
garciay committed
                                                                        in template (value) IviStatus p_iviStatus,
                                                                        in template (omit) IVIManagementContainer.connectedIviStructures p_connectedIviStructures := omit
        ) := {
            serviceProviderId       := p_serviceProviderId, 
            iviIdentificationNumber := p_iviIdentificationNumber,
garciay's avatar
garciay committed
            timeStamp               := f_getCurrentTime(),
garciay's avatar
garciay committed
            connectedIviStructures  := p_connectedIviStructures,
            iviStatus               := p_iviStatus
        } // End of template m_iviManagementContainer
        
        /**
         * @desc Receive template for IVIManagement container
         * @param p_serviceProviderId       The IUT provider description
         * @param p_iviIdentificationNumber The IVIM identification number
         * @param p_iviStatus               The IVIM status
         */
        template (present) IVIManagementContainer mw_iviManagementContainer(
                                                                            template (present) Provider p_serviceProviderId := ?, 
                                                                            template (present) IviIdentificationNumber p_iviIdentificationNumber := ?,
                                                                            template (present) IviStatus p_iviStatus := ?
        ) := {
            serviceProviderId       := p_serviceProviderId, 
            iviIdentificationNumber := p_iviIdentificationNumber,
            timeStamp               := *,
garciay's avatar
garciay committed
            validFrom               := *,
            validTo                 := *,
            connectedIviStructures  := *,
            iviStatus               := p_iviStatus
        } // End of template mw_iviManagementContainer
        
        /**
         * @desc Receive template for IVIManagement container
         * @param p_serviceProviderId       The IUT provider description
         * @param p_iviIdentificationNumber The IVIM identification number
         * @param p_iviStatus               The IVIM status
         * @param p_timeStamp               TODO
         */
garciay's avatar
garciay committed
        template (present) IVIManagementContainer mw_iviManagementContainer_timestamp(
                                                                                      template (present) Provider p_serviceProviderId := ?, 
                                                                                      template (present) IviIdentificationNumber p_iviIdentificationNumber := ?,
                                                                                      template (present) IviStatus p_iviStatus := ?,
                                                                                      template (present) TimestampIts p_timeStamp := ?
        ) modifies mw_iviManagementContainer := {
            timeStamp               := p_timeStamp
garciay's avatar
garciay committed
        } // End of template mw_iviManagementContainer_timestamp
        
        /**
         * @desc Receive template for IVIManagement container
         * @param p_serviceProviderId       The IUT provider description
         * @param p_iviIdentificationNumber The IVIM identification number
         * @param p_iviStatus               The IVIM status
         * @param p_validTo                 TODO
         */
        template (present) IVIManagementContainer mw_iviManagementContainer_validTo(
                                                                                    template (present) Provider p_serviceProviderId := ?, 
                                                                                    template (present) IviIdentificationNumber p_iviIdentificationNumber := ?,
                                                                                    template (present) IviStatus p_iviStatus := ?,
garciay's avatar
garciay committed
                                                                                    template (present) TimestampIts p_validTo := ?
        ) modifies mw_iviManagementContainer := {
            validTo                 := p_validTo
        } // End of template mw_iviManagementContainer_validTo
        
        /**
         * @desc Receive template for IVIManagement container
         * @param p_serviceProviderId       The IUT provider description
         * @param p_iviIdentificationNumber The IVIM identification number
         * @param p_iviStatus               The IVIM status
         * @param p_validFrom                 TODO
         */
        template (present) IVIManagementContainer mw_iviManagementContainer_validFrom(
                                                                                      template (present) Provider p_serviceProviderId := ?, 
                                                                                      template (present) IviIdentificationNumber p_iviIdentificationNumber := ?,
                                                                                      template (present) IviStatus p_iviStatus := ?,
garciay's avatar
garciay committed
                                                                                      template (present) TimestampIts p_validFrom := ?
        ) modifies mw_iviManagementContainer := {
            validFrom                 := p_validFrom
        } // End of template mw_iviManagementContainer_validFrom
        
        /**
         * @desc Receive template for Porvide identifier
         * @param p_countryCode         TODO
         * @param p_providerIdentifier  TODO
         */
        template (present) Provider mw_provider(
                                                template (present) CountryCode p_countryCode := ?,
                                                template (present) IssuerIdentifier p_providerIdentifier := ? 
        ) := {
            countryCode         := p_countryCode,
            providerIdentifier  := p_providerIdentifier
        } // End of template mw_provider
        
    } // End of group iviManagementContainerGroup
    
    group connectedIviStructuresGroup {
        
    } // End of group connectedIviStructuresGroup
    
    group iviContainerGroup {
        
        template (value) IviContainer m_iviContainer_geographicLocationContainer(
                                                                                 in template (value) GeographicLocationContainer p_glc
        ) := {
            glc := p_glc
        } // End of template m_iviContainer_geographicLocationContainer
        
        template (present) IviContainer mw_iviContainer_geographicLocationContainer(
                                                                                    template (present) GeographicLocationContainer p_glc := ?
        ) := {
            glc := p_glc
        } // End of template mw_iviContainer_geographicLocationContainer
        
        template (value) IviContainer m_iviContainer_generalIviContainer(
                                                                         in template (value) GeneralIviContainer p_giv
        ) := {
            giv := p_giv
        } // End of template m_iviContainer_generalIviContainer
        
        template (present) IviContainer mw_iviContainer_generalIviContainer(
                                                                            template (present) GeneralIviContainer p_giv := ?
        ) := {
            giv := p_giv
        } // End of template mw_iviContainer_generalIviContainer
        
        template (value) IviContainer m_iviContainer_roadConfigurationContainer(
                                                                                in template (value) RoadConfigurationContainer p_rcc
        ) := {
            rcc := p_rcc
        } // End of template m_iviContainer_roadConfigurationContainer
        
        template (present) IviContainer mw_iviContainer_roadConfigurationContainer(
                                                                                   template (present) RoadConfigurationContainer p_rcc := ?
        ) := {
            rcc := p_rcc
        } // End of template mw_iviContainer_roadConfigurationContainer
        
    } // End of group iviContainerGroup
    
    group geographicLocationContainerGroup {
        
        template (value) GeographicLocationContainer m_geographicLocationContainer(
                                                                                   in template (value) ReferencePosition p_referencePosition,
                                                                                   in template (value) GeographicLocationContainer.parts p_parts
        ) := {
            referencePosition           := p_referencePosition,
            referencePositionTime       := omit,
            referencePositionHeading    := omit, 
            referencePositionSpeed      := omit,
            parts                       := p_parts 
        } // End of template m_geographicLocationContainer
        
        template (present) GeographicLocationContainer mw_geographicLocationContainer(
                                                                                      template (present) ReferencePosition p_referencePosition := ?,
                                                                                      template (present) GeographicLocationContainer.parts p_parts := ?
        ) := {
            referencePosition           := p_referencePosition,
            referencePositionTime       := *,
            referencePositionHeading    := *, 
            referencePositionSpeed      := *,
            parts                       := p_parts 
        } // End of template mw_geographicLocationContainer
        
        template (omit) GlcPart m_glcPart(
                                          in template (value) Zid p_zoneId, 
                                          in template (omit) LanePosition p_laneNumber := omit,
                                          in template (omit) GlcPart.zoneExtension p_zoneExtension := omit,
                                          in template (omit) HeadingValue p_zoneHeading := omit,
                                          in template (omit) Zone p_zone := omit
        ) := {
            zoneId          := p_zoneId, 
            laneNumber      := p_laneNumber,
            zoneExtension   := p_zoneExtension,
            zoneHeading     := p_zoneHeading,
            zone            := p_zone
        } // End of template m_glcPart
        
        template (present) GlcPart mw_glcPart(
                                              template (present) Zid p_zoneId := ?, 
                                              template LanePosition p_laneNumber := *,
                                              template GlcPart.zoneExtension p_zoneExtension := *,
                                              template HeadingValue p_zoneHeading := *,
                                              template Zone p_zone := *
        ) := {
            zoneId          := p_zoneId, 
            laneNumber      := p_laneNumber,
            zoneExtension   := p_zoneExtension,
            zoneHeading     := p_zoneHeading,
            zone            := p_zone
        } // End of template mw_glcPart
        
    } // End of group geographicLocationContainerGroup
    
    group generalIviContainerGroup {
        
        template (value) GicPart m_gicPart_basic(
                                                 in template (value) IviType p_iviType,
                                                 in template (value) GicPart.roadSignCodes p_roadSignCodes
        ) := {
            detectionZoneIds        := omit, 
            its_Rrid                := omit,
            relevanceZoneIds        := omit, 
            direction               := omit,
            driverAwarenessZoneIds  := omit, 
            minimumAwarenessTime    := omit,
            applicableLanes         := omit,
            iviType                 := p_iviType,
            iviPurpose              := omit,
            laneStatus              := omit,
            vehicleCharacteristics  := omit,
            driverCharacteristics   := omit,
            layoutId                := omit,
            preStoredlayoutId       := omit,
            roadSignCodes           := p_roadSignCodes,
            extraText               := omit
        } // End of template m_gicPart
        
        template (present) GicPart mw_gicPart_basic(
                                                    template (present) IviType p_iviType := ?,
                                                    template (present) GicPart.roadSignCodes p_roadSignCodes := ?
        ) := {
            detectionZoneIds        := *, 
            its_Rrid                := *,
            relevanceZoneIds        := *, 
            direction               := *,
            driverAwarenessZoneIds  := *, 
            minimumAwarenessTime    := *,
            applicableLanes         := *,
            iviType                 := p_iviType,
            iviPurpose              := *,
            laneStatus              := *,
            vehicleCharacteristics  := *,
            driverCharacteristics   := *,
            layoutId                := *,
            preStoredlayoutId       := *,
            roadSignCodes           := p_roadSignCodes,
            extraText               := *
        } // End of template mw_gicPart
        
    } // End of group generalIviContainerGroup
    
    group roadConfigurationContainerGroup {
        
        template (value) RccPart m_rccPart(
                                           in template (value) RccPart.zoneIds p_zoneIds, 
                                           in template (value) RoadType p_roadType,
                                           in template (value) RccPart.laneConfiguration p_laneConfiguration
        ) := {
            zoneIds             := p_zoneIds, 
            roadType            := p_roadType,
            laneConfiguration   := p_laneConfiguration
        } // End of template m_rccPart
        
        template (present) RccPart mw_rccPart(
                                              template (present) RccPart.zoneIds p_zoneIds := ?, 
                                              template (present) RoadType p_roadType := ?,
                                              template (present) RccPart.laneConfiguration p_laneConfiguration := ?
        ) := {
            zoneIds              := p_zoneIds, 
            roadType             := p_roadType,
              laneConfiguration    := p_laneConfiguration
        } // End of template mw_rccPart
        
    } // End of group roadConfigurationContainerGroup
    
} // End of module LibItsIvimTemplates