blob: 53d8a85e6be6d498760e7fdfc88175a2b08951e3 [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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +020064 e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200109 crereq, cremsg := e2termConn1.RecvSubsReq(t)
110 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200111 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
112 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200113 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200114
115 waiter = rtmgrHttp.AllocNextEvent(true)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200116 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200117 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200125 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200162 crereq, cremsg := e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200168 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200169 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200173 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
174 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200175 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200182 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200220 crereq, cremsg := e2termConn1.RecvSubsReq(t)
221 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200222 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200226 delreq, delmsg := e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200232 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200233 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200240 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200282 crereq, cremsg := e2termConn1.RecvSubsReq(t)
283 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200284 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200288 delreq1, delmsg1 := e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200297 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200308 e2termConn1.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//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200315// stub stub stub
316// +-------+ +-------+ +---------+ +---------+
317// | xapp | | 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// | | SubResp1 | |
337// | |<-------------| |
338// | | | |
339// | | | SubResp2 |
340// | | |<-------------|
341// | SubResp2 | |
342// |<------------------------| |
343// | | | |
344// | | [SUBS 1 DELETE] |
345// | | | |
346// | | [SUBS 2 DELETE] |
347// | | | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200348//
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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200358 crereq1, cremsg1 := e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200365 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200366
367 //Resp1
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200368 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200369 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200370
371 //Resp2
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200372 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200373 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200377 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
378 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200379 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200385 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
386 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200387 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200393 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200444 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
445 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200446 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200451 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
452 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200453 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200458 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
459 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200460 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200467 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
468 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200469 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200475 e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200516 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200517
518 // E2t: Receive 2nd SubsReq and send SubsResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200519 crereq, cremsg := e2termConn1.RecvSubsReq(t)
520 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200526 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
527 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200528 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200535 e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200579 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200580
581 // E2t: Receive 2nd SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200582 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200583
584 // E2t: Send receive SubsDelReq and send SubsResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200585 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
586 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200593 e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200634 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200635
636 // E2t: Receive 2nd SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200637 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200638
639 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200640 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200641
642 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200643 delreq, _ := e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200650 e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +0200685 crereq, cremsg := e2termConn1.RecvSubsReq(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200686 fparams := &teststube2ap.E2StubSubsFailParams{}
Juha Hyttinenfa015662020-01-24 10:05:18 +0200687 fparams.Set(crereq)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200688 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200698 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200736 crereq, cremsg := e2termConn1.RecvSubsReq(t)
737 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200738 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 Hyttinen896c3ac2020-02-24 12:49:20 +0200745 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200746
747 // E2t: Receive 2nd SubsDelReq and send SubsDelResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200748 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
749 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200759 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200795 crereq, cremsg := e2termConn1.RecvSubsReq(t)
796 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200797 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 Hyttinen896c3ac2020-02-24 12:49:20 +0200804 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200805
806 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200807 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200817 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200853 crereq, cremsg := e2termConn1.RecvSubsReq(t)
854 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200855 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 Hyttinen896c3ac2020-02-24 12:49:20 +0200861 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
862 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200872 e2termConn1.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
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200880// +-------+ +-------+ +---------+ +---------+
881// | xapp2 | | xapp1 | | 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// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200919//
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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200928 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
929 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200930 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200936 //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
937 //e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200938 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200942 //e2termConn1.RecvSubsDelReq(t)
943 //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200944 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200950 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
951 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200952 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200958 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200959 mainCtrl.wait_registry_empty(t, 10)
960}
961
962//-----------------------------------------------------------------------------
963// TestSubReqAndSubDelOkSameActionParallel
964//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200965// stub stub stub
966// +-------+ +-------+ +---------+ +---------+
967// | xapp2 | | xapp1 | | 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// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001004//
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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001013 crereq1, cremsg1 := e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +02001021 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001022 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001033 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
1034 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001035 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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001042 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001043 mainCtrl.wait_registry_empty(t, 10)
1044}
1045
1046//-----------------------------------------------------------------------------
1047// TestSubReqAndSubDelNokSameActionParallel
1048//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001049// stub stub stub
1050// +-------+ +-------+ +---------+ +---------+
1051// | xapp2 | | xapp1 | | 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// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001070//
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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001079 crereq1, cremsg1 := e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +02001091 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001103 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001104 mainCtrl.wait_registry_empty(t, 10)
1105}
1106
1107//-----------------------------------------------------------------------------
1108// TestSubReqAndSubDelNoAnswerSameActionParallel
1109//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001110// stub stub stub
1111// +-------+ +-------+ +---------+ +---------+
1112// | xapp2 | | xapp1 | | 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// | | |<-------------|
Juha Hyttinen3944a222020-01-24 11:51:46 +02001134//
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 Hyttinen896c3ac2020-02-24 12:49:20 +02001144 e2termConn1.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 Hyttinen896c3ac2020-02-24 12:49:20 +02001154 e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001155
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001156 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1157 e2termConn1.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)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001164 e2termConn1.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
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001211 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1212 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001213 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1214 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001215 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001216
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001217 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001218 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001219
1220 //Wait that subs is cleaned
1221 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1222
1223 xappConn1.TestMsgChanEmpty(t)
1224 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001225 e2termConn1.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001226 mainCtrl.wait_registry_empty(t, 10)
1227}
1228
1229//-----------------------------------------------------------------------------
1230// TestSubReqPolicyChangeAndSubDelOk
1231//
1232// stub stub
1233// +-------+ +---------+ +---------+
1234// | xapp | | submgr | | e2term |
1235// +-------+ +---------+ +---------+
1236// | | |
1237// | SubReq | |
1238// |------------->| |
1239// | | |
1240// | | SubReq |
1241// | |------------->|
1242// | | |
1243// | | SubResp |
1244// | |<-------------|
1245// | | |
1246// | SubResp | |
1247// |<-------------| |
1248// | | |
1249// | SubReq | |
1250// |------------->| |
1251// | | |
1252// | | SubReq |
1253// | |------------->|
1254// | | |
1255// | | SubResp |
1256// | |<-------------|
1257// | | |
1258// | SubResp | |
1259// |<-------------| |
1260// | | |
1261// | SubDelReq | |
1262// |------------->| |
1263// | | |
1264// | | SubDelReq |
1265// | |------------->|
1266// | | |
1267// | | SubDelResp |
1268// | |<-------------|
1269// | | |
1270// | SubDelResp | |
1271// |<-------------| |
1272//
1273//-----------------------------------------------------------------------------
1274
1275func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) {
1276 CaseBegin("TestSubReqAndSubDelOk")
1277
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001278 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1279 rparams1.Init()
1280 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1281 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001282
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001283 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1284 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001285 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1286
1287 //Policy change
1288 rparams1.Req.RequestId.Seq = e2SubsId
1289 rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms
1290 xappConn1.SendSubsReq(t, rparams1, cretrans)
1291
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001292 crereq, cremsg = e2termConn1.RecvSubsReq(t)
1293 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001294 e2SubsId = xappConn1.RecvSubsResp(t, cretrans)
1295 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001296 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001297
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001298 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001299 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001300
1301 //Wait that subs is cleaned
1302 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1303
1304 xappConn1.TestMsgChanEmpty(t)
1305 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001306 e2termConn1.TestMsgChanEmpty(t)
1307 mainCtrl.wait_registry_empty(t, 10)
1308}
1309
1310//-----------------------------------------------------------------------------
1311// TestSubReqAndSubDelOkTwoE2termParallel
1312//
1313// stub stub stub
1314// +-------+ +---------+ +---------+ +---------+
1315// | xapp | | submgr | | e2term1 | | e2term2 |
1316// +-------+ +---------+ +---------+ +---------+
1317// | | | |
1318// | | | |
1319// | | | |
1320// | SubReq1 | | |
1321// |------------->| | |
1322// | | | |
1323// | | SubReq1 | |
1324// | |------------->| |
1325// | | | |
1326// | SubReq2 | | |
1327// |------------->| | |
1328// | | | |
1329// | | SubReq2 | |
1330// | |---------------------------->|
1331// | | | |
1332// | | SubResp1 | |
1333// | |<-------------| |
1334// | SubResp1 | | |
1335// |<-------------| | |
1336// | | SubResp2 | |
1337// | |<----------------------------|
1338// | SubResp2 | | |
1339// |<-------------| | |
1340// | | | |
1341// | [SUBS 1 DELETE] | |
1342// | | | |
1343// | [SUBS 2 DELETE] | |
1344// | | | |
1345//
1346//-----------------------------------------------------------------------------
1347func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) {
1348 CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel")
1349
1350 //Req1
1351 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
1352 xappConn1.SendSubsReq(t, nil, cretrans1)
1353 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
1354
1355 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11")
1356 xappConn1.SendSubsReq(t, nil, cretrans2)
1357 crereq2, cremsg2 := e2termConn2.RecvSubsReq(t)
1358
1359 //Resp1
1360 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
1361 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
1362
1363 //Resp2
1364 e2termConn2.SendSubsResp(t, crereq2, cremsg2)
1365 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
1366
1367 //Del1
1368 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1369 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1370 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
1371 xappConn1.RecvSubsDelResp(t, deltrans1)
1372 //Wait that subs is cleaned
1373 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
1374
1375 //Del2
1376 deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2)
1377 delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t)
1378 e2termConn2.SendSubsDelResp(t, delreq2, delmsg2)
1379 xappConn1.RecvSubsDelResp(t, deltrans2)
1380 //Wait that subs is cleaned
1381 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1382
1383 xappConn1.TestMsgChanEmpty(t)
1384 xappConn2.TestMsgChanEmpty(t)
1385 e2termConn1.TestMsgChanEmpty(t)
1386 e2termConn2.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001387 mainCtrl.wait_registry_empty(t, 10)
1388}