blob: de2458a09d9579327b54c7bb335d773584ed9721 [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 (
Anssi Mannila9bcb0a42020-02-11 11:30:44 +020023 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020024 "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap"
Juha Hyttinenfa015662020-01-24 10:05:18 +020025 "testing"
26)
27
28//-----------------------------------------------------------------------------
29// TestSubReqAndRouteNok
30//
31// stub stub
32// +-------+ +---------+ +---------+
33// | xapp | | submgr | | rtmgr |
34// +-------+ +---------+ +---------+
35// | | |
36// | SubReq | |
37// |------------->| |
38// | | |
39// | | RouteCreate |
40// | |------------->|
41// | | |
42// | | RouteCreate |
43// | | status:400 |
44// | |<-------------|
45// | | |
46// | [SUBS INT DELETE] |
47// | | |
48//
49//-----------------------------------------------------------------------------
50
51func TestSubReqAndRouteNok(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020052 CaseBegin("TestSubReqAndRouteNok")
Juha Hyttinenfa015662020-01-24 10:05:18 +020053
54 waiter := rtmgrHttp.AllocNextEvent(false)
55 newSubsId := mainCtrl.get_subid(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020056 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +020057 waiter.WaitResult(t)
58
59 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +020060 mainCtrl.wait_subs_clean(t, newSubsId, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020061
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020062 xappConn1.TestMsgChanEmpty(t)
63 xappConn2.TestMsgChanEmpty(t)
64 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +020065 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020066}
67
68//-----------------------------------------------------------------------------
69// TestSubReqAndSubDelOk
70//
71// stub stub
72// +-------+ +---------+ +---------+
73// | xapp | | submgr | | e2term |
74// +-------+ +---------+ +---------+
75// | | |
76// | SubReq | |
77// |------------->| |
78// | | |
79// | | SubReq |
80// | |------------->|
81// | | |
82// | | SubResp |
83// | |<-------------|
84// | | |
85// | SubResp | |
86// |<-------------| |
87// | | |
88// | | |
89// | SubDelReq | |
90// |------------->| |
91// | | |
92// | | SubDelReq |
93// | |------------->|
94// | | |
95// | | SubDelResp |
96// | |<-------------|
97// | | |
98// | SubDelResp | |
99// |<-------------| |
100//
101//-----------------------------------------------------------------------------
102func TestSubReqAndSubDelOk(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200103 CaseBegin("TestSubReqAndSubDelOk")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200104
105 waiter := rtmgrHttp.AllocNextEvent(true)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200106 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200107 waiter.WaitResult(t)
108
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200109 crereq, cremsg := e2termConn.RecvSubsReq(t)
110 e2termConn.SendSubsResp(t, crereq, cremsg)
111 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
112 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
113 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200114
115 waiter = rtmgrHttp.AllocNextEvent(true)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200116 e2termConn.SendSubsDelResp(t, delreq, delmsg)
117 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200118 waiter.WaitResult(t)
119
120 //Wait that subs is cleaned
121 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
122
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200123 xappConn1.TestMsgChanEmpty(t)
124 xappConn2.TestMsgChanEmpty(t)
125 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200126 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200127}
128
129//-----------------------------------------------------------------------------
130// TestSubReqRetransmission
131//
132// stub stub
133// +-------+ +---------+ +---------+
134// | xapp | | submgr | | e2term |
135// +-------+ +---------+ +---------+
136// | | |
137// | SubReq | |
138// |------------->| |
139// | | |
140// | | SubReq |
141// | |------------->|
142// | | |
143// | SubReq | |
144// | (retrans) | |
145// |------------->| |
146// | | |
147// | | SubResp |
148// | |<-------------|
149// | | |
150// | SubResp | |
151// |<-------------| |
152// | | |
153// | [SUBS DELETE] |
154// | | |
155//
156//-----------------------------------------------------------------------------
157func TestSubReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200158 CaseBegin("TestSubReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200159
160 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200161 cretrans := xappConn1.SendSubsReq(t, nil, nil)
162 crereq, cremsg := e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200163
164 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200165 xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200166 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
167
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200168 e2termConn.SendSubsResp(t, crereq, cremsg)
169 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200170
171 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200172 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
173 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
174 e2termConn.SendSubsDelResp(t, delreq, delmsg)
175 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200176
177 //Wait that subs is cleaned
178 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
179
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200180 xappConn1.TestMsgChanEmpty(t)
181 xappConn2.TestMsgChanEmpty(t)
182 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200183 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200184}
185
186//-----------------------------------------------------------------------------
187// TestSubDelReqRetransmission
188//
189// stub stub
190// +-------+ +---------+ +---------+
191// | xapp | | submgr | | e2term |
192// +-------+ +---------+ +---------+
193// | | |
194// | [SUBS CREATE] |
195// | | |
196// | | |
197// | SubDelReq | |
198// |------------->| |
199// | | |
200// | | SubDelReq |
201// | |------------->|
202// | | |
203// | SubDelReq | |
204// | (same sub) | |
205// | (same xid) | |
206// |------------->| |
207// | | |
208// | | SubDelResp |
209// | |<-------------|
210// | | |
211// | SubDelResp | |
212// |<-------------| |
213//
214//-----------------------------------------------------------------------------
215func TestSubDelReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200216 CaseBegin("TestSubDelReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200217
218 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200219 cretrans := xappConn1.SendSubsReq(t, nil, nil)
220 crereq, cremsg := e2termConn.RecvSubsReq(t)
221 e2termConn.SendSubsResp(t, crereq, cremsg)
222 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200223
224 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200225 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
226 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200227
228 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200229 xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200230 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
231
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200232 e2termConn.SendSubsDelResp(t, delreq, delmsg)
233 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200234
235 //Wait that subs is cleaned
236 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
237
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200238 xappConn1.TestMsgChanEmpty(t)
239 xappConn2.TestMsgChanEmpty(t)
240 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200241 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200242}
243
244//-----------------------------------------------------------------------------
245// TestSubDelReqCollision
246//
247// stub stub
248// +-------+ +---------+ +---------+
249// | xapp | | submgr | | e2term |
250// +-------+ +---------+ +---------+
251// | | |
252// | [SUBS CREATE] |
253// | | |
254// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200255// | SubDelReq 1 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200256// |------------->| |
257// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200258// | | SubDelReq 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200259// | |------------->|
260// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200261// | SubDelReq 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200262// | (same sub) | |
263// | (diff xid) | |
264// |------------->| |
265// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200266// | | SubDelResp 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200267// | |<-------------|
268// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200269// | SubDelResp 1 | |
270// |<-------------| |
271// | | |
272// | SubDelResp 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200273// |<-------------| |
274//
275//-----------------------------------------------------------------------------
Juha Hyttinen3944a222020-01-24 11:51:46 +0200276
Juha Hyttinenfa015662020-01-24 10:05:18 +0200277func TestSubDelReqCollision(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200278 CaseBegin("TestSubDelReqCollision")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200279
280 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200281 cretrans := xappConn1.SendSubsReq(t, nil, nil)
282 crereq, cremsg := e2termConn.RecvSubsReq(t)
283 e2termConn.SendSubsResp(t, crereq, cremsg)
284 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200285
286 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200287 xappConn1.SendSubsDelReq(t, nil, e2SubsId)
288 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200289
Juha Hyttinen3944a222020-01-24 11:51:46 +0200290 // Subs Delete colliding
Juha Hyttinenfa015662020-01-24 10:05:18 +0200291 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200292 deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
293 xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200294 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
295
Juha Hyttinen3944a222020-01-24 11:51:46 +0200296 // Del resp for first and second
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200297 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200298
299 // don't care in which order responses are received
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200300 xappConn1.RecvSubsDelResp(t, nil)
301 xappConn1.RecvSubsDelResp(t, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200302
303 //Wait that subs is cleaned
304 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
305
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200306 xappConn1.TestMsgChanEmpty(t)
307 xappConn2.TestMsgChanEmpty(t)
308 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200309 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200310}
311
312//-----------------------------------------------------------------------------
313// TestSubReqAndSubDelOkTwoParallel
314//
315// stub stub
316// +-------+ +---------+ +---------+
317// | xapp | | submgr | | e2term |
318// +-------+ +---------+ +---------+
319// | | |
320// | | |
321// | | |
322// | SubReq1 | |
323// |------------->| |
324// | | |
325// | | SubReq1 |
326// | |------------->|
327// | | |
328// | SubReq2 | |
329// |------------->| |
330// | | |
331// | | SubReq2 |
332// | |------------->|
333// | | |
334// | | SubResp1 |
335// | |<-------------|
336// | | SubResp2 |
337// | |<-------------|
338// | | |
339// | SubResp1 | |
340// |<-------------| |
341// | SubResp2 | |
342// |<-------------| |
343// | | |
344// | [SUBS 1 DELETE] |
345// | | |
346// | [SUBS 2 DELETE] |
347// | | |
348//
349//-----------------------------------------------------------------------------
350func TestSubReqAndSubDelOkTwoParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200351 CaseBegin("TestSubReqAndSubDelOkTwoParallel")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200352
353 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200354 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200355 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200356 rparams1.Req.EventTriggerDefinition.ProcedureCode = 5
357 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
358 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200359
360 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200361 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200362 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200363 rparams2.Req.EventTriggerDefinition.ProcedureCode = 28
364 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
365 crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200366
367 //Resp1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200368 e2termConn.SendSubsResp(t, crereq1, cremsg1)
369 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200370
371 //Resp2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200372 e2termConn.SendSubsResp(t, crereq2, cremsg2)
373 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200374
375 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200376 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
377 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
378 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
379 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200380 //Wait that subs is cleaned
381 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
382
383 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200384 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
385 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
386 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
387 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200388 //Wait that subs is cleaned
389 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
390
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200391 xappConn1.TestMsgChanEmpty(t)
392 xappConn2.TestMsgChanEmpty(t)
393 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200394 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200395}
396
397//-----------------------------------------------------------------------------
398// TestSameSubsDiffRan
399// Same subscription to different RANs
400//
401// stub stub
402// +-------+ +---------+ +---------+
403// | xapp | | submgr | | e2term |
404// +-------+ +---------+ +---------+
405// | | |
406// | | |
407// | | |
408// | SubReq(r1) | |
409// |------------->| |
410// | | |
411// | | SubReq(r1) |
412// | |------------->|
413// | | |
414// | | SubResp(r1) |
415// | |<-------------|
416// | | |
417// | SubResp(r1) | |
418// |<-------------| |
419// | | |
420// | SubReq(r2) | |
421// |------------->| |
422// | | |
423// | | SubReq(r2) |
424// | |------------->|
425// | | |
426// | | SubResp(r2) |
427// | |<-------------|
428// | | |
429// | SubResp(r2) | |
430// |<-------------| |
431// | | |
432// | [SUBS r1 DELETE] |
433// | | |
434// | [SUBS r2 DELETE] |
435// | | |
436//
437//-----------------------------------------------------------------------------
438func TestSameSubsDiffRan(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200439 CaseBegin("TestSameSubsDiffRan")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200440
441 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200442 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
443 xappConn1.SendSubsReq(t, nil, cretrans1)
444 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
445 e2termConn.SendSubsResp(t, crereq1, cremsg1)
446 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200447
448 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200449 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
450 xappConn1.SendSubsReq(t, nil, cretrans2)
451 crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
452 e2termConn.SendSubsResp(t, crereq2, cremsg2)
453 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200454
455 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200456 deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
457 xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1)
458 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
459 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
460 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200461 //Wait that subs is cleaned
462 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
463
464 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200465 deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
466 xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2)
467 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
468 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
469 xappConn1.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200470 //Wait that subs is cleaned
471 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
472
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200473 xappConn1.TestMsgChanEmpty(t)
474 xappConn2.TestMsgChanEmpty(t)
475 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200476 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200477}
478
479//-----------------------------------------------------------------------------
480// TestSubReqRetryInSubmgr
481//
482// stub stub
483// +-------+ +---------+ +---------+
484// | xapp | | submgr | | e2term |
485// +-------+ +---------+ +---------+
486// | | |
487// | SubReq | |
488// |------------->| |
489// | | |
490// | | SubReq |
491// | |------------->|
492// | | |
493// | | |
494// | | SubReq |
495// | |------------->|
496// | | |
497// | | SubResp |
498// | |<-------------|
499// | | |
500// | SubResp | |
501// |<-------------| |
502// | | |
503// | [SUBS DELETE] |
504// | | |
505//
506//-----------------------------------------------------------------------------
507
508func TestSubReqRetryInSubmgr(t *testing.T) {
509
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200510 CaseBegin("TestSubReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200511
512 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200513 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200514
515 // E2t: Receive 1st SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200516 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200517
518 // E2t: Receive 2nd SubsReq and send SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200519 crereq, cremsg := e2termConn.RecvSubsReq(t)
520 e2termConn.SendSubsResp(t, crereq, cremsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200521
522 // Xapp: Receive SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200523 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200524
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200525 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
526 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
527 e2termConn.SendSubsDelResp(t, delreq, delmsg)
528 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200529
530 // Wait that subs is cleaned
531 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
532
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200533 xappConn1.TestMsgChanEmpty(t)
534 xappConn2.TestMsgChanEmpty(t)
535 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200536 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200537}
538
539//-----------------------------------------------------------------------------
540// TestSubReqTwoRetriesNoRespSubDelRespInSubmgr
541//
542// stub stub
543// +-------+ +---------+ +---------+
544// | xapp | | submgr | | e2term |
545// +-------+ +---------+ +---------+
546// | | |
547// | SubReq | |
548// |------------->| |
549// | | |
550// | | SubReq |
551// | |------------->|
552// | | |
553// | | |
554// | | SubReq |
555// | |------------->|
556// | | |
557// | | SubDelReq |
558// | |------------->|
559// | | |
560// | | |
561// | | SubDelReq |
562// | |------------->|
563// | | |
564// | | |
565// | | SubDelResp |
566// | |<-------------|
567// | | |
568//
569//-----------------------------------------------------------------------------
570
571func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
572
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200573 CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200574
575 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200576 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200577
578 // E2t: Receive 1st SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200579 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200580
581 // E2t: Receive 2nd SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200582 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200583
584 // E2t: Send receive SubsDelReq and send SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200585 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
586 e2termConn.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200587
588 // Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +0200589 mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200590
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200591 xappConn1.TestMsgChanEmpty(t)
592 xappConn2.TestMsgChanEmpty(t)
593 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200594 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200595}
596
597//-----------------------------------------------------------------------------
598// TestSubReqTwoRetriesNoRespAtAllInSubmgr
599//
600// stub stub
601// +-------+ +---------+ +---------+
602// | xapp | | submgr | | e2term |
603// +-------+ +---------+ +---------+
604// | | |
605// | SubReq | |
606// |------------->| |
607// | | |
608// | | SubReq |
609// | |------------->|
610// | | |
611// | | |
612// | | SubReq |
613// | |------------->|
614// | | |
615// | | SubDelReq |
616// | |------------->|
617// | | |
618// | | |
619// | | SubDelReq |
620// | |------------->|
621// | | |
622// | | |
623//
624//-----------------------------------------------------------------------------
625
626func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) {
627
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200628 CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200629
630 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200631 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200632
633 // E2t: Receive 1st SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200634 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200635
636 // E2t: Receive 2nd SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200637 e2termConn.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200638
639 // E2t: Receive 1st SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200640 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200641
642 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200643 delreq, _ := e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200644
645 // Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +0200646 mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200647
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200648 xappConn1.TestMsgChanEmpty(t)
649 xappConn2.TestMsgChanEmpty(t)
650 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200651 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200652}
653
654//-----------------------------------------------------------------------------
655// TestSubReqSubFailRespInSubmgr
656//
657// stub stub
658// +-------+ +---------+ +---------+
659// | xapp | | submgr | | e2term |
660// +-------+ +---------+ +---------+
661// | | |
662// | SubReq | |
663// |------------->| |
664// | | |
665// | | SubReq |
666// | |------------->|
667// | | |
668// | | SubFail |
669// | |<-------------|
670// | | |
671// | SubFail | |
672// |<-------------| |
673// | | |
674//
675//-----------------------------------------------------------------------------
676
677func TestSubReqSubFailRespInSubmgr(t *testing.T) {
678
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200679 CaseBegin("TestSubReqSubFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200680
681 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200682 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200683
684 // E2t: Receive SubsReq and send SubsFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200685 crereq, cremsg := e2termConn.RecvSubsReq(t)
686 fparams := &teststube2ap.E2StubSubsFailParams{}
Juha Hyttinenfa015662020-01-24 10:05:18 +0200687 fparams.Set(crereq)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200688 e2termConn.SendSubsFail(t, fparams, cremsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200689
690 // Xapp: Receive SubsFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200691 e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200692
693 // Wait that subs is cleaned
694 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
695
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200696 xappConn1.TestMsgChanEmpty(t)
697 xappConn2.TestMsgChanEmpty(t)
698 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200699 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200700}
701
702//-----------------------------------------------------------------------------
703// TestSubDelReqRetryInSubmgr
704//
705// stub stub
706// +-------+ +---------+ +---------+
707// | xapp | | submgr | | e2term |
708// +-------+ +---------+ +---------+
709// | | |
710// | [SUBS CREATE] |
711// | | |
712// | | |
713// | SubDelReq | |
714// |------------->| |
715// | | |
716// | | SubDelReq |
717// | |------------->|
718// | | |
719// | | SubDelReq |
720// | |------------->|
721// | | |
722// | | SubDelResp |
723// | |<-------------|
724// | | |
725// | SubDelResp | |
726// |<-------------| |
727//
728//-----------------------------------------------------------------------------
729
730func TestSubDelReqRetryInSubmgr(t *testing.T) {
731
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200732 CaseBegin("TestSubDelReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200733
734 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200735 cretrans := xappConn1.SendSubsReq(t, nil, nil)
736 crereq, cremsg := e2termConn.RecvSubsReq(t)
737 e2termConn.SendSubsResp(t, crereq, cremsg)
738 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200739
740 // Subs Delete
741 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200742 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200743
744 // E2t: Receive 1st SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200745 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200746
747 // E2t: Receive 2nd SubsDelReq and send SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200748 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
749 e2termConn.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200750
751 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200752 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200753
754 // Wait that subs is cleaned
755 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
756
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200757 xappConn1.TestMsgChanEmpty(t)
758 xappConn2.TestMsgChanEmpty(t)
759 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200760 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200761}
762
763//-----------------------------------------------------------------------------
764// TestSubDelReqTwoRetriesNoRespInSubmgr
765//
766// stub stub
767// +-------+ +---------+ +---------+
768// | xapp | | submgr | | e2term |
769// +-------+ +---------+ +---------+
770// | | |
771// | [SUBS CREATE] |
772// | | |
773// | | |
774// | SubDelReq | |
775// |------------->| |
776// | | |
777// | | SubDelReq |
778// | |------------->|
779// | | |
780// | | SubDelReq |
781// | |------------->|
782// | | |
783// | | |
784// | SubDelResp | |
785// |<-------------| |
786//
787//-----------------------------------------------------------------------------
788
789func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) {
790
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200791 CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200792
793 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200794 cretrans := xappConn1.SendSubsReq(t, nil, nil)
795 crereq, cremsg := e2termConn.RecvSubsReq(t)
796 e2termConn.SendSubsResp(t, crereq, cremsg)
797 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200798
799 // Subs Delete
800 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200801 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200802
803 // E2t: Receive 1st SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200804 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200805
806 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200807 e2termConn.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200808
809 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200810 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200811
812 // Wait that subs is cleaned
813 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
814
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200815 xappConn1.TestMsgChanEmpty(t)
816 xappConn2.TestMsgChanEmpty(t)
817 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200818 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200819}
820
821//-----------------------------------------------------------------------------
822// TestSubDelReqSubDelFailRespInSubmgr
823//
824// stub stub
825// +-------+ +---------+ +---------+
826// | xapp | | submgr | | e2term |
827// +-------+ +---------+ +---------+
828// | | |
829// | [SUBS CREATE] |
830// | | |
831// | | |
832// | SubDelReq | |
833// |------------->| |
834// | | |
835// | | SubDelReq |
836// | |------------->|
837// | | |
838// | | SubDelFail |
839// | |<-------------|
840// | | |
841// | SubDelResp | |
842// |<-------------| |
843// | | |
844//
845//-----------------------------------------------------------------------------
846
847func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) {
848
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200849 CaseBegin("TestSubReqSubDelFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200850
851 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200852 cretrans := xappConn1.SendSubsReq(t, nil, nil)
853 crereq, cremsg := e2termConn.RecvSubsReq(t)
854 e2termConn.SendSubsResp(t, crereq, cremsg)
855 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200856
857 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200858 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200859
860 // E2t: Send receive SubsDelReq and send SubsDelFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200861 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
862 e2termConn.SendSubsDelFail(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200863
864 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200865 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200866
867 // Wait that subs is cleaned
868 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
869
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200870 xappConn1.TestMsgChanEmpty(t)
871 xappConn2.TestMsgChanEmpty(t)
872 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200873 mainCtrl.wait_registry_empty(t, 10)
874}
875
876//-----------------------------------------------------------------------------
877// TestSubReqAndSubDelOkSameAction
878//
879// stub stub
880// +-------+ +---------+ +---------+
881// | xapp | | submgr | | e2term |
882// +-------+ +---------+ +---------+
883// | | |
884// | | |
885// | | |
886// | SubReq1 | |
887// |------------->| |
888// | | |
889// | | SubReq1 |
890// | |------------->|
891// | | SubResp1 |
892// | |<-------------|
893// | SubResp1 | |
894// |<-------------| |
895// | | |
896// | SubReq2 | |
897// |------------->| |
898// | | |
899// | SubResp2 | |
900// |<-------------| |
901// | | |
902// | SubDelReq 1 | |
903// |------------->| |
904// | | |
905// | SubDelResp 1 | |
906// |<-------------| |
907// | | |
908// | SubDelReq 2 | |
909// |------------->| |
910// | | |
911// | | SubDelReq 2 |
912// | |------------->|
913// | | |
914// | | SubDelReq 2 |
915// | |------------->|
916// | | |
917// | SubDelResp 2 | |
918// |<-------------| |
919//
920//-----------------------------------------------------------------------------
921func TestSubReqAndSubDelOkSameAction(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200922 CaseBegin("TestSubReqAndSubDelOkSameAction")
Juha Hyttinen3944a222020-01-24 11:51:46 +0200923
924 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200925 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200926 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200927 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
928 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
929 e2termConn.SendSubsResp(t, crereq1, cremsg1)
930 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200931
932 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200933 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200934 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200935 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
936 //crereq2, cremsg2 := e2termConn.RecvSubsReq(t)
937 //e2termConn.SendSubsResp(t, crereq2, cremsg2)
938 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200939
940 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200941 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
942 //e2termConn.RecvSubsDelReq(t)
943 //e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
944 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200945 //Wait that subs is cleaned
946 //mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
947
948 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200949 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
950 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
951 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
952 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200953 //Wait that subs is cleaned
954 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
955
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200956 xappConn1.TestMsgChanEmpty(t)
957 xappConn2.TestMsgChanEmpty(t)
958 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200959 mainCtrl.wait_registry_empty(t, 10)
960}
961
962//-----------------------------------------------------------------------------
963// TestSubReqAndSubDelOkSameActionParallel
964//
965// stub stub
966// +-------+ +---------+ +---------+
967// | xapp | | submgr | | e2term |
968// +-------+ +---------+ +---------+
969// | | |
970// | | |
971// | | |
972// | SubReq1 | |
973// |------------->| |
974// | | |
975// | | SubReq1 |
976// | |------------->|
977// | SubReq2 | |
978// |------------->| |
979// | | SubResp1 |
980// | |<-------------|
981// | SubResp1 | |
982// |<-------------| |
983// | | |
984// | SubResp2 | |
985// |<-------------| |
986// | | |
987// | SubDelReq 1 | |
988// |------------->| |
989// | | |
990// | SubDelResp 1 | |
991// |<-------------| |
992// | | |
993// | SubDelReq 2 | |
994// |------------->| |
995// | | |
996// | | SubDelReq 2 |
997// | |------------->|
998// | | |
999// | | SubDelReq 2 |
1000// | |------------->|
1001// | | |
1002// | SubDelResp 2 | |
1003// |<-------------| |
1004//
1005//-----------------------------------------------------------------------------
1006func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001007 CaseBegin("TestSubReqAndSubDelOkSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001008
1009 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001010 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001011 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001012 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
1013 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001014
1015 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001016 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001017 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001018 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001019
1020 //Resp1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001021 e2termConn.SendSubsResp(t, crereq1, cremsg1)
1022 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001023
1024 //Resp2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001025 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001026
1027 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001028 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1029 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001030
1031 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001032 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
1033 delreq2, delmsg2 := e2termConn.RecvSubsDelReq(t)
1034 e2termConn.SendSubsDelResp(t, delreq2, delmsg2)
1035 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001036
1037 //Wait that subs is cleaned
1038 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1039
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001040 xappConn1.TestMsgChanEmpty(t)
1041 xappConn2.TestMsgChanEmpty(t)
1042 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001043 mainCtrl.wait_registry_empty(t, 10)
1044}
1045
1046//-----------------------------------------------------------------------------
1047// TestSubReqAndSubDelNokSameActionParallel
1048//
1049// stub stub
1050// +-------+ +---------+ +---------+
1051// | xapp | | submgr | | e2term |
1052// +-------+ +---------+ +---------+
1053// | | |
1054// | | |
1055// | | |
1056// | SubReq1 | |
1057// |------------->| |
1058// | | |
1059// | | SubReq1 |
1060// | |------------->|
1061// | SubReq2 | |
1062// |------------->| |
1063// | | SubFail1 |
1064// | |<-------------|
1065// | SubFail1 | |
1066// |<-------------| |
1067// | | |
1068// | SubFail2 | |
1069// |<-------------| |
1070//
1071//-----------------------------------------------------------------------------
1072func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001073 CaseBegin("TestSubReqAndSubDelNokSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001074
1075 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001076 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001077 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001078 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
1079 crereq1, cremsg1 := e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001080
1081 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001082 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001083 rparams2.Init()
1084 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001085 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001086 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1087
1088 //E2T Fail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001089 fparams := &teststube2ap.E2StubSubsFailParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001090 fparams.Set(crereq1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001091 e2termConn.SendSubsFail(t, fparams, cremsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001092
1093 //Fail1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001094 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001095 //Fail2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001096 xappConn2.RecvSubsFail(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001097
1098 //Wait that subs is cleaned
1099 mainCtrl.wait_subs_clean(t, e2SubsId1, 15)
1100
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001101 xappConn1.TestMsgChanEmpty(t)
1102 xappConn2.TestMsgChanEmpty(t)
1103 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001104 mainCtrl.wait_registry_empty(t, 10)
1105}
1106
1107//-----------------------------------------------------------------------------
1108// TestSubReqAndSubDelNoAnswerSameActionParallel
1109//
1110// stub stub
1111// +-------+ +---------+ +---------+
1112// | xapp | | submgr | | e2term |
1113// +-------+ +---------+ +---------+
1114// | | |
1115// | | |
1116// | | |
1117// | SubReq1 | |
1118// |------------->| |
1119// | | |
1120// | | SubReq1 |
1121// | |------------->|
1122// | SubReq2 | |
1123// |------------->| |
1124// | | |
1125// | | SubReq1 |
1126// | |------------->|
1127// | | |
1128// | | |
1129// | | SubDelReq |
1130// | |------------->|
1131// | | |
1132// | | SubDelResp |
1133// | |<-------------|
1134//
1135//-----------------------------------------------------------------------------
1136func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001137 CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001138
1139 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001140 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001141 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001142 xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001143
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001144 e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001145
1146 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001147 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001148 rparams2.Init()
1149 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001150 xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001151 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1152
1153 //Req1 (retransmitted)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001154 e2termConn.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001155
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001156 delreq1, delmsg1 := e2termConn.RecvSubsDelReq(t)
1157 e2termConn.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001158
1159 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +02001160 mainCtrl.wait_subs_clean(t, delreq1.RequestId.Seq, 10)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001161
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001162 xappConn1.TestMsgChanEmpty(t)
1163 xappConn2.TestMsgChanEmpty(t)
1164 e2termConn.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001165 mainCtrl.wait_registry_empty(t, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001166}
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001167
1168//----------------------------- Policy cases ---------------------------------
1169//-----------------------------------------------------------------------------
1170// TestSubReqPolicyAndSubDelOk
1171//
1172// stub stub
1173// +-------+ +---------+ +---------+
1174// | xapp | | submgr | | e2term |
1175// +-------+ +---------+ +---------+
1176// | | |
1177// | SubReq | |
1178// |------------->| |
1179// | | |
1180// | | SubReq |
1181// | |------------->|
1182// | | |
1183// | | SubResp |
1184// | |<-------------|
1185// | | |
1186// | SubResp | |
1187// |<-------------| |
1188// | | |
1189// | | |
1190// | SubDelReq | |
1191// |------------->| |
1192// | | |
1193// | | SubDelReq |
1194// | |------------->|
1195// | | |
1196// | | SubDelResp |
1197// | |<-------------|
1198// | | |
1199// | SubDelResp | |
1200// |<-------------| |
1201//
1202//-----------------------------------------------------------------------------
1203func TestSubReqPolicyAndSubDelOk(t *testing.T) {
1204 CaseBegin("TestSubReqAndSubDelOk")
1205
1206 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1207 rparams1.Init()
1208 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1209 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
1210
1211 crereq, cremsg := e2termConn.RecvSubsReq(t)
1212 e2termConn.SendSubsResp(t, crereq, cremsg)
1213 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1214 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
1215 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
1216
1217 waiter := rtmgrHttp.AllocNextEvent(true)
1218 e2termConn.SendSubsDelResp(t, delreq, delmsg)
1219 xappConn1.RecvSubsDelResp(t, deltrans)
1220 waiter.WaitResult(t)
1221
1222 //Wait that subs is cleaned
1223 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1224
1225 xappConn1.TestMsgChanEmpty(t)
1226 xappConn2.TestMsgChanEmpty(t)
1227 e2termConn.TestMsgChanEmpty(t)
1228 mainCtrl.wait_registry_empty(t, 10)
1229}
1230
1231//-----------------------------------------------------------------------------
1232// TestSubReqPolicyChangeAndSubDelOk
1233//
1234// stub stub
1235// +-------+ +---------+ +---------+
1236// | xapp | | submgr | | e2term |
1237// +-------+ +---------+ +---------+
1238// | | |
1239// | SubReq | |
1240// |------------->| |
1241// | | |
1242// | | SubReq |
1243// | |------------->|
1244// | | |
1245// | | SubResp |
1246// | |<-------------|
1247// | | |
1248// | SubResp | |
1249// |<-------------| |
1250// | | |
1251// | SubReq | |
1252// |------------->| |
1253// | | |
1254// | | SubReq |
1255// | |------------->|
1256// | | |
1257// | | SubResp |
1258// | |<-------------|
1259// | | |
1260// | SubResp | |
1261// |<-------------| |
1262// | | |
1263// | SubDelReq | |
1264// |------------->| |
1265// | | |
1266// | | SubDelReq |
1267// | |------------->|
1268// | | |
1269// | | SubDelResp |
1270// | |<-------------|
1271// | | |
1272// | SubDelResp | |
1273// |<-------------| |
1274//
1275//-----------------------------------------------------------------------------
1276
1277func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) {
1278 CaseBegin("TestSubReqAndSubDelOk")
1279
1280 waiter := rtmgrHttp.AllocNextEvent(true)
1281 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1282 rparams1.Init()
1283 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1284 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
1285 waiter.WaitResult(t)
1286
1287 crereq, cremsg := e2termConn.RecvSubsReq(t)
1288 e2termConn.SendSubsResp(t, crereq, cremsg)
1289 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1290
1291 //Policy change
1292 rparams1.Req.RequestId.Seq = e2SubsId
1293 rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms
1294 xappConn1.SendSubsReq(t, rparams1, cretrans)
1295
1296 crereq, cremsg = e2termConn.RecvSubsReq(t)
1297 e2termConn.SendSubsResp(t, crereq, cremsg)
1298 e2SubsId = xappConn1.RecvSubsResp(t, cretrans)
1299 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
1300 delreq, delmsg := e2termConn.RecvSubsDelReq(t)
1301
1302 waiter = rtmgrHttp.AllocNextEvent(true)
1303 e2termConn.SendSubsDelResp(t, delreq, delmsg)
1304 xappConn1.RecvSubsDelResp(t, deltrans)
1305 waiter.WaitResult(t)
1306
1307 //Wait that subs is cleaned
1308 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1309
1310 xappConn1.TestMsgChanEmpty(t)
1311 xappConn2.TestMsgChanEmpty(t)
1312 e2termConn.TestMsgChanEmpty(t)
1313 mainCtrl.wait_registry_empty(t, 10)
1314}