test_LibItsBtp_TypesAndValues.ttcn 15 KB
Newer Older
1 2
module test_LibItsBtp_TypesAndValues /*language "TTCN-3:2009 Advanced Parameterization"*/ {
    
3 4 5 6 7
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    
    // LibItsBtp
    import from LibItsBtp_TypesAndValues all;
8 9
    import from LibItsBtp_TestSystem all;
    import from LibItsBtp_Templates all;
10 11
    
    import from test_CommonCodec all;
12
    
13 14 15 16
    group LibItsBtp_testCases {
        
        group LibItsBtp_DummyTemplates {
    
17 18 19
            template (value) UtBtpTrigger m_utEventBtpA := {
                btpA := {
                    btpAHeader := {
20 21 22
                        destinationPort := 1234,
                        sourcePort := 5678
                    }
23 24
                }
            }
25
    
26 27 28
            template (value) UtBtpTrigger m_utEventBtpB := {
                btpB := {
                    btpBHeader := {
29 30 31
                        destinationPort := 123,
                        destinationPortInfo := 432
                    }
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
    
            template BtpInd m_btpInd(template (present) BtpPacket p_btpPkt) := {
                msgIn := p_btpPkt
            }
    
            template (value) BtpPacket m_btpA_Without_Payload (
                template (value) BtpPortId  p_destPort,
                template (value) BtpPortId  p_sourcePort
            ):= {
                header := { 
                    btpAHeader := {
                        destinationPort := p_destPort, 
                        sourcePort := p_sourcePort
                    }
                }, 
                payload := omit 
            }
    
            template BtpPacket m_btpA_With_Payload ( 
                in template (value) BtpPortId  p_destPort, 
                in template (value) BtpPortId  p_sourcePort, 
                in template DecodedBtpPayload p_decodedPayload, 
                in template (value) octetstring p_rawPayload 
            ) := { 
                header := { 
                    btpAHeader := {
                        destinationPort := p_destPort, 
                        sourcePort := p_sourcePort
                    }
                }, 
64
                payload := { 
65 66 67
                    decodedPayload := p_decodedPayload,
                    rawPayload := p_rawPayload
                } 
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
    
            template BtpPacket mw_btpA_With_Payload ( 
                in template (present) BtpPortId  p_destPort, 
                in template (present) BtpPortId  p_sourcePort, 
                in template DecodedBtpPayload p_decodedPayload, 
                in template (present) octetstring p_rawPayload 
            ) := { 
                header := { 
                    btpAHeader := {
                        destinationPort := p_destPort, 
                        sourcePort := p_sourcePort
                    }
                }, 
                payload := { 
                    decodedPayload := p_decodedPayload,
                    rawPayload := p_rawPayload
                } 
            }
    
            template (value) BtpPacket m_btpB_Without_Payload (
                template (value) BtpPortId  p_destPort,
                template (value) BtpPortId  p_destinationPortInfo
            ):= {
                header := { 
                    btpBHeader := {
                        destinationPort := p_destPort, 
                        destinationPortInfo := p_destinationPortInfo
                    }
                }, 
                payload := omit
            }
    
        } // End of group LibItsBtp_DummyTemplates
    
        group testAcPrimitives {
        } // End of group testAcPrimitives
    
        group testBtpPrimitiveMessages {
    
    //        /**
    //         * @desc validate BtpReq/BTP type A
    //         * @verdict Pass on success, Fail otherwise
    //         */
    //        testcase tc_BtpReq_A() runs on TCType system TCType {
    //            test_PDU<BtpReq>(
    //                m_btpReq( m_btpA_Without_Payload (1234, 5678)), 
    //                true, 
    //                oct2bit('4b000a34000732000404d2162e'O));
    //        }
    //
    //        /**
    //         * @desc validate BtpReq/BTP type A with payload
    //         * @verdict Pass on success, Fail otherwise
    //         */
    //        testcase tc_BtpReq_A_With_Payload() runs on TCType system TCType {
    //            test_PDU<BtpReq>(
    //                m_btpReq( 
    //                    m_btpAWithPorts ( 
    //                        1234, 
    //                        5678, 
    //                        { 
    //                            decodedPayload := omit, 
    //                            rawPayload := 'ca5caded'O 
    //                        } // End of 'payload' field 
    //                    )), 
    //                true, 
    //                oct2bit('4b000e34000b32000404d2162eca5caded'O));
    //        }
    //
    //        /**
    //         * @desc validate BtpReq/BTP type A with payload
    //         * @verdict Pass on success, Fail otherwise
    //         */
    //        testcase tc_BtpReq_A_With_DenmPayload() runs on TCType system TCType {
    //            test_PDU<BtpReq>(
    //                m_btpReq( 
    //                    m_btpAWithPorts ( 
    //                        1234, 
    //                        5678, 
    //                        { 
    //                            decodedPayload := { 
    //                                denmPacket := {
    //                                    header := { 
    //                                        protocolVersion := 0, 
    //                                        messageID := 1, 
    //                                        generationTime := 1319187879132 
    //                                    }, 
    //                                    denm := { 
    //                                        management := { 
    //                                            actionID := { 
    //                                                stationID := 2339, 
    //                                                sequenceNo := 29 
    //                                            }, 
    //                                            dataVersion := 0, 
    //                                            expiryTime := 1319187938835, 
    //                                            frequency := omit, 
    //                                            reliability := 0, 
    //                                            isNegation := false 
    //                                        }, 
    //                                        situation := { 
    //                                            trafficFlowEffect := omit, 
    //                                            situation := { cause := 103, subCause := 0 }, 
    //                                            linkedCause := omit, 
    //                                            severity := informative, 
    //                                            eventCharact := omit, 
    //                                            vehicleCommonParameters := omit, 
    //                                            profile := omit 
    //                                        }, 
    //                                        location := { 
    //                                            eventPosition := { 
    //                                                eventPositionCurrentDefinition := { 
    //                                                    refPosition := { 
    //                                                        longitude := { hemisphere := east, degree := 0 }, 
    //                                                        latitude := { hemisphere := north, degree := 0 }, 
    //                                                        elevation := 0, 
    //                                                        heading := 0, 
    //                                                        streetName := omit, 
    //                                                        positionConfidence := 0, 
    //                                                        elevationConfidence := 0, 
    //                                                        roadSegmentID := omit 
    //                                                    }, 
    //                                                    eventSpeed := 0 
    //                                                } 
    //                                            }, 
    //                                            locationRef := { 
    //                                                trace := { 
    //                                                    traceID := 0, 
    //                                                    waypoints := { 
    //                                                        { ptLat := { hemisphere := south, degree := 0 }, 
    //                                                            ptLong := { hemisphere := west, degree := 0 }, 
    //                                                            ptAlt := 0 
    //                                                         } 
    //                                                    } 
    //                                                }
    //                                            }, 
    //                                            relevanceArea := { 
    //                                                geoAreaCenterLatitude := { hemisphere := south, degree := 0 }, 
    //                                                geoAreaCenterLongitude := { hemisphere := west, degree := 0 }, 
    //                                                shape := {circle := { radius := 0 } }, 
    //                                                directionalityFilter := noFilter, 
    //                                                disseminationAreaSize := omit 
    //                                            } 
    //                                        } 
    //                                    } // End of 'denm' field 
    //                                } // End of 'denmPacket' field 
    //                            }, // End of 'decodedPayload' field 
    //                            rawPayload := '0001013325b994dc400001246003a0002664b74fc2600067002d80000000000000000013880000007ffd00a0000000400000000013880085a80000001000000000000000'O 
    //                        } // End of 'payload' field 
    //                    )), 
    //                true, 
    //                oct2bit('4b004e34004b32000404d2162e0001013325b994dc400001246003a0002664b74fc2600067002d80000000000000000013880000007ffd00a0000000400000000013880085a80000001000000000000000'O));
    //        }
    //
            /**
             * @desc validate BtpReq/BTP type B
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_BtpReq_B() runs on TCType system TCType {
                test_PDU<BtpReq>(
                    m_btpReq( m_btpB_Without_Payload (4321, 8765)), 
                    true, 
                    oct2bit('10E1223D'O));
            }
    
            /**
             * @desc validate BtpReq/BTP type B with payload
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_BtpReq_B_With_Payload() runs on TCType system TCType {
                test_PDU<BtpReq>(
                    m_btpReq( 
                        m_btpBWithPorts ( 
                            4321, 
                            8765, 
                            { 
                                decodedPayload := omit, 
                                rawPayload := 'F1A7F007ED'O 
                            } // End of 'payload' field 
                        )), 
                    true, 
                    oct2bit('10E1223DF1A7F007ED'O));
            }
    
            /**
             * @desc validate BtpInd/BTP type A
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_BtpInd_A() runs on TCType system TCType {
                test_PDU<BtpInd>(
                    m_btpInd( m_btpA_Without_Payload (4321, 8765)), 
                    true, 
                    oct2bit('10E1223D'O));
            }
    
            /**
             * @desc validate BtpInd/BTP type A with payload
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_BtpInd_A_With_Payload() runs on TCType system TCType {
                test_PDU<BtpInd>(
                    m_btpInd( 
                        m_btpAWithPorts (
                            4321, 
                            8765, 
                            { 
                                decodedPayload := omit, 
                                rawPayload := 'F1A7F007ED'O 
                            } // End of 'payload' field 
                        )), 
                    true, 
                    oct2bit('10E1223DF1A7F007ED'O));
            }
    
            testcase tc_BtpInd_A_With_CamPayload() runs on TCType system TCType {
                test_decodePDU<BtpInd>(
                    { msgIn := mw_btpA_With_Payload(4321, 8765, ?, ?) }, 
                    '10E1223D01020001B20788B80059F48D95CDEFC8C5E0020020002461A83C000004805A100C4528399D4C387FFF80'O
                );
            }
    
            testcase tc_BtpInd_A_With_TrunkatedCamPayload() runs on TCType system TCType {
                test_decodePDU<BtpInd>(
                    { msgIn := mw_btpA_With_Payload(4321, 8765, ?, ?) }, 
                    '10E1223D000c32000410e1223d00000133256c5b1e40000248d6c0000000000000000009c4080000003ffe83e80004000000000000007ffd7ffe00'O
                );
                
                if (getverdict() == fail) {
                    setverdict(pass);
                } else {
                    setverdict(fail);
299
                }
300 301 302 303 304
            }
    
            testcase tc_BtpInd_A_With_DenmPayload() runs on TCType system TCType {
                test_decodePDU<BtpInd>(
                    { msgIn := mw_btpA_With_Payload(4321, 8765, ?, ?) }, 
305
                    '10E1223D01010001b207c70000d90380000a084901ea828212407b8cfa46cae6f7e4630001001000186a000009600c05b00000dffff7fffd8ce40400'O
306 307 308 309 310 311 312 313 314 315
                );
            }
    
        } // End of group testBtpPrimitiveMessages
    
        group LibItsBtp_testCases {
            
            testcase tc_BTP_A() runs on TCType system TCType {
                test_PDU<BtpPacket>(m_btpA (BtpPayload:{decodedPayload := omit, rawPayload := '0102030405'O } ), true, oct2bit('000000000102030405'O));
            }
316
            
317 318 319 320 321 322 323 324 325
        } // End of group LibItsBtp_testCases
        
        group testUtEvent {
    
            testcase tc_UtBtpInitialize() runs on TCType system TCType {
                test_PDU<UtInitialize>(m_btpInitialize, false);
            }
    
            testcase tc_UtEvent_A() runs on TCType system TCType {
326
                test_PDU<UtBtpTrigger>(m_utEventBtpA, false);
327 328 329
            }
    
            testcase tc_UtEvent_B() runs on TCType system TCType {
330
                test_PDU<UtBtpTrigger>(m_utEventBtpB, false);
331 332 333 334 335 336
            }
    
        } // End of group testUtEvent
        
    } // End of group LibItsBtp_testCases
    
337
} // End of module test_LibItsBtp_TypesAndValues