LibItsMapemSpatem_Templates.ttcn 19.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
/**
 *    @author   ETSI / STF484
 *    @version  $URL$
 *              $Id$
 *    @desc     Module containing base template definitions for MAPEM SPATEM
 *
 */
module LibItsMapemSpatem_Templates {

    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from MAPEM_PDU_Descriptions language "ASN.1:1997" all;
    import from SPATEM_PDU_Descriptions language "ASN.1:1997" all;
    import from DSRC language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_Functions all;
    import from LibItsCommon_TypesAndValues all;
    
    // LibItsMapemSpatem
    import from LibItsMapemSpatem_TestSystem all;
    import from LibItsMapemSpatem_TypesAndValues all;
    import from LibItsMapemSpatem_Pixits all;

    group primitivesTemplates {
        
        /**
         * @desc    Send template for MAPEM Message (MapemSpatemPort Primitive)
         * @param   p_mapemMsg    The MAPEM Message to be sent
         */
        template (value) MapemReq m_mapemReq(
                                             in template (value) MAPEM p_mapemMsg
        ) := {
            msgOut := p_mapemMsg
        }
        
        /**
         * @desc    Receive template for MAPEM Message (MapemSpatemPort Primitive)
         * @param   p_mapemMsg    The expected MAPEM Message
         */
        template (present) MapemInd mw_mapemInd(
                                                template (present) MAPEM p_mapemMsg
        ) := {
            msgIn := p_mapemMsg,
            gnNextHeader := *,
            gnHeaderType := *,
            gnHeaderSubtype := *,
            gnLifetime := *,
            gnTrafficClass := *,
            btpDestinationPort := *,
            btpInfo := *,
            ssp := *,
            its_aid := * 
        }
        
        /**
         * @desc    Receive template for MAPEM Message (MapemSpatemPort Primitive)
         * @param   p_mapemMsg          The expected MAPEM 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) MapemInd mw_mapemIndWithGnParameters(
                                                                template (present) MAPEM p_mapemMsg,
                                                                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_mapemInd := { 
            gnNextHeader := p_gnNextHeader,
            gnHeaderType := p_gnHeaderType,
            gnHeaderSubtype := p_gnHeaderSubtype,
            gnLifetime := p_gnLifetime,
            gnTrafficClass := p_gnTrafficClass
        }
        
        /**
         * @desc    Receive template for MAPEM Message (MapemSpatemPort Primitive)
         * @param   p_mapemMsg              Expected MAPEM 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 MapemInd mw_mapemIndWithBtpParameters(
                                                       template (present) MAPEM p_mapemMsg,
                                                       in template UInt16 p_btpDestinationPort := *,
                                                       in template UInt16 p_btpInfo := *
        ) modifies mw_mapemInd := { 
            btpDestinationPort := p_btpDestinationPort,
            btpInfo := p_btpInfo     
        };
        
        /**
         * @desc    Receive template for MAPEM Message (MapemSpatemPort Primitive)
         * @param   p_mapemMsg  The expected MAPEM Message
         * @param   p_ssp       SSP value
         * @param   p_its_aid   ITS-AID value
         */
        template (present) MapemInd mw_mapemIndWithSecurityParameters(
                                                                      template (present) MAPEM p_mapemMsg,
                                                                      template Oct16 p_ssp := *,
                                                                      template Oct16 p_its_aid := *
        ) modifies mw_mapemInd := { 
            ssp     := p_ssp,
            its_aid := p_its_aid
        }
        
        /**
         * @desc    Send template for SPATEM Message (MapemSpatemPort Primitive)
         * @param   p_spatemMsg    The SPATEM Message to be sent
         */
        template (value) SpatemReq m_spatemReq(
                                               in template (value) SPATEM p_spatemMsg
        ) := {
            msgOut := p_spatemMsg
        }
        
        /**
         * @desc    Receive template for SPATEM Message (MapemSpatemPort Primitive)
         * @param   p_spatemMsg    The expected SPATEM Message
         */
        template (present) SpatemInd mw_spatemInd(
                                                  template (present) SPATEM p_spatemMsg
        ) := {
            msgIn := p_spatemMsg,
            gnNextHeader := *,
            gnHeaderType := *,
            gnHeaderSubtype := *,
            gnLifetime := *,
            gnTrafficClass := *,
            btpDestinationPort := *,
            btpInfo := *,
            its_aid := * 
        };

        /**
         * @desc    Receive template for SPATEM Message (MapemSpatemPort Primitive)
         * @param   p_spatemMsg         The expected SPATEM 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) SpatemInd mw_spatemIndWithGnParameters(
                                                                  template (present) SPATEM p_spatemMsg,
                                                                  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_spatemInd := { 
            gnNextHeader := p_gnNextHeader,
            gnHeaderType := p_gnHeaderType,
            gnHeaderSubtype := p_gnHeaderSubtype,
            gnLifetime := p_gnLifetime,
            gnTrafficClass := p_gnTrafficClass
        }
        
        /**
         * @desc    Receive template for SPATEM Message (MapemSpatemPort Primitive)
         * @param   p_spatemMsg             Expected MAPEM 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 SpatemInd mw_spatemIndWithBtpParameters(
                                                         template (present) SPATEM p_spatemMsg,
                                                         template UInt16 p_btpDestinationPort := *,
                                                         template UInt16 p_btpInfo := *
        ) modifies mw_spatemInd := { 
            btpDestinationPort := p_btpDestinationPort,
            btpInfo := p_btpInfo     
        };

        /**
         * @desc    Receive template for SPATEM Message (MapemSpatemPort Primitive)
         * @param   p_spatemMsg  The expected SPATEM Message
         * @param   p_ssp        SSP value
         * @param   p_its_aid    ITS-AID value
         */
        template (present) SpatemInd mw_spatemIndWithSecurityParameters(
                                                                        template (present) SPATEM p_mapemMsg,
                                                                        template Oct16 p_ssp := *,
                                                                        template Oct16 p_its_aid := *
        ) modifies mw_spatemInd := { 
            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_mapemSpatemInitialize := {
            hashedId8 := '0000000000000000'O
        }

        /**
        * @desc    Send template for Upper Tester Trigger event
        */
            template (value) UtMapemSpatemTrigger m_utTriggerEvent ( Event p_event ) := {
                event    := p_event
        }
    }

    group mapSpatPduTemplates {
        
        /**
         * @desc    Send template for MAPEM PDU
         * @param   p_map  The MAPEM Message
         */
        template (value) MAPEM m_mapemPdu(
                                          in template (value) MapData p_map
        ) := {
            header := m_itsPduHeader( - , - ,ItsPduHeader_messageID_mapem_ ),
            map_ := p_map
        }
        
        /**
         * @desc    Receive template for MAPEM PDU
         * @param   p_map  The MAPEM Message
         */
        template (present) MAPEM mw_mapemPdu(
                                             template (present) MapData p_map := ?
        ) := {
            header := mw_itsPduHeaderMapem,
            map_ := p_map
        }
        
        /**
         * @desc    Send template for SPATEM PDU
         * @param   p_spat  The SPATEM Message
         */
        template (value) SPATEM m_spatemPdu(
                                            in template (value) SPAT p_spat
        ) := {
            header := m_itsPduHeader( - , - , ItsPduHeader_messageID_spatem_ ),
            spat := p_spat
        }
        
        /**
         * @desc    Receive template for SPATEM PDU
         * @param   p_spat  The SPATEM Message
         */
        template (present) SPATEM mw_spatemPdu(
                                               template (present) SPAT p_spat := ?
        ) := {
            header := mw_itsPduHeaderSpatem,
            spat := p_spat
        }
        
    } // End of group 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 MAPEM SPATEM protocol version)
         * @param   p_messageID         The message Id (Default: MAp SPATEM message 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 MAPEM SPATEM protocol version)
         * @param   p_messageID         The expected message id (Default: MAPEM  SPATmessage 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 MAPEM SPATEM protocol version)
         * @param   p_messageID         The expected message id (Default: MAPEM message id)
         */
        template ItsPduHeader mw_itsPduHeaderMapem(
                                                   template (present) StationID p_stationID := ?,
                                                   template (present) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                                   template (present) ItsPduHeader.messageID p_messageID := ItsPduHeader_messageID_mapem_
        ) := {
            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 MAPEM SPATEM protocol version)
         * @param   p_messageID         The expected message id (Default: SPATEM message id)
         */
        template ItsPduHeader mw_itsPduHeaderSpatem(
                                                    template (present) StationID p_stationID := ?,
                                                    template (present) ItsPduHeader.protocolVersion p_protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                                                    template (present) ItsPduHeader.messageID p_messageID := ItsPduHeader_messageID_spatem_
        ) := {
            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 mapemSpatemTemplates {
        
        group mapemTemplates {
            
            /**
             * @desc    Send template for MAPEM Message
             */
            template (value) MapData m_defaultMapem := {
                timeStamp         := omit,
                msgIssueRevision  := PX_MSG_ISSUE_REVISION,
                layerType         := omit,
                layerID           := omit,
                intersections     := omit,
                roadSegments      := omit,
                dataParameters    := omit,
                restrictionList   := omit,
                regional          := omit
            }
            
            /**
             * @desc    Receive template for MAPEM Message
             */
            template (present) MapData mw_defaultMapem := {
                timeStamp         := *,
                msgIssueRevision  := ?,
                layerType         := *,
                layerID           := *,
                intersections     := *,
                roadSegments      := *,
                dataParameters    := *,
                restrictionList   := *,
                regional          := *
            }
            
            /**
             * @desc    Receive template for MAPEM Message with no LayerType
             */
            template (present) MapData mw_mapemWellFormatted modifies mw_defaultMapem := {
                layerType         := omit,
                layerID           := omit
            }
            
            /**
             * @desc    Receive template for MAPEM Message with no LayerType
             */
            template (present) MapData mw_mapemNoLayerType modifies mw_mapemWellFormatted := {
                layerType         := omit,
                layerID           := omit
            }
            
        } // End of group mapemTemplates 
        
        group spatemTemplates {
            
            /**
             * @desc    Send template for SPAT Message
             */
            template (value) SPAT m_spat := {
                timeStamp      := omit,
                name           := omit, 
                intersections  := m_intersections,
                regional       := omit
            }
            
            template (value) IntersectionStateList m_intersections := { m_intersection };
            
            template (value) IntersectionState m_intersection := {
                name                := omit,
                id                  := m_intersectionReferenceID,
                revision            := PX_INTERSECTIONSTATE_REVISION,
                status              := PX_STATUS,
                moy                 := omit,
                timeStamp           := omit,
                enabledLanes        := omit,
                states              := m_movements,
                maneuverAssistList  := omit,
                regional            := omit
            }
            
            template (value) IntersectionReferenceID m_intersectionReferenceID := {
                region               := omit,
                id                    := PX_INTERSECTION_ID
            }
            
            template (value) MovementList m_movements := { m_movement };
            
            template (value) MovementState m_movement := {
                movementName           := omit,
                signalGroup            := PX_SIGNAL_GROUP_ID,    
                state_time_speed       := m_movementEventList,
                maneuverAssistList     := omit,
                regional               := omit
            }
            
            template (value) MovementEventList m_movementEventList := { m_movementEvent };
            
            template (value) MovementEvent m_movementEvent := {
                eventState      := stop_Then_Proceed,
                timing          := omit,
                speeds          := omit,
                regional        := omit 
            }
            
            /**
             * @desc    Receive template for SPATEM Message
             */
            template (present) SPAT mw_defaultSpatem := {
                timeStamp      := *,
                name           := *, 
                intersections  := ?,
                regional       := *
            }
            
            template (present) SPAT mw_spatemWellFormatted 
            modifies mw_defaultSpatem := {
            }
            
            template (present) SPAT mw_spatem_with_region_id(
                                                             template (present) SPAT.regional p_regional := ?
            ) modifies mw_defaultSpatem := {
                regional       := p_regional // TODO Try to refined it
            }
            
        } // End of group spatemTemplates
        
    } // End of group mapemSpatemTemplates

} // End of module LibItsMapemSpatem_Templates