blob: 3054999375266f854abe543f76bc475f2de52973 [file] [log] [blame]
Juha Hyttinenfa015662020-01-24 10:05:18 +02001/*
2==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17==================================================================================
18*/
19
20package control
21
22import (
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020023 "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap"
Juha Hyttinenfa015662020-01-24 10:05:18 +020024 "testing"
25)
26
27//-----------------------------------------------------------------------------
28// TestSubReqAndRouteNok
29//
30// stub stub
31// +-------+ +---------+ +---------+
32// | xapp | | submgr | | rtmgr |
33// +-------+ +---------+ +---------+
34// | | |
35// | SubReq | |
36// |------------->| |
37// | | |
38// | | RouteCreate |
39// | |------------->|
40// | | |
41// | | RouteCreate |
42// | | status:400 |
43// | |<-------------|
44// | | |
45// | [SUBS INT DELETE] |
46// | | |
47//
48//-----------------------------------------------------------------------------
49
50func TestSubReqAndRouteNok(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020051 CaseBegin("TestSubReqAndRouteNok")
Juha Hyttinenfa015662020-01-24 10:05:18 +020052
53 waiter := rtmgrHttp.AllocNextEvent(false)
54 newSubsId := mainCtrl.get_subid(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020055 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +020056 waiter.WaitResult(t)
57
58 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +020059 mainCtrl.wait_subs_clean(t, newSubsId, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020060
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020061 xappConn1.TestMsgChanEmpty(t)
62 xappConn2.TestMsgChanEmpty(t)
63 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +020064 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020065}
66
67//-----------------------------------------------------------------------------
68// TestSubReqAndSubDelOk
69//
70// stub stub
71// +-------+ +---------+ +---------+
72// | xapp | | submgr | | e2term |
73// +-------+ +---------+ +---------+
74// | | |
75// | SubReq | |
76// |------------->| |
77// | | |
78// | | SubReq |
79// | |------------->|
80// | | |
81// | | SubResp |
82// | |<-------------|
83// | | |
84// | SubResp | |
85// |<-------------| |
86// | | |
87// | | |
88// | SubDelReq | |
89// |------------->| |
90// | | |
91// | | SubDelReq |
92// | |------------->|
93// | | |
94// | | SubDelResp |
95// | |<-------------|
96// | | |
97// | SubDelResp | |
98// |<-------------| |
99//
100//-----------------------------------------------------------------------------
101func TestSubReqAndSubDelOk(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200102 CaseBegin("TestSubReqAndSubDelOk")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200103
104 waiter := rtmgrHttp.AllocNextEvent(true)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200105 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200106 waiter.WaitResult(t)
107
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200108 crereq, cremsg := e2termConn.RecvSubsReq(t)
109 e2termConn.SendSubsResp(t, crereq, cremsg)
110 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
111 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
112 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200113
114 waiter = rtmgrHttp.AllocNextEvent(true)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200115 e2termConn.SendSubsDelResp(t, delreq, delmsg)
116 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200117 waiter.WaitResult(t)
118
119 //Wait that subs is cleaned
120 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
121
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200122 xappConn1.TestMsgChanEmpty(t)
123 xappConn2.TestMsgChanEmpty(t)
124 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200125 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200126}
127
128//-----------------------------------------------------------------------------
129// TestSubReqRetransmission
130//
131// stub stub
132// +-------+ +---------+ +---------+
133// | xapp | | submgr | | e2term |
134// +-------+ +---------+ +---------+
135// | | |
136// | SubReq | |
137// |------------->| |
138// | | |
139// | | SubReq |
140// | |------------->|
141// | | |
142// | SubReq | |
143// | (retrans) | |
144// |------------->| |
145// | | |
146// | | SubResp |
147// | |<-------------|
148// | | |
149// | SubResp | |
150// |<-------------| |
151// | | |
152// | [SUBS DELETE] |
153// | | |
154//
155//-----------------------------------------------------------------------------
156func TestSubReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200157 CaseBegin("TestSubReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200158
159 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200160 cretrans := xappConn1.SendSubsReq(t, nil, nil)
161 crereq, cremsg := e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200162
163 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200164 xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200165 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
166
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200167 e2termConn.SendSubsResp(t, crereq, cremsg)
168 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200169
170 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200171 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
172 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
173 e2termConn.SendSubsDelResp(t, delreq, delmsg)
174 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200175
176 //Wait that subs is cleaned
177 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
178
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200179 xappConn1.TestMsgChanEmpty(t)
180 xappConn2.TestMsgChanEmpty(t)
181 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200182 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200183}
184
185//-----------------------------------------------------------------------------
186// TestSubDelReqRetransmission
187//
188// stub stub
189// +-------+ +---------+ +---------+
190// | xapp | | submgr | | e2term |
191// +-------+ +---------+ +---------+
192// | | |
193// | [SUBS CREATE] |
194// | | |
195// | | |
196// | SubDelReq | |
197// |------------->| |
198// | | |
199// | | SubDelReq |
200// | |------------->|
201// | | |
202// | SubDelReq | |
203// | (same sub) | |
204// | (same xid) | |
205// |------------->| |
206// | | |
207// | | SubDelResp |
208// | |<-------------|
209// | | |
210// | SubDelResp | |
211// |<-------------| |
212//
213//-----------------------------------------------------------------------------
214func TestSubDelReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200215 CaseBegin("TestSubDelReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200216
217 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200218 cretrans := xappConn1.SendSubsReq(t, nil, nil)
219 crereq, cremsg := e2termConn.RecvSubsReq(t)
220 e2termConn.SendSubsResp(t, crereq, cremsg)
221 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200222
223 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200224 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
225 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200226
227 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200228 xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200229 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
230
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200231 e2termConn.SendSubsDelResp(t, delreq, delmsg)
232 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200233
234 //Wait that subs is cleaned
235 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
236
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200237 xappConn1.TestMsgChanEmpty(t)
238 xappConn2.TestMsgChanEmpty(t)
239 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200240 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200241}
242
243//-----------------------------------------------------------------------------
244// TestSubDelReqCollision
245//
246// stub stub
247// +-------+ +---------+ +---------+
248// | xapp | | submgr | | e2term |
249// +-------+ +---------+ +---------+
250// | | |
251// | [SUBS CREATE] |
252// | | |
253// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200254// | SubDelReq 1 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200255// |------------->| |
256// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200257// | | SubDelReq 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200258// | |------------->|
259// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200260// | SubDelReq 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200261// | (same sub) | |
262// | (diff xid) | |
263// |------------->| |
264// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200265// | | SubDelResp 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200266// | |<-------------|
267// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200268// | SubDelResp 1 | |
269// |<-------------| |
270// | | |
271// | SubDelResp 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200272// |<-------------| |
273//
274//-----------------------------------------------------------------------------
Juha Hyttinen3944a222020-01-24 11:51:46 +0200275
Juha Hyttinenfa015662020-01-24 10:05:18 +0200276func TestSubDelReqCollision(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200277 CaseBegin("TestSubDelReqCollision")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200278
279 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200280 cretrans := xappConn1.SendSubsReq(t, nil, nil)
281 crereq, cremsg := e2termConn.RecvSubsReq(t)
282 e2termConn.SendSubsResp(t, crereq, cremsg)
283 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200284
285 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200286 xappConn1.SendSubsDelReq(t, nil, e2SubsId)
287 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200288
Juha Hyttinen3944a222020-01-24 11:51:46 +0200289 // Subs Delete colliding
Juha Hyttinenfa015662020-01-24 10:05:18 +0200290 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200291 deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
292 xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200293 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
294
Juha Hyttinen3944a222020-01-24 11:51:46 +0200295 // Del resp for first and second
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200296 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200297
298 // don't care in which order responses are received
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200299 xappConn1.RecvSubsDelResp(t, nil)
300 xappConn1.RecvSubsDelResp(t, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200301
302 //Wait that subs is cleaned
303 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
304
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200305 xappConn1.TestMsgChanEmpty(t)
306 xappConn2.TestMsgChanEmpty(t)
307 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200308 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200309}
310
311//-----------------------------------------------------------------------------
312// TestSubReqAndSubDelOkTwoParallel
313//
314// stub stub
315// +-------+ +---------+ +---------+
316// | xapp | | submgr | | e2term |
317// +-------+ +---------+ +---------+
318// | | |
319// | | |
320// | | |
321// | SubReq1 | |
322// |------------->| |
323// | | |
324// | | SubReq1 |
325// | |------------->|
326// | | |
327// | SubReq2 | |
328// |------------->| |
329// | | |
330// | | SubReq2 |
331// | |------------->|
332// | | |
333// | | SubResp1 |
334// | |<-------------|
335// | | SubResp2 |
336// | |<-------------|
337// | | |
338// | SubResp1 | |
339// |<-------------| |
340// | SubResp2 | |
341// |<-------------| |
342// | | |
343// | [SUBS 1 DELETE] |
344// | | |
345// | [SUBS 2 DELETE] |
346// | | |
347//
348//-----------------------------------------------------------------------------
349func TestSubReqAndSubDelOkTwoParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200350 CaseBegin("TestSubReqAndSubDelOkTwoParallel")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200351
352 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200353 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200354 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200355 rparams1.Req.EventTriggerDefinition.ProcedureCode = 5
356 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
357 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200358
359 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200360 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200361 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200362 rparams2.Req.EventTriggerDefinition.ProcedureCode = 28
363 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
364 crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200365
366 //Resp1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200367 e2termConn.SendSubsResp(t, crereq1, cremsg1)
368 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200369
370 //Resp2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200371 e2termConn.SendSubsResp(t, crereq2, cremsg2)
372 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200373
374 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200375 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
376 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
377 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
378 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200379 //Wait that subs is cleaned
380 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
381
382 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200383 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
384 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
385 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
386 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200387 //Wait that subs is cleaned
388 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
389
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200390 xappConn1.TestMsgChanEmpty(t)
391 xappConn2.TestMsgChanEmpty(t)
392 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200393 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200394}
395
396//-----------------------------------------------------------------------------
397// TestSameSubsDiffRan
398// Same subscription to different RANs
399//
400// stub stub
401// +-------+ +---------+ +---------+
402// | xapp | | submgr | | e2term |
403// +-------+ +---------+ +---------+
404// | | |
405// | | |
406// | | |
407// | SubReq(r1) | |
408// |------------->| |
409// | | |
410// | | SubReq(r1) |
411// | |------------->|
412// | | |
413// | | SubResp(r1) |
414// | |<-------------|
415// | | |
416// | SubResp(r1) | |
417// |<-------------| |
418// | | |
419// | SubReq(r2) | |
420// |------------->| |
421// | | |
422// | | SubReq(r2) |
423// | |------------->|
424// | | |
425// | | SubResp(r2) |
426// | |<-------------|
427// | | |
428// | SubResp(r2) | |
429// |<-------------| |
430// | | |
431// | [SUBS r1 DELETE] |
432// | | |
433// | [SUBS r2 DELETE] |
434// | | |
435//
436//-----------------------------------------------------------------------------
437func TestSameSubsDiffRan(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200438 CaseBegin("TestSameSubsDiffRan")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200439
440 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200441 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
442 xappConn1.SendSubsReq(t, nil, cretrans1)
443 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
444 e2termConn.SendSubsResp(t, crereq1, cremsg1)
445 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200446
447 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200448 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
449 xappConn1.SendSubsReq(t, nil, cretrans2)
450 crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
451 e2termConn.SendSubsResp(t, crereq2, cremsg2)
452 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200453
454 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200455 deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
456 xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1)
457 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
458 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
459 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200460 //Wait that subs is cleaned
461 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
462
463 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200464 deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
465 xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2)
466 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
467 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
468 xappConn1.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200469 //Wait that subs is cleaned
470 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
471
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200472 xappConn1.TestMsgChanEmpty(t)
473 xappConn2.TestMsgChanEmpty(t)
474 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200475 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200476}
477
478//-----------------------------------------------------------------------------
479// TestSubReqRetryInSubmgr
480//
481// stub stub
482// +-------+ +---------+ +---------+
483// | xapp | | submgr | | e2term |
484// +-------+ +---------+ +---------+
485// | | |
486// | SubReq | |
487// |------------->| |
488// | | |
489// | | SubReq |
490// | |------------->|
491// | | |
492// | | |
493// | | SubReq |
494// | |------------->|
495// | | |
496// | | SubResp |
497// | |<-------------|
498// | | |
499// | SubResp | |
500// |<-------------| |
501// | | |
502// | [SUBS DELETE] |
503// | | |
504//
505//-----------------------------------------------------------------------------
506
507func TestSubReqRetryInSubmgr(t *testing.T) {
508
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200509 CaseBegin("TestSubReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200510
511 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200512 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200513
514 // E2t: Receive 1st SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200515 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200516
517 // E2t: Receive 2nd SubsReq and send SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200518 crereq, cremsg := e2termConn.RecvSubsReq(t)
519 e2termConn.SendSubsResp(t, crereq, cremsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200520
521 // Xapp: Receive SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200522 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200523
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200524 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
525 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
526 e2termConn.SendSubsDelResp(t, delreq, delmsg)
527 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200528
529 // Wait that subs is cleaned
530 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
531
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200532 xappConn1.TestMsgChanEmpty(t)
533 xappConn2.TestMsgChanEmpty(t)
534 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200535 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200536}
537
538//-----------------------------------------------------------------------------
539// TestSubReqTwoRetriesNoRespSubDelRespInSubmgr
540//
541// stub stub
542// +-------+ +---------+ +---------+
543// | xapp | | submgr | | e2term |
544// +-------+ +---------+ +---------+
545// | | |
546// | SubReq | |
547// |------------->| |
548// | | |
549// | | SubReq |
550// | |------------->|
551// | | |
552// | | |
553// | | SubReq |
554// | |------------->|
555// | | |
556// | | SubDelReq |
557// | |------------->|
558// | | |
559// | | |
560// | | SubDelReq |
561// | |------------->|
562// | | |
563// | | |
564// | | SubDelResp |
565// | |<-------------|
566// | | |
567//
568//-----------------------------------------------------------------------------
569
570func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
571
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200572 CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200573
574 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200575 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200576
577 // E2t: Receive 1st SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200578 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200579
580 // E2t: Receive 2nd SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200581 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200582
583 // E2t: Send receive SubsDelReq and send SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200584 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
585 e2termConn.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200586
587 // Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +0200588 mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200589
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200590 xappConn1.TestMsgChanEmpty(t)
591 xappConn2.TestMsgChanEmpty(t)
592 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200593 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200594}
595
596//-----------------------------------------------------------------------------
597// TestSubReqTwoRetriesNoRespAtAllInSubmgr
598//
599// stub stub
600// +-------+ +---------+ +---------+
601// | xapp | | submgr | | e2term |
602// +-------+ +---------+ +---------+
603// | | |
604// | SubReq | |
605// |------------->| |
606// | | |
607// | | SubReq |
608// | |------------->|
609// | | |
610// | | |
611// | | SubReq |
612// | |------------->|
613// | | |
614// | | SubDelReq |
615// | |------------->|
616// | | |
617// | | |
618// | | SubDelReq |
619// | |------------->|
620// | | |
621// | | |
622//
623//-----------------------------------------------------------------------------
624
625func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) {
626
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200627 CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200628
629 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200630 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200631
632 // E2t: Receive 1st SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200633 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200634
635 // E2t: Receive 2nd SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200636 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200637
638 // E2t: Receive 1st SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200639 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200640
641 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200642 delreq, _ := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200643
644 // Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +0200645 mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200646
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200647 xappConn1.TestMsgChanEmpty(t)
648 xappConn2.TestMsgChanEmpty(t)
649 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200650 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200651}
652
653//-----------------------------------------------------------------------------
654// TestSubReqSubFailRespInSubmgr
655//
656// stub stub
657// +-------+ +---------+ +---------+
658// | xapp | | submgr | | e2term |
659// +-------+ +---------+ +---------+
660// | | |
661// | SubReq | |
662// |------------->| |
663// | | |
664// | | SubReq |
665// | |------------->|
666// | | |
667// | | SubFail |
668// | |<-------------|
669// | | |
670// | SubFail | |
671// |<-------------| |
672// | | |
673//
674//-----------------------------------------------------------------------------
675
676func TestSubReqSubFailRespInSubmgr(t *testing.T) {
677
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200678 CaseBegin("TestSubReqSubFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200679
680 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200681 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200682
683 // E2t: Receive SubsReq and send SubsFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200684 crereq, cremsg := e2termConn.RecvSubsReq(t)
685 fparams := &teststube2ap.E2StubSubsFailParams{}
Juha Hyttinenfa015662020-01-24 10:05:18 +0200686 fparams.Set(crereq)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200687 e2termConn.SendSubsFail(t, fparams, cremsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200688
689 // Xapp: Receive SubsFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200690 e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200691
692 // Wait that subs is cleaned
693 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
694
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200695 xappConn1.TestMsgChanEmpty(t)
696 xappConn2.TestMsgChanEmpty(t)
697 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200698 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200699}
700
701//-----------------------------------------------------------------------------
702// TestSubDelReqRetryInSubmgr
703//
704// stub stub
705// +-------+ +---------+ +---------+
706// | xapp | | submgr | | e2term |
707// +-------+ +---------+ +---------+
708// | | |
709// | [SUBS CREATE] |
710// | | |
711// | | |
712// | SubDelReq | |
713// |------------->| |
714// | | |
715// | | SubDelReq |
716// | |------------->|
717// | | |
718// | | SubDelReq |
719// | |------------->|
720// | | |
721// | | SubDelResp |
722// | |<-------------|
723// | | |
724// | SubDelResp | |
725// |<-------------| |
726//
727//-----------------------------------------------------------------------------
728
729func TestSubDelReqRetryInSubmgr(t *testing.T) {
730
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200731 CaseBegin("TestSubDelReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200732
733 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200734 cretrans := xappConn1.SendSubsReq(t, nil, nil)
735 crereq, cremsg := e2termConn.RecvSubsReq(t)
736 e2termConn.SendSubsResp(t, crereq, cremsg)
737 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200738
739 // Subs Delete
740 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200741 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200742
743 // E2t: Receive 1st SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200744 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200745
746 // E2t: Receive 2nd SubsDelReq and send SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200747 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
748 e2termConn.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200749
750 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200751 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200752
753 // Wait that subs is cleaned
754 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
755
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200756 xappConn1.TestMsgChanEmpty(t)
757 xappConn2.TestMsgChanEmpty(t)
758 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200759 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200760}
761
762//-----------------------------------------------------------------------------
763// TestSubDelReqTwoRetriesNoRespInSubmgr
764//
765// stub stub
766// +-------+ +---------+ +---------+
767// | xapp | | submgr | | e2term |
768// +-------+ +---------+ +---------+
769// | | |
770// | [SUBS CREATE] |
771// | | |
772// | | |
773// | SubDelReq | |
774// |------------->| |
775// | | |
776// | | SubDelReq |
777// | |------------->|
778// | | |
779// | | SubDelReq |
780// | |------------->|
781// | | |
782// | | |
783// | SubDelResp | |
784// |<-------------| |
785//
786//-----------------------------------------------------------------------------
787
788func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) {
789
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200790 CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200791
792 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200793 cretrans := xappConn1.SendSubsReq(t, nil, nil)
794 crereq, cremsg := e2termConn.RecvSubsReq(t)
795 e2termConn.SendSubsResp(t, crereq, cremsg)
796 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200797
798 // Subs Delete
799 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200800 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200801
802 // E2t: Receive 1st SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200803 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200804
805 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200806 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200807
808 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200809 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200810
811 // Wait that subs is cleaned
812 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
813
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200814 xappConn1.TestMsgChanEmpty(t)
815 xappConn2.TestMsgChanEmpty(t)
816 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200817 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200818}
819
820//-----------------------------------------------------------------------------
821// TestSubDelReqSubDelFailRespInSubmgr
822//
823// stub stub
824// +-------+ +---------+ +---------+
825// | xapp | | submgr | | e2term |
826// +-------+ +---------+ +---------+
827// | | |
828// | [SUBS CREATE] |
829// | | |
830// | | |
831// | SubDelReq | |
832// |------------->| |
833// | | |
834// | | SubDelReq |
835// | |------------->|
836// | | |
837// | | SubDelFail |
838// | |<-------------|
839// | | |
840// | SubDelResp | |
841// |<-------------| |
842// | | |
843//
844//-----------------------------------------------------------------------------
845
846func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) {
847
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200848 CaseBegin("TestSubReqSubDelFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200849
850 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200851 cretrans := xappConn1.SendSubsReq(t, nil, nil)
852 crereq, cremsg := e2termConn.RecvSubsReq(t)
853 e2termConn.SendSubsResp(t, crereq, cremsg)
854 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200855
856 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200857 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200858
859 // E2t: Send receive SubsDelReq and send SubsDelFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200860 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
861 e2termConn.SendSubsDelFail(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200862
863 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200864 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200865
866 // Wait that subs is cleaned
867 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
868
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200869 xappConn1.TestMsgChanEmpty(t)
870 xappConn2.TestMsgChanEmpty(t)
871 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200872 mainCtrl.wait_registry_empty(t, 10)
873}
874
875//-----------------------------------------------------------------------------
876// TestSubReqAndSubDelOkSameAction
877//
878// stub stub
879// +-------+ +---------+ +---------+
880// | xapp | | submgr | | e2term |
881// +-------+ +---------+ +---------+
882// | | |
883// | | |
884// | | |
885// | SubReq1 | |
886// |------------->| |
887// | | |
888// | | SubReq1 |
889// | |------------->|
890// | | SubResp1 |
891// | |<-------------|
892// | SubResp1 | |
893// |<-------------| |
894// | | |
895// | SubReq2 | |
896// |------------->| |
897// | | |
898// | SubResp2 | |
899// |<-------------| |
900// | | |
901// | SubDelReq 1 | |
902// |------------->| |
903// | | |
904// | SubDelResp 1 | |
905// |<-------------| |
906// | | |
907// | SubDelReq 2 | |
908// |------------->| |
909// | | |
910// | | SubDelReq 2 |
911// | |------------->|
912// | | |
913// | | SubDelReq 2 |
914// | |------------->|
915// | | |
916// | SubDelResp 2 | |
917// |<-------------| |
918//
919//-----------------------------------------------------------------------------
920func TestSubReqAndSubDelOkSameAction(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200921 CaseBegin("TestSubReqAndSubDelOkSameAction")
Juha Hyttinen3944a222020-01-24 11:51:46 +0200922
923 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200924 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200925 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200926 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
927 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
928 e2termConn.SendSubsResp(t, crereq1, cremsg1)
929 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200930
931 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200932 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200933 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200934 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
935 //crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
936 //e2termConn.SendSubsResp(t, crereq2, cremsg2)
937 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200938
939 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200940 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
941 //e2termConn.RecvSubsDelReq(t)
942 //e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
943 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200944 //Wait that subs is cleaned
945 //mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
946
947 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200948 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
949 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
950 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
951 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200952 //Wait that subs is cleaned
953 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
954
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200955 xappConn1.TestMsgChanEmpty(t)
956 xappConn2.TestMsgChanEmpty(t)
957 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200958 mainCtrl.wait_registry_empty(t, 10)
959}
960
961//-----------------------------------------------------------------------------
962// TestSubReqAndSubDelOkSameActionParallel
963//
964// stub stub
965// +-------+ +---------+ +---------+
966// | xapp | | submgr | | e2term |
967// +-------+ +---------+ +---------+
968// | | |
969// | | |
970// | | |
971// | SubReq1 | |
972// |------------->| |
973// | | |
974// | | SubReq1 |
975// | |------------->|
976// | SubReq2 | |
977// |------------->| |
978// | | SubResp1 |
979// | |<-------------|
980// | SubResp1 | |
981// |<-------------| |
982// | | |
983// | SubResp2 | |
984// |<-------------| |
985// | | |
986// | SubDelReq 1 | |
987// |------------->| |
988// | | |
989// | SubDelResp 1 | |
990// |<-------------| |
991// | | |
992// | SubDelReq 2 | |
993// |------------->| |
994// | | |
995// | | SubDelReq 2 |
996// | |------------->|
997// | | |
998// | | SubDelReq 2 |
999// | |------------->|
1000// | | |
1001// | SubDelResp 2 | |
1002// |<-------------| |
1003//
1004//-----------------------------------------------------------------------------
1005func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001006 CaseBegin("TestSubReqAndSubDelOkSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001007
1008 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001009 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001010 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001011 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
1012 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001013
1014 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001015 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001016 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001017 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001018
1019 //Resp1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001020 e2termConn.SendSubsResp(t, crereq1, cremsg1)
1021 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001022
1023 //Resp2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001024 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001025
1026 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001027 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1028 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001029
1030 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001031 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
1032 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
1033 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
1034 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001035
1036 //Wait that subs is cleaned
1037 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1038
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001039 xappConn1.TestMsgChanEmpty(t)
1040 xappConn2.TestMsgChanEmpty(t)
1041 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001042 mainCtrl.wait_registry_empty(t, 10)
1043}
1044
1045//-----------------------------------------------------------------------------
1046// TestSubReqAndSubDelNokSameActionParallel
1047//
1048// stub stub
1049// +-------+ +---------+ +---------+
1050// | xapp | | submgr | | e2term |
1051// +-------+ +---------+ +---------+
1052// | | |
1053// | | |
1054// | | |
1055// | SubReq1 | |
1056// |------------->| |
1057// | | |
1058// | | SubReq1 |
1059// | |------------->|
1060// | SubReq2 | |
1061// |------------->| |
1062// | | SubFail1 |
1063// | |<-------------|
1064// | SubFail1 | |
1065// |<-------------| |
1066// | | |
1067// | SubFail2 | |
1068// |<-------------| |
1069//
1070//-----------------------------------------------------------------------------
1071func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001072 CaseBegin("TestSubReqAndSubDelNokSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001073
1074 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001075 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001076 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001077 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
1078 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001079
1080 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001081 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001082 rparams2.Init()
1083 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001084 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001085 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1086
1087 //E2T Fail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001088 fparams := &teststube2ap.E2StubSubsFailParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001089 fparams.Set(crereq1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001090 e2termConn.SendSubsFail(t, fparams, cremsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001091
1092 //Fail1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001093 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001094 //Fail2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001095 xappConn2.RecvSubsFail(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001096
1097 //Wait that subs is cleaned
1098 mainCtrl.wait_subs_clean(t, e2SubsId1, 15)
1099
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001100 xappConn1.TestMsgChanEmpty(t)
1101 xappConn2.TestMsgChanEmpty(t)
1102 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001103 mainCtrl.wait_registry_empty(t, 10)
1104}
1105
1106//-----------------------------------------------------------------------------
1107// TestSubReqAndSubDelNoAnswerSameActionParallel
1108//
1109// stub stub
1110// +-------+ +---------+ +---------+
1111// | xapp | | submgr | | e2term |
1112// +-------+ +---------+ +---------+
1113// | | |
1114// | | |
1115// | | |
1116// | SubReq1 | |
1117// |------------->| |
1118// | | |
1119// | | SubReq1 |
1120// | |------------->|
1121// | SubReq2 | |
1122// |------------->| |
1123// | | |
1124// | | SubReq1 |
1125// | |------------->|
1126// | | |
1127// | | |
1128// | | SubDelReq |
1129// | |------------->|
1130// | | |
1131// | | SubDelResp |
1132// | |<-------------|
1133//
1134//-----------------------------------------------------------------------------
1135func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001136 CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001137
1138 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001139 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001140 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001141 xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001142
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001143 e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001144
1145 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001146 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001147 rparams2.Init()
1148 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001149 xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001150 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1151
1152 //Req1 (retransmitted)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001153 e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001154
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001155 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
1156 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001157
1158 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +02001159 mainCtrl.wait_subs_clean(t, delreq1.RequestId.Seq, 10)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001160
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001161 xappConn1.TestMsgChanEmpty(t)
1162 xappConn2.TestMsgChanEmpty(t)
1163 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001164 mainCtrl.wait_registry_empty(t, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001165}