/
SCTP.ttcn
97 lines (66 loc) · 1.69 KB
/
SCTP.ttcn
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
module SCTP
{
// Test port in simple mode
// All config from the config file
// SCTP Server: ncat -l --sctp -vv -p 5202
import from SCTPasp_Types all;
import from SCTPasp_PortType all;
type component SCTP_CT {
port SCTPasp_PT SCTP_PCO;
}
type component System_CT
{
port SCTPasp_PT SCTP_PCO;
}
template ASP_SCTP_Close t_ASP_SCTP_Close(template integer p_clientId) := {client_id:=p_clientId};
template ASP_SCTP t_ASP_SCTP(charstring p_s) :=
{
client_id := omit,
sinfo_stream := 0,
sinfo_ppid := 0,
data := char2oct(p_s)
}
//******************************************************
testcase tc_sctp0() runs on SCTP_CT system System_CT {
//******************************************************
timer t0:=1.0;
map(self:SCTP_PCO, system:SCTP_PCO);
var ASP_SCTP_Connect vl_connect0 :=
{
peer_hostname:=omit,
peer_portnumber:=omit
}
//Connect
SCTP_PCO.send(vl_connect0) ;
t0.start;
alt
{
[]SCTP_PCO.receive(ASP_SCTP_RESULT:?) { }
[]t0.timeout { }
}
//Send some payload
for (var integer i:=0;i<=9;i:=i+1) {
var charstring vl_s:=int2str(i)&" :AABBCCDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ"&"\n\r";
SCTP_PCO.send(t_ASP_SCTP(vl_s)) ;
}
SCTP_PCO.send(t_ASP_SCTP("Client waiting for 1 second"&"\n\r")) ;
t0.start;
t0.timeout;
SCTP_PCO.send(t_ASP_SCTP("Client sending close"&"\n\r")) ;
SCTP_PCO.send(t_ASP_SCTP_Close(omit))
t0.start;
alt
{
[]SCTP_PCO.receive {}
[]t0.timeout {}
}
unmap(self:SCTP_PCO, system:SCTP_PCO);
all component.kill;
}
//******************************************************
control
//******************************************************
{
execute( tc_sctp0());
}//endcontrol
}//endmodule