blob: a9339c2a0302b8561c53fce5a3657cb66b2cc357 [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 Hyttinenc9eb08a2020-02-28 08:53:33 +020025 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
26 "github.com/stretchr/testify/assert"
Juha Hyttinenfa015662020-01-24 10:05:18 +020027 "testing"
28)
29
30//-----------------------------------------------------------------------------
31// TestSubReqAndRouteNok
32//
33// stub stub
34// +-------+ +---------+ +---------+
35// | xapp | | submgr | | rtmgr |
36// +-------+ +---------+ +---------+
37// | | |
38// | SubReq | |
39// |------------->| |
40// | | |
41// | | RouteCreate |
42// | |------------->|
43// | | |
44// | | RouteCreate |
45// | | status:400 |
46// | |<-------------|
47// | | |
48// | [SUBS INT DELETE] |
49// | | |
50//
51//-----------------------------------------------------------------------------
52
53func TestSubReqAndRouteNok(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020054 CaseBegin("TestSubReqAndRouteNok")
Juha Hyttinenfa015662020-01-24 10:05:18 +020055
56 waiter := rtmgrHttp.AllocNextEvent(false)
57 newSubsId := mainCtrl.get_subid(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020058 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +020059 waiter.WaitResult(t)
60
61 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +020062 mainCtrl.wait_subs_clean(t, newSubsId, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020063
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020064 xappConn1.TestMsgChanEmpty(t)
65 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +020066 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +020067 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020068}
69
70//-----------------------------------------------------------------------------
71// TestSubReqAndSubDelOk
72//
73// stub stub
74// +-------+ +---------+ +---------+
75// | xapp | | submgr | | e2term |
76// +-------+ +---------+ +---------+
77// | | |
78// | SubReq | |
79// |------------->| |
80// | | |
81// | | SubReq |
82// | |------------->|
83// | | |
84// | | SubResp |
85// | |<-------------|
86// | | |
87// | SubResp | |
88// |<-------------| |
89// | | |
90// | | |
91// | SubDelReq | |
92// |------------->| |
93// | | |
94// | | SubDelReq |
95// | |------------->|
96// | | |
97// | | SubDelResp |
98// | |<-------------|
99// | | |
100// | SubDelResp | |
101// |<-------------| |
102//
103//-----------------------------------------------------------------------------
104func TestSubReqAndSubDelOk(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200105 CaseBegin("TestSubReqAndSubDelOk")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200106
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200107 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200108
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)
Juha Hyttinenc9eb08a2020-02-28 08:53:33 +0200112
113 resp, _ := xapp.Subscription.QuerySubscriptions()
114 assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId))
115 assert.Equal(t, resp[0].Meid, "RAN_NAME_1")
116 assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"})
117
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200118 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200119 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200120
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200121 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200122 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200123
124 //Wait that subs is cleaned
125 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
126
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200127 xappConn1.TestMsgChanEmpty(t)
128 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200129 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200130 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200131}
132
133//-----------------------------------------------------------------------------
134// TestSubReqRetransmission
135//
136// stub stub
137// +-------+ +---------+ +---------+
138// | xapp | | submgr | | e2term |
139// +-------+ +---------+ +---------+
140// | | |
141// | SubReq | |
142// |------------->| |
143// | | |
144// | | SubReq |
145// | |------------->|
146// | | |
147// | SubReq | |
148// | (retrans) | |
149// |------------->| |
150// | | |
151// | | SubResp |
152// | |<-------------|
153// | | |
154// | SubResp | |
155// |<-------------| |
156// | | |
157// | [SUBS DELETE] |
158// | | |
159//
160//-----------------------------------------------------------------------------
161func TestSubReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200162 CaseBegin("TestSubReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200163
164 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200165 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200166 crereq, cremsg := e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200167
168 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200169 xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200170 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
171
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200172 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200173 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200174
175 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200176 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200177 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
178 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200179 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200180
181 //Wait that subs is cleaned
182 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
183
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200184 xappConn1.TestMsgChanEmpty(t)
185 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200186 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200187 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200188}
189
190//-----------------------------------------------------------------------------
191// TestSubDelReqRetransmission
192//
193// stub stub
194// +-------+ +---------+ +---------+
195// | xapp | | submgr | | e2term |
196// +-------+ +---------+ +---------+
197// | | |
198// | [SUBS CREATE] |
199// | | |
200// | | |
201// | SubDelReq | |
202// |------------->| |
203// | | |
204// | | SubDelReq |
205// | |------------->|
206// | | |
207// | SubDelReq | |
208// | (same sub) | |
209// | (same xid) | |
210// |------------->| |
211// | | |
212// | | SubDelResp |
213// | |<-------------|
214// | | |
215// | SubDelResp | |
216// |<-------------| |
217//
218//-----------------------------------------------------------------------------
219func TestSubDelReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200220 CaseBegin("TestSubDelReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200221
222 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200223 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200224 crereq, cremsg := e2termConn1.RecvSubsReq(t)
225 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200226 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200227
228 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200229 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200230 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200231
232 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200233 xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200234 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
235
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200236 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200237 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200238
239 //Wait that subs is cleaned
240 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
241
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200242 xappConn1.TestMsgChanEmpty(t)
243 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200244 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200245 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200246}
247
248//-----------------------------------------------------------------------------
249// TestSubDelReqCollision
250//
251// stub stub
252// +-------+ +---------+ +---------+
253// | xapp | | submgr | | e2term |
254// +-------+ +---------+ +---------+
255// | | |
256// | [SUBS CREATE] |
257// | | |
258// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200259// | SubDelReq 1 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200260// |------------->| |
261// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200262// | | SubDelReq 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200263// | |------------->|
264// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200265// | SubDelReq 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200266// | (same sub) | |
267// | (diff xid) | |
268// |------------->| |
269// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200270// | | SubDelResp 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200271// | |<-------------|
272// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200273// | SubDelResp 1 | |
274// |<-------------| |
275// | | |
276// | SubDelResp 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200277// |<-------------| |
278//
279//-----------------------------------------------------------------------------
Juha Hyttinen3944a222020-01-24 11:51:46 +0200280
Juha Hyttinenfa015662020-01-24 10:05:18 +0200281func TestSubDelReqCollision(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200282 CaseBegin("TestSubDelReqCollision")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200283
284 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200285 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200286 crereq, cremsg := e2termConn1.RecvSubsReq(t)
287 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200288 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200289
290 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200291 xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200292 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200293
Juha Hyttinen3944a222020-01-24 11:51:46 +0200294 // Subs Delete colliding
Juha Hyttinenfa015662020-01-24 10:05:18 +0200295 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200296 deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
297 xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200298 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
299
Juha Hyttinen3944a222020-01-24 11:51:46 +0200300 // Del resp for first and second
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200301 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200302
303 // don't care in which order responses are received
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200304 xappConn1.RecvSubsDelResp(t, nil)
305 xappConn1.RecvSubsDelResp(t, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200306
307 //Wait that subs is cleaned
308 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
309
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200310 xappConn1.TestMsgChanEmpty(t)
311 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200312 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200313 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200314}
315
316//-----------------------------------------------------------------------------
317// TestSubReqAndSubDelOkTwoParallel
318//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200319// stub stub stub
320// +-------+ +-------+ +---------+ +---------+
321// | xapp | | xapp | | submgr | | e2term |
322// +-------+ +-------+ +---------+ +---------+
323// | | | |
324// | | | |
325// | | | |
326// | | SubReq1 | |
327// | |------------->| |
328// | | | |
329// | | | SubReq1 |
330// | | |------------->|
331// | | | |
332// | SubReq2 | |
333// |------------------------>| |
334// | | | |
335// | | | SubReq2 |
336// | | |------------->|
337// | | | |
338// | | | SubResp1 |
339// | | |<-------------|
340// | | SubResp1 | |
341// | |<-------------| |
342// | | | |
343// | | | SubResp2 |
344// | | |<-------------|
345// | SubResp2 | |
346// |<------------------------| |
347// | | | |
348// | | [SUBS 1 DELETE] |
349// | | | |
350// | | [SUBS 2 DELETE] |
351// | | | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200352//
353//-----------------------------------------------------------------------------
354func TestSubReqAndSubDelOkTwoParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200355 CaseBegin("TestSubReqAndSubDelOkTwoParallel")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200356
357 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200358 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200359 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200360 rparams1.Req.EventTriggerDefinition.ProcedureCode = 5
361 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200362 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200363
364 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200365 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200366 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200367 rparams2.Req.EventTriggerDefinition.ProcedureCode = 28
368 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200369 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200370
371 //Resp1
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200372 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200373 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200374
375 //Resp2
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200376 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200377 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200378
379 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200380 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200381 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
382 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200383 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200384 //Wait that subs is cleaned
385 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
386
387 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200388 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200389 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
390 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200391 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200392 //Wait that subs is cleaned
393 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
394
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200395 xappConn1.TestMsgChanEmpty(t)
396 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200397 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200398 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200399}
400
401//-----------------------------------------------------------------------------
402// TestSameSubsDiffRan
403// Same subscription to different RANs
404//
405// stub stub
406// +-------+ +---------+ +---------+
407// | xapp | | submgr | | e2term |
408// +-------+ +---------+ +---------+
409// | | |
410// | | |
411// | | |
412// | SubReq(r1) | |
413// |------------->| |
414// | | |
415// | | SubReq(r1) |
416// | |------------->|
417// | | |
418// | | SubResp(r1) |
419// | |<-------------|
420// | | |
421// | SubResp(r1) | |
422// |<-------------| |
423// | | |
424// | SubReq(r2) | |
425// |------------->| |
426// | | |
427// | | SubReq(r2) |
428// | |------------->|
429// | | |
430// | | SubResp(r2) |
431// | |<-------------|
432// | | |
433// | SubResp(r2) | |
434// |<-------------| |
435// | | |
436// | [SUBS r1 DELETE] |
437// | | |
438// | [SUBS r2 DELETE] |
439// | | |
440//
441//-----------------------------------------------------------------------------
442func TestSameSubsDiffRan(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200443 CaseBegin("TestSameSubsDiffRan")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200444
445 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200446 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
447 xappConn1.SendSubsReq(t, nil, cretrans1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200448 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
449 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200450 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200451
452 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200453 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
454 xappConn1.SendSubsReq(t, nil, cretrans2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200455 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
456 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200457 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200458
459 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200460 deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
461 xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200462 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
463 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200464 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200465 //Wait that subs is cleaned
466 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
467
468 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200469 deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
470 xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200471 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
472 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200473 xappConn1.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200474 //Wait that subs is cleaned
475 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
476
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200477 xappConn1.TestMsgChanEmpty(t)
478 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200479 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200480 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200481}
482
483//-----------------------------------------------------------------------------
484// TestSubReqRetryInSubmgr
485//
486// stub stub
487// +-------+ +---------+ +---------+
488// | xapp | | submgr | | e2term |
489// +-------+ +---------+ +---------+
490// | | |
491// | SubReq | |
492// |------------->| |
493// | | |
494// | | SubReq |
495// | |------------->|
496// | | |
497// | | |
498// | | SubReq |
499// | |------------->|
500// | | |
501// | | SubResp |
502// | |<-------------|
503// | | |
504// | SubResp | |
505// |<-------------| |
506// | | |
507// | [SUBS DELETE] |
508// | | |
509//
510//-----------------------------------------------------------------------------
511
512func TestSubReqRetryInSubmgr(t *testing.T) {
513
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200514 CaseBegin("TestSubReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200515
516 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200517 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200518
519 // E2t: Receive 1st SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200520 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200521
522 // E2t: Receive 2nd SubsReq and send SubsResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200523 crereq, cremsg := e2termConn1.RecvSubsReq(t)
524 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200525
526 // Xapp: Receive SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200527 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200528
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200529 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200530 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
531 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200532 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200533
534 // Wait that subs is cleaned
535 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
536
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200537 xappConn1.TestMsgChanEmpty(t)
538 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200539 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200540 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200541}
542
543//-----------------------------------------------------------------------------
544// TestSubReqTwoRetriesNoRespSubDelRespInSubmgr
545//
546// stub stub
547// +-------+ +---------+ +---------+
548// | xapp | | submgr | | e2term |
549// +-------+ +---------+ +---------+
550// | | |
551// | SubReq | |
552// |------------->| |
553// | | |
554// | | SubReq |
555// | |------------->|
556// | | |
557// | | |
558// | | SubReq |
559// | |------------->|
560// | | |
561// | | SubDelReq |
562// | |------------->|
563// | | |
564// | | |
565// | | SubDelReq |
566// | |------------->|
567// | | |
568// | | |
569// | | SubDelResp |
570// | |<-------------|
571// | | |
572//
573//-----------------------------------------------------------------------------
574
575func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
576
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200577 CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200578
579 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200580 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200581
582 // E2t: Receive 1st SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200583 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200584
585 // E2t: Receive 2nd SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200586 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200587
588 // E2t: Send receive SubsDelReq and send SubsResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200589 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
590 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200591
592 // Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +0200593 mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200594
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200595 xappConn1.TestMsgChanEmpty(t)
596 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200597 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200598 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200599}
600
601//-----------------------------------------------------------------------------
602// TestSubReqTwoRetriesNoRespAtAllInSubmgr
603//
604// stub stub
605// +-------+ +---------+ +---------+
606// | xapp | | submgr | | e2term |
607// +-------+ +---------+ +---------+
608// | | |
609// | SubReq | |
610// |------------->| |
611// | | |
612// | | SubReq |
613// | |------------->|
614// | | |
615// | | |
616// | | SubReq |
617// | |------------->|
618// | | |
619// | | SubDelReq |
620// | |------------->|
621// | | |
622// | | |
623// | | SubDelReq |
624// | |------------->|
625// | | |
626// | | |
627//
628//-----------------------------------------------------------------------------
629
630func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) {
631
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200632 CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200633
634 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200635 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200636
637 // E2t: Receive 1st SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200638 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200639
640 // E2t: Receive 2nd SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200641 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200642
643 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200644 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200645
646 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200647 delreq, _ := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200648
649 // Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +0200650 mainCtrl.wait_subs_clean(t, delreq.RequestId.Seq, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200651
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200652 xappConn1.TestMsgChanEmpty(t)
653 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200654 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200655 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200656}
657
658//-----------------------------------------------------------------------------
659// TestSubReqSubFailRespInSubmgr
660//
661// stub stub
662// +-------+ +---------+ +---------+
663// | xapp | | submgr | | e2term |
664// +-------+ +---------+ +---------+
665// | | |
666// | SubReq | |
667// |------------->| |
668// | | |
669// | | SubReq |
670// | |------------->|
671// | | |
672// | | SubFail |
673// | |<-------------|
674// | | |
Juha Hyttinenf28853b2020-03-09 14:02:50 +0200675// | | SubDelReq |
676// | |------------->|
677// | | |
678// | | SubDelResp |
679// | |<-------------|
680// | | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200681// | SubFail | |
682// |<-------------| |
683// | | |
684//
685//-----------------------------------------------------------------------------
686
687func TestSubReqSubFailRespInSubmgr(t *testing.T) {
688
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200689 CaseBegin("TestSubReqSubFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200690
691 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200692 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200693
Juha Hyttinenf28853b2020-03-09 14:02:50 +0200694 // E2t: Receive SubsReq and send SubsFail (first)
695 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
696 fparams1 := &teststube2ap.E2StubSubsFailParams{}
697 fparams1.Set(crereq1)
698 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
699
700 // E2t: Receive SubsDelReq and send SubsDelResp (internal first)
701 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
702 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
703
704 // Xapp: Receive SubsFail
705 e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
706
707 // Wait that subs is cleaned
708 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
709
710 xappConn1.TestMsgChanEmpty(t)
711 xappConn2.TestMsgChanEmpty(t)
712 e2termConn1.TestMsgChanEmpty(t)
713 mainCtrl.wait_registry_empty(t, 10)
714}
715
716//-----------------------------------------------------------------------------
717// TestSubReqSubFailRespInSubmgrWithDuplicate
718//
719// stub stub
720// +-------+ +---------+ +---------+
721// | xapp | | submgr | | e2term |
722// +-------+ +---------+ +---------+
723// | | |
724// | SubReq | |
725// |------------->| |
726// | | |
727// | | SubReq |
728// | |------------->|
729// | | |
730// | | SubFail |
731// | |<-------------|
732// | | |
733// | | SubDelReq |
734// | |------------->|
735// | | |
736// | | SubDelResp |
737// | |<-------------|
738// | | |
739// | | SubReq |
740// | |------------->|
741// | | |
742// | | SubResp |
743// | |<-------------|
744// | | |
745// | SubResp | |
746// |<-------------| |
747// | | |
748// | [SUBS DELETE] |
749// | | |
750//
751//-----------------------------------------------------------------------------
752
753func TestSubReqSubFailRespInSubmgrWithDuplicate(t *testing.T) {
754
755 CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicate start")
756
757 // Xapp: Send SubsReq
758 cretrans := xappConn1.SendSubsReq(t, nil, nil)
759
760 // E2t: Receive SubsReq and send SubsFail (first)
761 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
762 fparams1 := &teststube2ap.E2StubSubsFailParams{}
763 fparams1.Set(crereq1)
764 fparams1.SetCauseVal(-1, 5, 3)
765 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
766
767 // E2t: Receive SubsDelReq and send SubsDelResp (internal)
768 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
769 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
770
771 // E2t: Receive SubsReq and send SubsResp (second)
772 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
773 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
774
775 // XAPP: Receive SubsResp
776 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
777
778 // Delete
779 deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
780 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
781 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
782 xappConn1.RecvSubsDelResp(t, deltrans2)
783
784 // Wait that subs is cleaned
785 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
786
787 xappConn1.TestMsgChanEmpty(t)
788 xappConn2.TestMsgChanEmpty(t)
789 e2termConn1.TestMsgChanEmpty(t)
790 mainCtrl.wait_registry_empty(t, 10)
791}
792
793//-----------------------------------------------------------------------------
794// TestSubReqSubFailRespInSubmgrWithDuplicateFail
795//
796// stub stub
797// +-------+ +---------+ +---------+
798// | xapp | | submgr | | e2term |
799// +-------+ +---------+ +---------+
800// | | |
801// | SubReq | |
802// |------------->| |
803// | | |
804// | | SubReq |
805// | |------------->|
806// | | |
807// | | SubFail |
808// | |<-------------|
809// | | |
810// | | SubDelReq |
811// | |------------->|
812// | | |
813// | | SubDelResp |
814// | |<-------------|
815// | | |
816// | | SubReq |
817// | |------------->|
818// | | |
819// | | SubFail |
820// | |<-------------|
821// | | |
822// | | SubDelReq |
823// | |------------->|
824// | | |
825// | | SubDelResp |
826// | |<-------------|
827// | SubFail | |
828// |<-------------| |
829// | | |
830//
831//-----------------------------------------------------------------------------
832
833func TestSubReqSubFailRespInSubmgrWithDuplicateFail(t *testing.T) {
834
835 CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicateFail start")
836
837 // Xapp: Send SubsReq
838 cretrans := xappConn1.SendSubsReq(t, nil, nil)
839
840 // E2t: Receive SubsReq and send SubsFail (first)
841 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
842 fparams1 := &teststube2ap.E2StubSubsFailParams{}
843 fparams1.Set(crereq1)
844 fparams1.SetCauseVal(-1, 5, 3)
845 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
846
847 // E2t: Receive SubsDelReq and send SubsDelResp (internal first)
848 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
849 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
850
851 // E2t: Receive SubsReq and send SubsFail (second)
852 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
853 fparams2 := &teststube2ap.E2StubSubsFailParams{}
854 fparams2.Set(crereq2)
855 fparams2.SetCauseVal(-1, 5, 3)
856 e2termConn1.SendSubsFail(t, fparams2, cremsg2)
857
858 // E2t: Receive SubsDelReq and send SubsDelResp (internal second)
859 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
860 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200861
862 // Xapp: Receive SubsFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200863 e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200864
865 // Wait that subs is cleaned
866 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
867
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200868 xappConn1.TestMsgChanEmpty(t)
869 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200870 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200871 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200872}
873
874//-----------------------------------------------------------------------------
875// TestSubDelReqRetryInSubmgr
876//
877// stub stub
878// +-------+ +---------+ +---------+
879// | xapp | | submgr | | e2term |
880// +-------+ +---------+ +---------+
881// | | |
882// | [SUBS CREATE] |
883// | | |
884// | | |
885// | SubDelReq | |
886// |------------->| |
887// | | |
888// | | SubDelReq |
889// | |------------->|
890// | | |
891// | | SubDelReq |
892// | |------------->|
893// | | |
894// | | SubDelResp |
895// | |<-------------|
896// | | |
897// | SubDelResp | |
898// |<-------------| |
899//
900//-----------------------------------------------------------------------------
901
902func TestSubDelReqRetryInSubmgr(t *testing.T) {
903
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200904 CaseBegin("TestSubDelReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200905
906 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200907 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200908 crereq, cremsg := e2termConn1.RecvSubsReq(t)
909 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200910 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200911
912 // Subs Delete
913 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200914 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200915
916 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200917 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200918
919 // E2t: Receive 2nd SubsDelReq and send SubsDelResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200920 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
921 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200922
923 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200924 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200925
926 // Wait that subs is cleaned
927 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
928
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200929 xappConn1.TestMsgChanEmpty(t)
930 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200931 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200932 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200933}
934
935//-----------------------------------------------------------------------------
936// TestSubDelReqTwoRetriesNoRespInSubmgr
937//
938// stub stub
939// +-------+ +---------+ +---------+
940// | xapp | | submgr | | e2term |
941// +-------+ +---------+ +---------+
942// | | |
943// | [SUBS CREATE] |
944// | | |
945// | | |
946// | SubDelReq | |
947// |------------->| |
948// | | |
949// | | SubDelReq |
950// | |------------->|
951// | | |
952// | | SubDelReq |
953// | |------------->|
954// | | |
955// | | |
956// | SubDelResp | |
957// |<-------------| |
958//
959//-----------------------------------------------------------------------------
960
961func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) {
962
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200963 CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200964
965 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200966 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200967 crereq, cremsg := e2termConn1.RecvSubsReq(t)
968 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200969 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200970
971 // Subs Delete
972 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200973 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200974
975 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200976 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200977
978 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200979 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200980
981 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200982 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200983
984 // Wait that subs is cleaned
985 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
986
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200987 xappConn1.TestMsgChanEmpty(t)
988 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200989 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200990 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200991}
992
993//-----------------------------------------------------------------------------
994// TestSubDelReqSubDelFailRespInSubmgr
995//
996// stub stub
997// +-------+ +---------+ +---------+
998// | xapp | | submgr | | e2term |
999// +-------+ +---------+ +---------+
1000// | | |
1001// | [SUBS CREATE] |
1002// | | |
1003// | | |
1004// | SubDelReq | |
1005// |------------->| |
1006// | | |
1007// | | SubDelReq |
1008// | |------------->|
1009// | | |
1010// | | SubDelFail |
1011// | |<-------------|
1012// | | |
1013// | SubDelResp | |
1014// |<-------------| |
1015// | | |
1016//
1017//-----------------------------------------------------------------------------
1018
1019func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) {
1020
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001021 CaseBegin("TestSubReqSubDelFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +02001022
1023 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001024 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001025 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1026 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001027 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001028
1029 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001030 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001031
1032 // E2t: Send receive SubsDelReq and send SubsDelFail
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001033 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
1034 e2termConn1.SendSubsDelFail(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001035
1036 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001037 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001038
1039 // Wait that subs is cleaned
1040 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1041
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001042 xappConn1.TestMsgChanEmpty(t)
1043 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001044 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001045 mainCtrl.wait_registry_empty(t, 10)
1046}
1047
1048//-----------------------------------------------------------------------------
1049// TestSubReqAndSubDelOkSameAction
1050//
1051// stub stub
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001052// +-------+ +-------+ +---------+ +---------+
1053// | xapp2 | | xapp1 | | submgr | | e2term |
1054// +-------+ +-------+ +---------+ +---------+
1055// | | | |
1056// | | | |
1057// | | | |
1058// | | SubReq1 | |
1059// | |------------->| |
1060// | | | |
1061// | | | SubReq1 |
1062// | | |------------->|
1063// | | | SubResp1 |
1064// | | |<-------------|
1065// | | SubResp1 | |
1066// | |<-------------| |
1067// | | | |
1068// | SubReq2 | |
1069// |--------------------------->| |
1070// | | | |
1071// | SubResp2 | |
1072// |<---------------------------| |
1073// | | | |
1074// | | SubDelReq 1 | |
1075// | |------------->| |
1076// | | | |
1077// | | SubDelResp 1 | |
1078// | |<-------------| |
1079// | | | |
1080// | SubDelReq 2 | |
1081// |--------------------------->| |
1082// | | | |
1083// | | | SubDelReq 2 |
1084// | | |------------->|
1085// | | | |
1086// | | | SubDelReq 2 |
1087// | | |------------->|
1088// | | | |
1089// | SubDelResp 2 | |
1090// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001091//
1092//-----------------------------------------------------------------------------
1093func TestSubReqAndSubDelOkSameAction(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001094 CaseBegin("TestSubReqAndSubDelOkSameAction")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001095
1096 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001097 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001098 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001099 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001100 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
1101 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001102 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001103
1104 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001105 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001106 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001107 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001108 //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
1109 //e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001110 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001111
Juha Hyttinenc9eb08a2020-02-28 08:53:33 +02001112 resp, _ := xapp.Subscription.QuerySubscriptions()
1113 assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1))
1114 assert.Equal(t, resp[0].Meid, "RAN_NAME_1")
1115 assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"})
1116
Juha Hyttinen3944a222020-01-24 11:51:46 +02001117 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001118 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001119 //e2termConn1.RecvSubsDelReq(t)
1120 //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001121 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001122 //Wait that subs is cleaned
1123 //mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
1124
1125 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001126 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001127 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
1128 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001129 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001130 //Wait that subs is cleaned
1131 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1132
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001133 xappConn1.TestMsgChanEmpty(t)
1134 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001135 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001136 mainCtrl.wait_registry_empty(t, 10)
1137}
1138
1139//-----------------------------------------------------------------------------
1140// TestSubReqAndSubDelOkSameActionParallel
1141//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001142// stub stub stub
1143// +-------+ +-------+ +---------+ +---------+
1144// | xapp2 | | xapp1 | | submgr | | e2term |
1145// +-------+ +-------+ +---------+ +---------+
1146// | | | |
1147// | | | |
1148// | | | |
1149// | | SubReq1 | |
1150// | |------------->| |
1151// | | | |
1152// | | | SubReq1 |
1153// | | |------------->|
1154// | SubReq2 | |
1155// |--------------------------->| |
1156// | | | SubResp1 |
1157// | | |<-------------|
1158// | | SubResp1 | |
1159// | |<-------------| |
1160// | | | |
1161// | SubResp2 | |
1162// |<---------------------------| |
1163// | | | |
1164// | | SubDelReq 1 | |
1165// | |------------->| |
1166// | | | |
1167// | | SubDelResp 1 | |
1168// | |<-------------| |
1169// | | | |
1170// | SubDelReq 2 | |
1171// |--------------------------->| |
1172// | | | |
1173// | | | SubDelReq 2 |
1174// | | |------------->|
1175// | | | |
1176// | | | SubDelReq 2 |
1177// | | |------------->|
1178// | | | |
1179// | SubDelResp 2 | |
1180// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001181//
1182//-----------------------------------------------------------------------------
1183func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001184 CaseBegin("TestSubReqAndSubDelOkSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001185
1186 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001187 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001188 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001189 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001190 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001191
1192 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001193 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001194 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001195 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001196
1197 //Resp1
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001198 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001199 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001200
1201 //Resp2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001202 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001203
1204 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001205 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1206 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001207
1208 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001209 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001210 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
1211 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001212 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001213
1214 //Wait that subs is cleaned
1215 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1216
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001217 xappConn1.TestMsgChanEmpty(t)
1218 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001219 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001220 mainCtrl.wait_registry_empty(t, 10)
1221}
1222
1223//-----------------------------------------------------------------------------
1224// TestSubReqAndSubDelNokSameActionParallel
1225//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001226// stub stub stub
1227// +-------+ +-------+ +---------+ +---------+
1228// | xapp2 | | xapp1 | | submgr | | e2term |
1229// +-------+ +-------+ +---------+ +---------+
1230// | | | |
1231// | | | |
1232// | | | |
1233// | | SubReq1 | |
1234// | |------------->| |
1235// | | | |
1236// | | | SubReq1 |
1237// | | |------------->|
1238// | SubReq2 | |
1239// |--------------------------->| |
1240// | | | SubFail1 |
1241// | | |<-------------|
Juha Hyttinenf28853b2020-03-09 14:02:50 +02001242// | | | |
1243// | | | SubDelReq |
1244// | | |------------->|
1245// | | | SubDelResp |
1246// | | |<-------------|
1247// | | | |
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001248// | | SubFail1 | |
1249// | |<-------------| |
1250// | | | |
1251// | SubFail2 | |
1252// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001253//
1254//-----------------------------------------------------------------------------
1255func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001256 CaseBegin("TestSubReqAndSubDelNokSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001257
1258 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001259 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001260 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001261 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinenf28853b2020-03-09 14:02:50 +02001262
1263 // E2t: Receive SubsReq (first)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001264 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001265
1266 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001267 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001268 rparams2.Init()
1269 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001270 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001271 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1272
Juha Hyttinenf28853b2020-03-09 14:02:50 +02001273 // E2t: send SubsFail (first)
1274 fparams1 := &teststube2ap.E2StubSubsFailParams{}
1275 fparams1.Set(crereq1)
1276 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
1277
1278 // E2t: internal delete
1279 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
1280 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001281
1282 //Fail1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001283 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001284 //Fail2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001285 xappConn2.RecvSubsFail(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001286
1287 //Wait that subs is cleaned
1288 mainCtrl.wait_subs_clean(t, e2SubsId1, 15)
1289
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001290 xappConn1.TestMsgChanEmpty(t)
1291 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001292 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001293 mainCtrl.wait_registry_empty(t, 10)
1294}
1295
1296//-----------------------------------------------------------------------------
1297// TestSubReqAndSubDelNoAnswerSameActionParallel
1298//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001299// stub stub stub
1300// +-------+ +-------+ +---------+ +---------+
1301// | xapp2 | | xapp1 | | submgr | | e2term |
1302// +-------+ +-------+ +---------+ +---------+
1303// | | | |
1304// | | | |
1305// | | | |
1306// | | SubReq1 | |
1307// | |------------->| |
1308// | | | |
1309// | | | SubReq1 |
1310// | | |------------->|
1311// | | SubReq2 | |
1312// |--------------------------->| |
1313// | | | |
1314// | | | SubReq1 |
1315// | | |------------->|
1316// | | | |
1317// | | | |
1318// | | | SubDelReq |
1319// | | |------------->|
1320// | | | |
1321// | | | SubDelResp |
1322// | | |<-------------|
Juha Hyttinen3944a222020-01-24 11:51:46 +02001323//
1324//-----------------------------------------------------------------------------
1325func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001326 CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001327
1328 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001329 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001330 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001331 xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001332
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001333 e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001334
1335 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001336 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001337 rparams2.Init()
1338 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001339 xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001340 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1341
1342 //Req1 (retransmitted)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001343 e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001344
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001345 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1346 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001347
1348 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +02001349 mainCtrl.wait_subs_clean(t, delreq1.RequestId.Seq, 10)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001350
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001351 xappConn1.TestMsgChanEmpty(t)
1352 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001353 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001354 mainCtrl.wait_registry_empty(t, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001355}
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001356
1357//----------------------------- Policy cases ---------------------------------
1358//-----------------------------------------------------------------------------
1359// TestSubReqPolicyAndSubDelOk
1360//
1361// stub stub
1362// +-------+ +---------+ +---------+
1363// | xapp | | submgr | | e2term |
1364// +-------+ +---------+ +---------+
1365// | | |
1366// | SubReq | |
1367// |------------->| |
1368// | | |
1369// | | SubReq |
1370// | |------------->|
1371// | | |
1372// | | SubResp |
1373// | |<-------------|
1374// | | |
1375// | SubResp | |
1376// |<-------------| |
1377// | | |
1378// | | |
1379// | SubDelReq | |
1380// |------------->| |
1381// | | |
1382// | | SubDelReq |
1383// | |------------->|
1384// | | |
1385// | | SubDelResp |
1386// | |<-------------|
1387// | | |
1388// | SubDelResp | |
1389// |<-------------| |
1390//
1391//-----------------------------------------------------------------------------
1392func TestSubReqPolicyAndSubDelOk(t *testing.T) {
1393 CaseBegin("TestSubReqAndSubDelOk")
1394
1395 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1396 rparams1.Init()
1397 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1398 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
1399
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001400 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1401 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001402 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1403 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001404 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001405
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001406 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001407 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001408
1409 //Wait that subs is cleaned
1410 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1411
1412 xappConn1.TestMsgChanEmpty(t)
1413 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001414 e2termConn1.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001415 mainCtrl.wait_registry_empty(t, 10)
1416}
1417
1418//-----------------------------------------------------------------------------
1419// TestSubReqPolicyChangeAndSubDelOk
1420//
1421// stub stub
1422// +-------+ +---------+ +---------+
1423// | xapp | | submgr | | e2term |
1424// +-------+ +---------+ +---------+
1425// | | |
1426// | SubReq | |
1427// |------------->| |
1428// | | |
1429// | | SubReq |
1430// | |------------->|
1431// | | |
1432// | | SubResp |
1433// | |<-------------|
1434// | | |
1435// | SubResp | |
1436// |<-------------| |
1437// | | |
1438// | SubReq | |
1439// |------------->| |
1440// | | |
1441// | | SubReq |
1442// | |------------->|
1443// | | |
1444// | | SubResp |
1445// | |<-------------|
1446// | | |
1447// | SubResp | |
1448// |<-------------| |
1449// | | |
1450// | SubDelReq | |
1451// |------------->| |
1452// | | |
1453// | | SubDelReq |
1454// | |------------->|
1455// | | |
1456// | | SubDelResp |
1457// | |<-------------|
1458// | | |
1459// | SubDelResp | |
1460// |<-------------| |
1461//
1462//-----------------------------------------------------------------------------
1463
1464func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) {
1465 CaseBegin("TestSubReqAndSubDelOk")
1466
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001467 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1468 rparams1.Init()
1469 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1470 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001471
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001472 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1473 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001474 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1475
1476 //Policy change
1477 rparams1.Req.RequestId.Seq = e2SubsId
1478 rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms
1479 xappConn1.SendSubsReq(t, rparams1, cretrans)
1480
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001481 crereq, cremsg = e2termConn1.RecvSubsReq(t)
1482 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001483 e2SubsId = xappConn1.RecvSubsResp(t, cretrans)
1484 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001485 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001486
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001487 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001488 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001489
1490 //Wait that subs is cleaned
1491 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1492
1493 xappConn1.TestMsgChanEmpty(t)
1494 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001495 e2termConn1.TestMsgChanEmpty(t)
1496 mainCtrl.wait_registry_empty(t, 10)
1497}
1498
1499//-----------------------------------------------------------------------------
1500// TestSubReqAndSubDelOkTwoE2termParallel
1501//
1502// stub stub stub
1503// +-------+ +---------+ +---------+ +---------+
1504// | xapp | | submgr | | e2term1 | | e2term2 |
1505// +-------+ +---------+ +---------+ +---------+
1506// | | | |
1507// | | | |
1508// | | | |
1509// | SubReq1 | | |
1510// |------------->| | |
1511// | | | |
1512// | | SubReq1 | |
1513// | |------------->| |
1514// | | | |
1515// | SubReq2 | | |
1516// |------------->| | |
1517// | | | |
1518// | | SubReq2 | |
1519// | |---------------------------->|
1520// | | | |
1521// | | SubResp1 | |
1522// | |<-------------| |
1523// | SubResp1 | | |
1524// |<-------------| | |
1525// | | SubResp2 | |
1526// | |<----------------------------|
1527// | SubResp2 | | |
1528// |<-------------| | |
1529// | | | |
1530// | [SUBS 1 DELETE] | |
1531// | | | |
1532// | [SUBS 2 DELETE] | |
1533// | | | |
1534//
1535//-----------------------------------------------------------------------------
1536func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) {
1537 CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel")
1538
1539 //Req1
1540 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
1541 xappConn1.SendSubsReq(t, nil, cretrans1)
1542 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
1543
1544 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11")
1545 xappConn1.SendSubsReq(t, nil, cretrans2)
1546 crereq2, cremsg2 := e2termConn2.RecvSubsReq(t)
1547
1548 //Resp1
1549 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
1550 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
1551
1552 //Resp2
1553 e2termConn2.SendSubsResp(t, crereq2, cremsg2)
1554 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
1555
1556 //Del1
1557 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1558 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1559 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
1560 xappConn1.RecvSubsDelResp(t, deltrans1)
1561 //Wait that subs is cleaned
1562 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
1563
1564 //Del2
1565 deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2)
1566 delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t)
1567 e2termConn2.SendSubsDelResp(t, delreq2, delmsg2)
1568 xappConn1.RecvSubsDelResp(t, deltrans2)
1569 //Wait that subs is cleaned
1570 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1571
1572 xappConn1.TestMsgChanEmpty(t)
1573 xappConn2.TestMsgChanEmpty(t)
1574 e2termConn1.TestMsgChanEmpty(t)
1575 e2termConn2.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001576 mainCtrl.wait_registry_empty(t, 10)
1577}