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
|
module TP0example (octetstring Calling_AddressN_CONind, octetstring Called_AddressN_CONind,
octetstring Resp_AddressN_CONresp, octetstring Dest_RefCR, octetstring Sou_RefCR,
octetstring Dest_RefCC, octetstring Sou_RefCC, octetstring Calling_AddressT_CONind,
octetstring Called_AddressT_CONind, octetstring Resp_AddressT_CONresp)
{
/* The parameters above are references to Test Suite Parameters (PIXIT values) */
/* General Type Definitions */
type octetstring Address2 length(2);
type integer QoS0 (0);
type octetstring Address4 length(4);
type integer ED (0);
type octetstring LengthIndicator length(1);
type bitstring PduCode length(4);
type bitstring Credit length(4);
type bitstring ServiceClass length(4);
type bitstring Opt length(4);
/* Configuration Definitions */
group ConfigurationDefinitions {
/* Port Type Definitions */
type port NSAP message {
in N_CONresp, N_DATAreq; /* received from IUT */
out N_CONind, N_DATAind; /* sent to IUT */
} with { display "PCO Type, role := LT"; }
type port TSAP message {
in T_CONind; /* received from IUT */
out T_CONresp; /* sent to IUT */
} with { display "PCO Type, role = UT"; }
/* MTC Type Definition */
type component CompType {
port NSAP L;
port TSAP U;
};
} /* End ConfigurationDefinitions */
/* ASP Type Definitions for Network Interface */
group NetworkASPTypes {
type record N_CONind {
Address2 calling_address,
Address2 called_address,
QoS0 quality_of_service
};
type record N_CONresp {
Address2 responding_address,
QoS0 quality_of_service
};
type record N_DATAind (MetaPDUType){
MetaPDUType user_data
};
type record N_DATAreq (MetaPDUType){
MetaPDUType user_data
};
} with { display "ASP Type Definitions"; } /* End NetworkASPTypes */
/* ASP Type Definitions for Transport Interface */
group TransportASPTypes {
type record T_CONind {
Address4 calling_address,
Address4 called_address,
ED expediated_data,
QoS0 quality_of_service
};
type record T_CONresp {
Address4 responding_address,
ED expediated_data,
QoS0 quality_of_service
};
} with { display "ASP Type Definitions"; } /* End TransportASPTypes */
/* PDU Type Definitions */
group PDUTypes {
type record CR {
LengthIndicator li,
PduCode pdu_code,
Credit cdt,
Address2 destination_Ref,
Address2 source_Ref,
ServiceClass class,
Opt option
};
type record CR {
LengthIndicator li,
PduCode pdu_code,
Credit cdt,
Address2 destination_Ref,
Address2 source_Ref,
ServiceClass class,
Opt option
};
} with { display "PDU Type Definitions"; } /* End PDUTypes */
/* Template Definitions */
group TemplateDefinitions {
template N_CONind n_conind := {
calling_address := Calling_AddressN_CONind,
called_address := Called_AddressN_CONind,
quality_of_service := 0 };
template N_CONresp n_conresp := {
responding_address := Resp_AddressN_CONresp,
quality_of_service := 0 };
template N_DATAind n_dataind (MetaPDUType pdupar) := { user_data := pdupar };
template N_DATAreq n_datareq (MetaPDUType pdupar) := { user_data := pdupar };
template T_CONind t_conind := {
calling_address := Calling_AddressT_CONind,
called_address := Called_AddressT_CONind,
expediated_data := 0,
quality_of_service := 0 };
template T_CONresp t_conresp := {
responding_address := Resp_AddressT_CONresp,
expediated_data := 0,
quality_of_service := 0 };
template CR cr := {
li := '07'O,
pdu_code := '1110'B,
cdt := '0000'B,
destination_Ref := Dest_RefCR,
source_Ref := Sou_RefCR,
class := '0000'B,
option := '0000'B };
template CC cc := {
li := '07'O,
pdu_code := '1101'B,
cdt := '0000'B,
destination_Ref := Dest_RefCC,
source_Ref := Sou_RefCC,
class := '0000'B,
option := '0000'B };
} /* End TemplateDefinitions */
/* Default error handling taken care of in test step */
teststep OtherwiseFail() {
[] L.receive {
verdict.set(fail);
stop;
}
[] U.receive {
verdict.set(fail);
stop;
}
} with { display "default"; }
/* Test step */
/* This TP0 test case is a trial to convert the TP0 example used in
Telelogic's introductory course in TTCN-2. The test defines Basic Interconnection
with layer T, transport protocol. */
group BasicInterConnection {
testcase TP0 () runs on CompType {
var default def := activate (OtherwiseFail()); /* Activate defaults */
L.send (n_conind);
L.receive (n_conresp);
L.send (n_dataind(cr));
U.receive (t_conind);
U.send (t_conresp);
L.receive (n_datareq(cc));
verdict.set(pass);
stop;
} /* End testcase TP0 */
} /* End group BasicInterConnection */
} /* end module TP0example */
|