Harald Welte | ac35980 | 2017-04-12 12:13:44 +0200 | [diff] [blame^] | 1 | module M3UA_Emulation_Test |
| 2 | { |
| 3 | |
| 4 | //import from MTP3asp_PortType all; |
| 5 | import from MTP3asp_Types all; |
| 6 | import from BICC_Types all; |
| 7 | import from M3UA_Emulation all; |
| 8 | import from SCTPasp_PortType all; |
| 9 | |
| 10 | modulepar |
| 11 | { |
| 12 | SCTP_Association_Address tsp_address := { 0, "", 0, "" }; |
| 13 | // float tsp_serverWait := 5.0; |
| 14 | // boolean tsp_serverTest := false; |
| 15 | } |
| 16 | |
| 17 | type port MTP3asp_PT_Int message |
| 18 | { |
| 19 | out ASP_MTP3_TRANSFERreq; |
| 20 | in ASP_MTP3_TRANSFERind; |
| 21 | } with {extension "internal"} |
| 22 | |
| 23 | type component BICC_CT |
| 24 | { |
| 25 | port MTP3asp_PT_Int BICC_MTP3_PORT; |
| 26 | } |
| 27 | |
| 28 | type component MTC_CT |
| 29 | { |
| 30 | var BICC_CT vlc_BICC_COMPONENT_1; |
| 31 | var M3UA_CT vlc_M3UA_COMPONENT_1; |
| 32 | port SCTPasp_PT SCTP_PORT; |
| 33 | |
| 34 | // var BICC_CT vlc_BICC_COMPONENT_2; |
| 35 | // port MTP3asp_PT M3UA_PORT; |
| 36 | } |
| 37 | |
| 38 | function f_testconfig_bicc(SCTP_Association_Address pl_address) runs on MTC_CT |
| 39 | { |
| 40 | vlc_BICC_COMPONENT_1 := BICC_CT.create; |
| 41 | vlc_M3UA_COMPONENT_1 := M3UA_CT.create; |
| 42 | connect(vlc_BICC_COMPONENT_1:BICC_MTP3_PORT, |
| 43 | vlc_M3UA_COMPONENT_1:MTP3_SP_PORT); |
| 44 | map(system:SCTP_PORT, vlc_M3UA_COMPONENT_1:SCTP_PORT); |
| 45 | vlc_M3UA_COMPONENT_1.start(f_M3UA_Emulation(pl_address)); |
| 46 | } |
| 47 | |
| 48 | function f_testconfig_end_demo_bicc() runs on MTC_CT |
| 49 | { |
| 50 | unmap(system:SCTP_PORT, vlc_M3UA_COMPONENT_1:SCTP_PORT); |
| 51 | disconnect(vlc_BICC_COMPONENT_1:BICC_MTP3_PORT, vlc_M3UA_COMPONENT_1:MTP3_SP_PORT); |
| 52 | vlc_M3UA_COMPONENT_1.stop; |
| 53 | } |
| 54 | |
| 55 | template ASP_MTP3_TRANSFERind tr_ASP_MTP3_TRANSFERind_BICC := |
| 56 | { sio := { |
| 57 | ni := '10'B, |
| 58 | prio := ?, |
| 59 | si := '1101'B |
| 60 | }, |
| 61 | opc := ?, |
| 62 | dpc := ?, |
| 63 | sls := ?, |
| 64 | data := ? |
| 65 | } |
| 66 | |
| 67 | function f_init_BICC_bicc() runs on BICC_CT |
| 68 | { |
| 69 | var PDU_BICC vl_PDU_BICC; |
| 70 | var ASP_MTP3_TRANSFERind vl_ASP_MTP3_TRANSFERind; |
| 71 | var ASP_MTP3_TRANSFERreq vl_ASP_MTP3_TRANSFERreq; |
| 72 | |
| 73 | vl_PDU_BICC := { |
| 74 | BICC_GRA := { |
| 75 | CIC := '00000000'O, |
| 76 | MType := '00010111'B, |
| 77 | var_part_ptr := 1, |
| 78 | RngSts := |
| 79 | { range := '1F'O, |
| 80 | status := ''O |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | vl_ASP_MTP3_TRANSFERreq := { |
| 86 | sio := { |
| 87 | ni := '10'B, |
| 88 | prio := '00'B, |
| 89 | si := '1101'B |
| 90 | }, |
| 91 | opc := 115, |
| 92 | dpc := 300, |
| 93 | sls := 0, |
| 94 | data := enc_PDU_BICC(vl_PDU_BICC) |
| 95 | } |
| 96 | |
| 97 | timer T_Timer := 5.0; |
| 98 | T_Timer.start; |
| 99 | alt { |
| 100 | [] BICC_MTP3_PORT.receive(tr_ASP_MTP3_TRANSFERind_BICC) |
| 101 | -> value vl_ASP_MTP3_TRANSFERind { |
| 102 | log("BICC_MTP3_PORT: received message: ", vl_ASP_MTP3_TRANSFERind); |
| 103 | vl_PDU_BICC := dec_PDU_BICC(vl_ASP_MTP3_TRANSFERind.data); |
| 104 | log("received BICC message: ", vl_PDU_BICC); |
| 105 | setverdict(pass); |
| 106 | BICC_MTP3_PORT.send(vl_ASP_MTP3_TRANSFERreq); |
| 107 | T_Timer.stop; |
| 108 | } |
| 109 | [] BICC_MTP3_PORT.receive(ASP_MTP3_TRANSFERind : ?) |
| 110 | -> value vl_ASP_MTP3_TRANSFERind { |
| 111 | log("BICC_MTP3_PORT: received message: ", vl_ASP_MTP3_TRANSFERind); |
| 112 | repeat; |
| 113 | } |
| 114 | [] BICC_MTP3_PORT.receive { |
| 115 | setverdict(fail); |
| 116 | } |
| 117 | [] T_Timer.timeout { |
| 118 | setverdict(fail); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | T_Timer.start; |
| 123 | alt { |
| 124 | [] BICC_MTP3_PORT.receive(tr_ASP_MTP3_TRANSFERind_BICC) |
| 125 | -> value vl_ASP_MTP3_TRANSFERind { |
| 126 | log("BICC_MTP3_PORT: received message: ", vl_ASP_MTP3_TRANSFERind); |
| 127 | vl_PDU_BICC := dec_PDU_BICC(vl_ASP_MTP3_TRANSFERind.data); |
| 128 | log("received BICC message: ", vl_PDU_BICC); |
| 129 | repeat; |
| 130 | } |
| 131 | [] BICC_MTP3_PORT.receive(ASP_MTP3_TRANSFERind : ?) |
| 132 | -> value vl_ASP_MTP3_TRANSFERind { |
| 133 | log("BICC_MTP3_PORT: received message: ", vl_ASP_MTP3_TRANSFERind); |
| 134 | repeat; |
| 135 | } |
| 136 | [] BICC_MTP3_PORT.receive { |
| 137 | } |
| 138 | [] T_Timer.timeout { |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | } |
| 143 | |
| 144 | testcase tc_M3UA_demo_bicc() runs on MTC_CT |
| 145 | { |
| 146 | f_testconfig_bicc(tsp_address); |
| 147 | vlc_BICC_COMPONENT_1.start(f_init_BICC_bicc()); |
| 148 | vlc_BICC_COMPONENT_1.done; |
| 149 | f_testconfig_end_demo_bicc(); |
| 150 | } |
| 151 | |
| 152 | } |