blob: 1e196f01ba96038d230ea686b0e6357cd8424107 [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"
Juha Hyttinen1683f912020-04-17 10:39:57 +030028 "time"
Juha Hyttinenfa015662020-01-24 10:05:18 +020029)
30
31//-----------------------------------------------------------------------------
32// TestSubReqAndRouteNok
33//
34// stub stub
35// +-------+ +---------+ +---------+
36// | xapp | | submgr | | rtmgr |
37// +-------+ +---------+ +---------+
38// | | |
39// | SubReq | |
40// |------------->| |
41// | | |
42// | | RouteCreate |
43// | |------------->|
44// | | |
45// | | RouteCreate |
46// | | status:400 |
47// | |<-------------|
48// | | |
49// | [SUBS INT DELETE] |
50// | | |
51//
52//-----------------------------------------------------------------------------
53
54func TestSubReqAndRouteNok(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020055 CaseBegin("TestSubReqAndRouteNok")
Juha Hyttinenfa015662020-01-24 10:05:18 +020056
57 waiter := rtmgrHttp.AllocNextEvent(false)
Juha Hyttinen1683f912020-04-17 10:39:57 +030058 newSubsId := mainCtrl.get_registry_next_subid(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020059 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +020060 waiter.WaitResult(t)
61
62 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +020063 mainCtrl.wait_subs_clean(t, newSubsId, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020064
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +020065 xappConn1.TestMsgChanEmpty(t)
66 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +020067 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +020068 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +020069}
70
71//-----------------------------------------------------------------------------
72// TestSubReqAndSubDelOk
73//
74// stub stub
75// +-------+ +---------+ +---------+
76// | xapp | | submgr | | e2term |
77// +-------+ +---------+ +---------+
78// | | |
79// | SubReq | |
80// |------------->| |
81// | | |
82// | | SubReq |
83// | |------------->|
84// | | |
85// | | SubResp |
86// | |<-------------|
87// | | |
88// | SubResp | |
89// |<-------------| |
90// | | |
91// | | |
92// | SubDelReq | |
93// |------------->| |
94// | | |
95// | | SubDelReq |
96// | |------------->|
97// | | |
98// | | SubDelResp |
99// | |<-------------|
100// | | |
101// | SubDelResp | |
102// |<-------------| |
103//
104//-----------------------------------------------------------------------------
105func TestSubReqAndSubDelOk(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200106 CaseBegin("TestSubReqAndSubDelOk")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200107
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200108 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200109
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200110 crereq, cremsg := e2termConn1.RecvSubsReq(t)
111 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200112 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenc9eb08a2020-02-28 08:53:33 +0200113
114 resp, _ := xapp.Subscription.QuerySubscriptions()
115 assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId))
116 assert.Equal(t, resp[0].Meid, "RAN_NAME_1")
117 assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"})
118
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200119 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200120 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200121
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200122 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200123 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200124
125 //Wait that subs is cleaned
126 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
127
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200128 xappConn1.TestMsgChanEmpty(t)
129 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200130 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200131 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200132}
133
134//-----------------------------------------------------------------------------
135// TestSubReqRetransmission
136//
137// stub stub
138// +-------+ +---------+ +---------+
139// | xapp | | submgr | | e2term |
140// +-------+ +---------+ +---------+
141// | | |
142// | SubReq | |
143// |------------->| |
144// | | |
145// | | SubReq |
146// | |------------->|
147// | | |
148// | SubReq | |
149// | (retrans) | |
150// |------------->| |
151// | | |
152// | | SubResp |
153// | |<-------------|
154// | | |
155// | SubResp | |
156// |<-------------| |
157// | | |
158// | [SUBS DELETE] |
159// | | |
160//
161//-----------------------------------------------------------------------------
162func TestSubReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200163 CaseBegin("TestSubReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200164
165 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200166 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200167 crereq, cremsg := e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200168
169 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200170 xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200171 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
172
Juha Hyttinen1683f912020-04-17 10:39:57 +0300173 // hack as there is no real way to see has message be handled.
174 // Previuos counter check just tells that is has been received by submgr
175 // --> artificial delay
176 <-time.After(1 * time.Second)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200177 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200178 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200179
180 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200181 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200182 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
183 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200184 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200185
186 //Wait that subs is cleaned
187 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
188
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200189 xappConn1.TestMsgChanEmpty(t)
190 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200191 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200192 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200193}
194
195//-----------------------------------------------------------------------------
196// TestSubDelReqRetransmission
197//
198// stub stub
199// +-------+ +---------+ +---------+
200// | xapp | | submgr | | e2term |
201// +-------+ +---------+ +---------+
202// | | |
203// | [SUBS CREATE] |
204// | | |
205// | | |
206// | SubDelReq | |
207// |------------->| |
208// | | |
209// | | SubDelReq |
210// | |------------->|
211// | | |
212// | SubDelReq | |
213// | (same sub) | |
214// | (same xid) | |
215// |------------->| |
216// | | |
217// | | SubDelResp |
218// | |<-------------|
219// | | |
220// | SubDelResp | |
221// |<-------------| |
222//
223//-----------------------------------------------------------------------------
224func TestSubDelReqRetransmission(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200225 CaseBegin("TestSubDelReqRetransmission")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200226
227 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200228 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200229 crereq, cremsg := e2termConn1.RecvSubsReq(t)
230 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200231 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200232
233 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200234 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200235 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200236
237 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200238 xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200239 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
240
Juha Hyttinen1683f912020-04-17 10:39:57 +0300241 // hack as there is no real way to see has message be handled.
242 // Previuos counter check just tells that is has been received by submgr
243 // --> artificial delay
244 <-time.After(1 * time.Second)
245
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200246 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200247 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200248
249 //Wait that subs is cleaned
250 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
251
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200252 xappConn1.TestMsgChanEmpty(t)
253 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200254 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200255 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200256}
257
258//-----------------------------------------------------------------------------
259// TestSubDelReqCollision
260//
261// stub stub
262// +-------+ +---------+ +---------+
263// | xapp | | submgr | | e2term |
264// +-------+ +---------+ +---------+
265// | | |
266// | [SUBS CREATE] |
267// | | |
268// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200269// | SubDelReq 1 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200270// |------------->| |
271// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200272// | | SubDelReq 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200273// | |------------->|
274// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200275// | SubDelReq 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200276// | (same sub) | |
277// | (diff xid) | |
278// |------------->| |
279// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200280// | | SubDelResp 1 |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200281// | |<-------------|
282// | | |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200283// | SubDelResp 1 | |
284// |<-------------| |
285// | | |
286// | SubDelResp 2 | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200287// |<-------------| |
288//
289//-----------------------------------------------------------------------------
Juha Hyttinen3944a222020-01-24 11:51:46 +0200290
Juha Hyttinenfa015662020-01-24 10:05:18 +0200291func TestSubDelReqCollision(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200292 CaseBegin("TestSubDelReqCollision")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200293
294 //Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200295 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200296 crereq, cremsg := e2termConn1.RecvSubsReq(t)
297 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200298 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200299
300 //Subs Delete
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200301 xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200302 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200303
Juha Hyttinen3944a222020-01-24 11:51:46 +0200304 // Subs Delete colliding
Juha Hyttinenfa015662020-01-24 10:05:18 +0200305 seqBef := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200306 deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
307 xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq
Juha Hyttinenfa015662020-01-24 10:05:18 +0200308 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
309
Juha Hyttinen1683f912020-04-17 10:39:57 +0300310 // hack as there is no real way to see has message be handled.
311 // Previuos counter check just tells that is has been received by submgr
312 // --> artificial delay
313 <-time.After(1 * time.Second)
314
Juha Hyttinen3944a222020-01-24 11:51:46 +0200315 // Del resp for first and second
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200316 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200317
318 // don't care in which order responses are received
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200319 xappConn1.RecvSubsDelResp(t, nil)
320 xappConn1.RecvSubsDelResp(t, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200321
322 //Wait that subs is cleaned
323 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
324
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200325 xappConn1.TestMsgChanEmpty(t)
326 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200327 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200328 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200329}
330
331//-----------------------------------------------------------------------------
332// TestSubReqAndSubDelOkTwoParallel
333//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200334// stub stub stub
335// +-------+ +-------+ +---------+ +---------+
336// | xapp | | xapp | | submgr | | e2term |
337// +-------+ +-------+ +---------+ +---------+
338// | | | |
339// | | | |
340// | | | |
341// | | SubReq1 | |
342// | |------------->| |
343// | | | |
344// | | | SubReq1 |
345// | | |------------->|
346// | | | |
347// | SubReq2 | |
348// |------------------------>| |
349// | | | |
350// | | | SubReq2 |
351// | | |------------->|
352// | | | |
353// | | | SubResp1 |
354// | | |<-------------|
355// | | SubResp1 | |
356// | |<-------------| |
357// | | | |
358// | | | SubResp2 |
359// | | |<-------------|
360// | SubResp2 | |
361// |<------------------------| |
362// | | | |
363// | | [SUBS 1 DELETE] |
364// | | | |
365// | | [SUBS 2 DELETE] |
366// | | | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200367//
368//-----------------------------------------------------------------------------
369func TestSubReqAndSubDelOkTwoParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200370 CaseBegin("TestSubReqAndSubDelOkTwoParallel")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200371
372 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200373 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200374 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200375 rparams1.Req.EventTriggerDefinition.ProcedureCode = 5
376 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200377 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200378
379 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200380 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200381 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200382 rparams2.Req.EventTriggerDefinition.ProcedureCode = 28
383 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200384 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200385
386 //Resp1
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200387 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200388 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200389
390 //Resp2
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200391 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200392 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200393
394 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200395 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200396 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
397 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200398 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200399 //Wait that subs is cleaned
400 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
401
402 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200403 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200404 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
405 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200406 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200407 //Wait that subs is cleaned
408 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
409
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200410 xappConn1.TestMsgChanEmpty(t)
411 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200412 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200413 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200414}
415
416//-----------------------------------------------------------------------------
417// TestSameSubsDiffRan
418// Same subscription to different RANs
419//
420// stub stub
421// +-------+ +---------+ +---------+
422// | xapp | | submgr | | e2term |
423// +-------+ +---------+ +---------+
424// | | |
425// | | |
426// | | |
427// | SubReq(r1) | |
428// |------------->| |
429// | | |
430// | | SubReq(r1) |
431// | |------------->|
432// | | |
433// | | SubResp(r1) |
434// | |<-------------|
435// | | |
436// | SubResp(r1) | |
437// |<-------------| |
438// | | |
439// | SubReq(r2) | |
440// |------------->| |
441// | | |
442// | | SubReq(r2) |
443// | |------------->|
444// | | |
445// | | SubResp(r2) |
446// | |<-------------|
447// | | |
448// | SubResp(r2) | |
449// |<-------------| |
450// | | |
451// | [SUBS r1 DELETE] |
452// | | |
453// | [SUBS r2 DELETE] |
454// | | |
455//
456//-----------------------------------------------------------------------------
457func TestSameSubsDiffRan(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200458 CaseBegin("TestSameSubsDiffRan")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200459
460 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200461 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
462 xappConn1.SendSubsReq(t, nil, cretrans1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200463 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
464 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200465 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200466
467 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200468 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
469 xappConn1.SendSubsReq(t, nil, cretrans2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200470 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
471 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200472 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200473
474 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200475 deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
476 xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200477 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
478 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200479 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200480 //Wait that subs is cleaned
481 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
482
483 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200484 deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2")
485 xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200486 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
487 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200488 xappConn1.RecvSubsDelResp(t, deltrans2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200489 //Wait that subs is cleaned
490 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
491
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200492 xappConn1.TestMsgChanEmpty(t)
493 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200494 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200495 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200496}
497
498//-----------------------------------------------------------------------------
499// TestSubReqRetryInSubmgr
500//
501// stub stub
502// +-------+ +---------+ +---------+
503// | xapp | | submgr | | e2term |
504// +-------+ +---------+ +---------+
505// | | |
506// | SubReq | |
507// |------------->| |
508// | | |
509// | | SubReq |
510// | |------------->|
511// | | |
512// | | |
513// | | SubReq |
514// | |------------->|
515// | | |
516// | | SubResp |
517// | |<-------------|
518// | | |
519// | SubResp | |
520// |<-------------| |
521// | | |
522// | [SUBS DELETE] |
523// | | |
524//
525//-----------------------------------------------------------------------------
526
527func TestSubReqRetryInSubmgr(t *testing.T) {
528
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200529 CaseBegin("TestSubReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200530
531 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200532 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200533
534 // E2t: Receive 1st SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200535 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200536
537 // E2t: Receive 2nd SubsReq and send SubsResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200538 crereq, cremsg := e2termConn1.RecvSubsReq(t)
539 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200540
541 // Xapp: Receive SubsResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200542 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200543
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200544 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200545 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
546 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200547 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200548
549 // Wait that subs is cleaned
550 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
551
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200552 xappConn1.TestMsgChanEmpty(t)
553 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200554 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200555 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200556}
557
558//-----------------------------------------------------------------------------
559// TestSubReqTwoRetriesNoRespSubDelRespInSubmgr
560//
561// stub stub
562// +-------+ +---------+ +---------+
563// | xapp | | submgr | | e2term |
564// +-------+ +---------+ +---------+
565// | | |
566// | SubReq | |
567// |------------->| |
568// | | |
569// | | SubReq |
570// | |------------->|
571// | | |
572// | | |
573// | | SubReq |
574// | |------------->|
575// | | |
576// | | SubDelReq |
577// | |------------->|
578// | | |
579// | | |
580// | | SubDelReq |
581// | |------------->|
582// | | |
583// | | |
584// | | SubDelResp |
585// | |<-------------|
586// | | |
587//
588//-----------------------------------------------------------------------------
589
590func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
591
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200592 CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200593
594 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200595 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200596
597 // E2t: Receive 1st SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200598 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200599
600 // E2t: Receive 2nd SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200601 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200602
603 // E2t: Send receive SubsDelReq and send SubsResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200604 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
605 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200606
607 // Wait that subs is cleaned
Juha Hyttinenaada6452020-04-07 08:47:58 +0300608 mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200609
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200610 xappConn1.TestMsgChanEmpty(t)
611 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200612 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200613 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200614}
615
616//-----------------------------------------------------------------------------
617// TestSubReqTwoRetriesNoRespAtAllInSubmgr
618//
619// stub stub
620// +-------+ +---------+ +---------+
621// | xapp | | submgr | | e2term |
622// +-------+ +---------+ +---------+
623// | | |
624// | SubReq | |
625// |------------->| |
626// | | |
627// | | SubReq |
628// | |------------->|
629// | | |
630// | | |
631// | | SubReq |
632// | |------------->|
633// | | |
634// | | SubDelReq |
635// | |------------->|
636// | | |
637// | | |
638// | | SubDelReq |
639// | |------------->|
640// | | |
641// | | |
642//
643//-----------------------------------------------------------------------------
644
645func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) {
646
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200647 CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200648
649 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200650 xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200651
652 // E2t: Receive 1st SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200653 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200654
655 // E2t: Receive 2nd SubsReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200656 e2termConn1.RecvSubsReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200657
658 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200659 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200660
661 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200662 delreq, _ := e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200663
664 // Wait that subs is cleaned
Juha Hyttinenaada6452020-04-07 08:47:58 +0300665 mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200666
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200667 xappConn1.TestMsgChanEmpty(t)
668 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200669 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200670 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200671}
672
673//-----------------------------------------------------------------------------
674// TestSubReqSubFailRespInSubmgr
675//
676// stub stub
677// +-------+ +---------+ +---------+
678// | xapp | | submgr | | e2term |
679// +-------+ +---------+ +---------+
680// | | |
681// | SubReq | |
682// |------------->| |
683// | | |
684// | | SubReq |
685// | |------------->|
686// | | |
687// | | SubFail |
688// | |<-------------|
689// | | |
Juha Hyttinenf28853b2020-03-09 14:02:50 +0200690// | | SubDelReq |
691// | |------------->|
692// | | |
693// | | SubDelResp |
694// | |<-------------|
695// | | |
Juha Hyttinenfa015662020-01-24 10:05:18 +0200696// | SubFail | |
697// |<-------------| |
698// | | |
699//
700//-----------------------------------------------------------------------------
701
702func TestSubReqSubFailRespInSubmgr(t *testing.T) {
703
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200704 CaseBegin("TestSubReqSubFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200705
706 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200707 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200708
Juha Hyttinenf28853b2020-03-09 14:02:50 +0200709 // E2t: Receive SubsReq and send SubsFail (first)
710 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
711 fparams1 := &teststube2ap.E2StubSubsFailParams{}
712 fparams1.Set(crereq1)
713 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
714
715 // E2t: Receive SubsDelReq and send SubsDelResp (internal first)
716 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
717 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
718
719 // Xapp: Receive SubsFail
720 e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
721
722 // Wait that subs is cleaned
723 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
724
725 xappConn1.TestMsgChanEmpty(t)
726 xappConn2.TestMsgChanEmpty(t)
727 e2termConn1.TestMsgChanEmpty(t)
728 mainCtrl.wait_registry_empty(t, 10)
729}
730
731//-----------------------------------------------------------------------------
732// TestSubReqSubFailRespInSubmgrWithDuplicate
733//
734// stub stub
735// +-------+ +---------+ +---------+
736// | xapp | | submgr | | e2term |
737// +-------+ +---------+ +---------+
738// | | |
739// | SubReq | |
740// |------------->| |
741// | | |
742// | | SubReq |
743// | |------------->|
744// | | |
745// | | SubFail |
746// | |<-------------|
747// | | |
748// | | SubDelReq |
749// | |------------->|
750// | | |
751// | | SubDelResp |
752// | |<-------------|
753// | | |
754// | | SubReq |
755// | |------------->|
756// | | |
757// | | SubResp |
758// | |<-------------|
759// | | |
760// | SubResp | |
761// |<-------------| |
762// | | |
763// | [SUBS DELETE] |
764// | | |
765//
766//-----------------------------------------------------------------------------
767
768func TestSubReqSubFailRespInSubmgrWithDuplicate(t *testing.T) {
769
770 CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicate start")
771
772 // Xapp: Send SubsReq
773 cretrans := xappConn1.SendSubsReq(t, nil, nil)
774
775 // E2t: Receive SubsReq and send SubsFail (first)
776 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
777 fparams1 := &teststube2ap.E2StubSubsFailParams{}
778 fparams1.Set(crereq1)
779 fparams1.SetCauseVal(-1, 5, 3)
780 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
781
782 // E2t: Receive SubsDelReq and send SubsDelResp (internal)
783 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
784 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
785
786 // E2t: Receive SubsReq and send SubsResp (second)
787 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
788 e2termConn1.SendSubsResp(t, crereq2, cremsg2)
789
790 // XAPP: Receive SubsResp
791 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
792
793 // Delete
794 deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
795 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
796 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
797 xappConn1.RecvSubsDelResp(t, deltrans2)
798
799 // Wait that subs is cleaned
800 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
801
802 xappConn1.TestMsgChanEmpty(t)
803 xappConn2.TestMsgChanEmpty(t)
804 e2termConn1.TestMsgChanEmpty(t)
805 mainCtrl.wait_registry_empty(t, 10)
806}
807
808//-----------------------------------------------------------------------------
809// TestSubReqSubFailRespInSubmgrWithDuplicateFail
810//
811// stub stub
812// +-------+ +---------+ +---------+
813// | xapp | | submgr | | e2term |
814// +-------+ +---------+ +---------+
815// | | |
816// | SubReq | |
817// |------------->| |
818// | | |
819// | | SubReq |
820// | |------------->|
821// | | |
822// | | SubFail |
823// | |<-------------|
824// | | |
825// | | SubDelReq |
826// | |------------->|
827// | | |
828// | | SubDelResp |
829// | |<-------------|
830// | | |
831// | | SubReq |
832// | |------------->|
833// | | |
834// | | SubFail |
835// | |<-------------|
836// | | |
837// | | SubDelReq |
838// | |------------->|
839// | | |
840// | | SubDelResp |
841// | |<-------------|
842// | SubFail | |
843// |<-------------| |
844// | | |
845//
846//-----------------------------------------------------------------------------
847
848func TestSubReqSubFailRespInSubmgrWithDuplicateFail(t *testing.T) {
849
850 CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicateFail start")
851
852 // Xapp: Send SubsReq
853 cretrans := xappConn1.SendSubsReq(t, nil, nil)
854
855 // E2t: Receive SubsReq and send SubsFail (first)
856 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
857 fparams1 := &teststube2ap.E2StubSubsFailParams{}
858 fparams1.Set(crereq1)
859 fparams1.SetCauseVal(-1, 5, 3)
860 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
861
862 // E2t: Receive SubsDelReq and send SubsDelResp (internal first)
863 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
864 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
865
866 // E2t: Receive SubsReq and send SubsFail (second)
867 crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
868 fparams2 := &teststube2ap.E2StubSubsFailParams{}
869 fparams2.Set(crereq2)
870 fparams2.SetCauseVal(-1, 5, 3)
871 e2termConn1.SendSubsFail(t, fparams2, cremsg2)
872
873 // E2t: Receive SubsDelReq and send SubsDelResp (internal second)
874 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
875 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200876
877 // Xapp: Receive SubsFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200878 e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200879
880 // Wait that subs is cleaned
881 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
882
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200883 xappConn1.TestMsgChanEmpty(t)
884 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200885 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200886 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200887}
888
889//-----------------------------------------------------------------------------
890// TestSubDelReqRetryInSubmgr
891//
892// stub stub
893// +-------+ +---------+ +---------+
894// | xapp | | submgr | | e2term |
895// +-------+ +---------+ +---------+
896// | | |
897// | [SUBS CREATE] |
898// | | |
899// | | |
900// | SubDelReq | |
901// |------------->| |
902// | | |
903// | | SubDelReq |
904// | |------------->|
905// | | |
906// | | SubDelReq |
907// | |------------->|
908// | | |
909// | | SubDelResp |
910// | |<-------------|
911// | | |
912// | SubDelResp | |
913// |<-------------| |
914//
915//-----------------------------------------------------------------------------
916
917func TestSubDelReqRetryInSubmgr(t *testing.T) {
918
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200919 CaseBegin("TestSubDelReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200920
921 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200922 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200923 crereq, cremsg := e2termConn1.RecvSubsReq(t)
924 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200925 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200926
927 // Subs Delete
928 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200929 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200930
931 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200932 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200933
934 // E2t: Receive 2nd SubsDelReq and send SubsDelResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200935 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
936 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200937
938 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200939 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200940
941 // Wait that subs is cleaned
942 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
943
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200944 xappConn1.TestMsgChanEmpty(t)
945 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200946 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200947 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200948}
949
950//-----------------------------------------------------------------------------
951// TestSubDelReqTwoRetriesNoRespInSubmgr
952//
953// stub stub
954// +-------+ +---------+ +---------+
955// | xapp | | submgr | | e2term |
956// +-------+ +---------+ +---------+
957// | | |
958// | [SUBS CREATE] |
959// | | |
960// | | |
961// | SubDelReq | |
962// |------------->| |
963// | | |
964// | | SubDelReq |
965// | |------------->|
966// | | |
967// | | SubDelReq |
968// | |------------->|
969// | | |
970// | | |
971// | SubDelResp | |
972// |<-------------| |
973//
974//-----------------------------------------------------------------------------
975
976func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) {
977
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200978 CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200979
980 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200981 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200982 crereq, cremsg := e2termConn1.RecvSubsReq(t)
983 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200984 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200985
986 // Subs Delete
987 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200988 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200989
990 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200991 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200992
993 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200994 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200995
996 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200997 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200998
999 // Wait that subs is cleaned
1000 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1001
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001002 xappConn1.TestMsgChanEmpty(t)
1003 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001004 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001005 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001006}
1007
1008//-----------------------------------------------------------------------------
1009// TestSubDelReqSubDelFailRespInSubmgr
1010//
1011// stub stub
1012// +-------+ +---------+ +---------+
1013// | xapp | | submgr | | e2term |
1014// +-------+ +---------+ +---------+
1015// | | |
1016// | [SUBS CREATE] |
1017// | | |
1018// | | |
1019// | SubDelReq | |
1020// |------------->| |
1021// | | |
1022// | | SubDelReq |
1023// | |------------->|
1024// | | |
1025// | | SubDelFail |
1026// | |<-------------|
1027// | | |
1028// | SubDelResp | |
1029// |<-------------| |
1030// | | |
1031//
1032//-----------------------------------------------------------------------------
1033
1034func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) {
1035
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001036 CaseBegin("TestSubReqSubDelFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +02001037
1038 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001039 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001040 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1041 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001042 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001043
1044 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001045 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001046
1047 // E2t: Send receive SubsDelReq and send SubsDelFail
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001048 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
1049 e2termConn1.SendSubsDelFail(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001050
1051 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001052 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001053
1054 // Wait that subs is cleaned
1055 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1056
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001057 xappConn1.TestMsgChanEmpty(t)
1058 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001059 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001060 mainCtrl.wait_registry_empty(t, 10)
1061}
1062
1063//-----------------------------------------------------------------------------
1064// TestSubReqAndSubDelOkSameAction
1065//
1066// stub stub
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001067// +-------+ +-------+ +---------+ +---------+
1068// | xapp2 | | xapp1 | | submgr | | e2term |
1069// +-------+ +-------+ +---------+ +---------+
1070// | | | |
1071// | | | |
1072// | | | |
1073// | | SubReq1 | |
1074// | |------------->| |
1075// | | | |
1076// | | | SubReq1 |
1077// | | |------------->|
1078// | | | SubResp1 |
1079// | | |<-------------|
1080// | | SubResp1 | |
1081// | |<-------------| |
1082// | | | |
1083// | SubReq2 | |
1084// |--------------------------->| |
1085// | | | |
1086// | SubResp2 | |
1087// |<---------------------------| |
1088// | | | |
1089// | | SubDelReq 1 | |
1090// | |------------->| |
1091// | | | |
1092// | | SubDelResp 1 | |
1093// | |<-------------| |
1094// | | | |
1095// | SubDelReq 2 | |
1096// |--------------------------->| |
1097// | | | |
1098// | | | SubDelReq 2 |
1099// | | |------------->|
1100// | | | |
1101// | | | SubDelReq 2 |
1102// | | |------------->|
1103// | | | |
1104// | SubDelResp 2 | |
1105// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001106//
1107//-----------------------------------------------------------------------------
1108func TestSubReqAndSubDelOkSameAction(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001109 CaseBegin("TestSubReqAndSubDelOkSameAction")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001110
1111 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001112 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001113 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001114 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001115 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
1116 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001117 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001118
1119 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001120 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001121 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001122 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001123 //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
1124 //e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001125 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001126
Juha Hyttinenc9eb08a2020-02-28 08:53:33 +02001127 resp, _ := xapp.Subscription.QuerySubscriptions()
1128 assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1))
1129 assert.Equal(t, resp[0].Meid, "RAN_NAME_1")
1130 assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"})
1131
Juha Hyttinen3944a222020-01-24 11:51:46 +02001132 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001133 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001134 //e2termConn1.RecvSubsDelReq(t)
1135 //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001136 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001137 //Wait that subs is cleaned
1138 //mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
1139
1140 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001141 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001142 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
1143 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001144 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001145 //Wait that subs is cleaned
1146 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1147
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001148 xappConn1.TestMsgChanEmpty(t)
1149 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001150 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001151 mainCtrl.wait_registry_empty(t, 10)
1152}
1153
1154//-----------------------------------------------------------------------------
1155// TestSubReqAndSubDelOkSameActionParallel
1156//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001157// stub stub stub
1158// +-------+ +-------+ +---------+ +---------+
1159// | xapp2 | | xapp1 | | submgr | | e2term |
1160// +-------+ +-------+ +---------+ +---------+
1161// | | | |
1162// | | | |
1163// | | | |
1164// | | SubReq1 | |
1165// | |------------->| |
1166// | | | |
1167// | | | SubReq1 |
1168// | | |------------->|
1169// | SubReq2 | |
1170// |--------------------------->| |
1171// | | | SubResp1 |
1172// | | |<-------------|
1173// | | SubResp1 | |
1174// | |<-------------| |
1175// | | | |
1176// | SubResp2 | |
1177// |<---------------------------| |
1178// | | | |
1179// | | SubDelReq 1 | |
1180// | |------------->| |
1181// | | | |
1182// | | SubDelResp 1 | |
1183// | |<-------------| |
1184// | | | |
1185// | SubDelReq 2 | |
1186// |--------------------------->| |
1187// | | | |
1188// | | | SubDelReq 2 |
1189// | | |------------->|
1190// | | | |
1191// | | | SubDelReq 2 |
1192// | | |------------->|
1193// | | | |
1194// | SubDelResp 2 | |
1195// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001196//
1197//-----------------------------------------------------------------------------
1198func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001199 CaseBegin("TestSubReqAndSubDelOkSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001200
1201 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001202 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001203 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001204 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001205 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001206
1207 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001208 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001209 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001210 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001211
1212 //Resp1
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001213 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001214 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001215
1216 //Resp2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001217 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001218
1219 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001220 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1221 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001222
1223 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001224 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001225 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
1226 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001227 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001228
1229 //Wait that subs is cleaned
1230 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1231
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001232 xappConn1.TestMsgChanEmpty(t)
1233 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001234 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001235 mainCtrl.wait_registry_empty(t, 10)
1236}
1237
1238//-----------------------------------------------------------------------------
1239// TestSubReqAndSubDelNokSameActionParallel
1240//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001241// stub stub stub
1242// +-------+ +-------+ +---------+ +---------+
1243// | xapp2 | | xapp1 | | submgr | | e2term |
1244// +-------+ +-------+ +---------+ +---------+
1245// | | | |
1246// | | | |
1247// | | | |
1248// | | SubReq1 | |
1249// | |------------->| |
1250// | | | |
1251// | | | SubReq1 |
1252// | | |------------->|
1253// | SubReq2 | |
1254// |--------------------------->| |
1255// | | | SubFail1 |
1256// | | |<-------------|
Juha Hyttinenf28853b2020-03-09 14:02:50 +02001257// | | | |
1258// | | | SubDelReq |
1259// | | |------------->|
1260// | | | SubDelResp |
1261// | | |<-------------|
1262// | | | |
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001263// | | SubFail1 | |
1264// | |<-------------| |
1265// | | | |
1266// | SubFail2 | |
1267// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001268//
1269//-----------------------------------------------------------------------------
1270func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001271 CaseBegin("TestSubReqAndSubDelNokSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001272
1273 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001274 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001275 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001276 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinenf28853b2020-03-09 14:02:50 +02001277
1278 // E2t: Receive SubsReq (first)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001279 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001280
1281 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001282 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001283 rparams2.Init()
Juha Hyttinen1683f912020-04-17 10:39:57 +03001284 subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001285 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen1683f912020-04-17 10:39:57 +03001286 mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001287
Juha Hyttinenf28853b2020-03-09 14:02:50 +02001288 // E2t: send SubsFail (first)
1289 fparams1 := &teststube2ap.E2StubSubsFailParams{}
1290 fparams1.Set(crereq1)
1291 e2termConn1.SendSubsFail(t, fparams1, cremsg1)
1292
1293 // E2t: internal delete
1294 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
1295 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001296
1297 //Fail1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001298 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001299 //Fail2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001300 xappConn2.RecvSubsFail(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001301
1302 //Wait that subs is cleaned
1303 mainCtrl.wait_subs_clean(t, e2SubsId1, 15)
1304
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001305 xappConn1.TestMsgChanEmpty(t)
1306 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001307 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001308 mainCtrl.wait_registry_empty(t, 10)
1309}
1310
1311//-----------------------------------------------------------------------------
1312// TestSubReqAndSubDelNoAnswerSameActionParallel
1313//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001314// stub stub stub
1315// +-------+ +-------+ +---------+ +---------+
1316// | xapp2 | | xapp1 | | submgr | | e2term |
1317// +-------+ +-------+ +---------+ +---------+
1318// | | | |
1319// | | | |
1320// | | | |
1321// | | SubReq1 | |
1322// | |------------->| |
1323// | | | |
1324// | | | SubReq1 |
1325// | | |------------->|
1326// | | SubReq2 | |
1327// |--------------------------->| |
1328// | | | |
1329// | | | SubReq1 |
1330// | | |------------->|
1331// | | | |
1332// | | | |
1333// | | | SubDelReq |
1334// | | |------------->|
1335// | | | |
1336// | | | SubDelResp |
1337// | | |<-------------|
Juha Hyttinen3944a222020-01-24 11:51:46 +02001338//
1339//-----------------------------------------------------------------------------
1340func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001341 CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001342
1343 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001344 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001345 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001346 xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001347
Juha Hyttinen1683f912020-04-17 10:39:57 +03001348 crereq1, _ := e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001349
1350 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001351 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001352 rparams2.Init()
Juha Hyttinen1683f912020-04-17 10:39:57 +03001353 subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001354 xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen1683f912020-04-17 10:39:57 +03001355 mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001356
1357 //Req1 (retransmitted)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001358 e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001359
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001360 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1361 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001362
1363 //Wait that subs is cleaned
Juha Hyttinenaada6452020-04-07 08:47:58 +03001364 mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001365
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001366 xappConn1.TestMsgChanEmpty(t)
1367 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001368 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001369 mainCtrl.wait_registry_empty(t, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001370}
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001371
1372//----------------------------- Policy cases ---------------------------------
1373//-----------------------------------------------------------------------------
1374// TestSubReqPolicyAndSubDelOk
1375//
1376// stub stub
1377// +-------+ +---------+ +---------+
1378// | xapp | | submgr | | e2term |
1379// +-------+ +---------+ +---------+
1380// | | |
1381// | SubReq | |
1382// |------------->| |
1383// | | |
1384// | | SubReq |
1385// | |------------->|
1386// | | |
1387// | | SubResp |
1388// | |<-------------|
1389// | | |
1390// | SubResp | |
1391// |<-------------| |
1392// | | |
1393// | | |
1394// | SubDelReq | |
1395// |------------->| |
1396// | | |
1397// | | SubDelReq |
1398// | |------------->|
1399// | | |
1400// | | SubDelResp |
1401// | |<-------------|
1402// | | |
1403// | SubDelResp | |
1404// |<-------------| |
1405//
1406//-----------------------------------------------------------------------------
1407func TestSubReqPolicyAndSubDelOk(t *testing.T) {
1408 CaseBegin("TestSubReqAndSubDelOk")
1409
1410 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1411 rparams1.Init()
1412 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1413 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
1414
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001415 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1416 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001417 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1418 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001419 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001420
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001421 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001422 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001423
1424 //Wait that subs is cleaned
1425 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1426
1427 xappConn1.TestMsgChanEmpty(t)
1428 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001429 e2termConn1.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001430 mainCtrl.wait_registry_empty(t, 10)
1431}
1432
1433//-----------------------------------------------------------------------------
1434// TestSubReqPolicyChangeAndSubDelOk
1435//
1436// stub stub
1437// +-------+ +---------+ +---------+
1438// | xapp | | submgr | | e2term |
1439// +-------+ +---------+ +---------+
1440// | | |
1441// | SubReq | |
1442// |------------->| |
1443// | | |
1444// | | SubReq |
1445// | |------------->|
1446// | | |
1447// | | SubResp |
1448// | |<-------------|
1449// | | |
1450// | SubResp | |
1451// |<-------------| |
1452// | | |
1453// | SubReq | |
1454// |------------->| |
1455// | | |
1456// | | SubReq |
1457// | |------------->|
1458// | | |
1459// | | SubResp |
1460// | |<-------------|
1461// | | |
1462// | SubResp | |
1463// |<-------------| |
1464// | | |
1465// | SubDelReq | |
1466// |------------->| |
1467// | | |
1468// | | SubDelReq |
1469// | |------------->|
1470// | | |
1471// | | SubDelResp |
1472// | |<-------------|
1473// | | |
1474// | SubDelResp | |
1475// |<-------------| |
1476//
1477//-----------------------------------------------------------------------------
1478
1479func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) {
1480 CaseBegin("TestSubReqAndSubDelOk")
1481
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001482 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1483 rparams1.Init()
1484 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1485 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001486
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001487 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1488 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001489 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1490
1491 //Policy change
Juha Hyttinenaada6452020-04-07 08:47:58 +03001492 rparams1.Req.RequestId.InstanceId = e2SubsId
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001493 rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms
1494 xappConn1.SendSubsReq(t, rparams1, cretrans)
1495
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001496 crereq, cremsg = e2termConn1.RecvSubsReq(t)
1497 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001498 e2SubsId = xappConn1.RecvSubsResp(t, cretrans)
1499 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001500 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001501
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001502 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001503 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001504
1505 //Wait that subs is cleaned
1506 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1507
1508 xappConn1.TestMsgChanEmpty(t)
1509 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001510 e2termConn1.TestMsgChanEmpty(t)
1511 mainCtrl.wait_registry_empty(t, 10)
1512}
1513
1514//-----------------------------------------------------------------------------
1515// TestSubReqAndSubDelOkTwoE2termParallel
1516//
1517// stub stub stub
1518// +-------+ +---------+ +---------+ +---------+
1519// | xapp | | submgr | | e2term1 | | e2term2 |
1520// +-------+ +---------+ +---------+ +---------+
1521// | | | |
1522// | | | |
1523// | | | |
1524// | SubReq1 | | |
1525// |------------->| | |
1526// | | | |
1527// | | SubReq1 | |
1528// | |------------->| |
1529// | | | |
1530// | SubReq2 | | |
1531// |------------->| | |
1532// | | | |
1533// | | SubReq2 | |
1534// | |---------------------------->|
1535// | | | |
1536// | | SubResp1 | |
1537// | |<-------------| |
1538// | SubResp1 | | |
1539// |<-------------| | |
1540// | | SubResp2 | |
1541// | |<----------------------------|
1542// | SubResp2 | | |
1543// |<-------------| | |
1544// | | | |
1545// | [SUBS 1 DELETE] | |
1546// | | | |
1547// | [SUBS 2 DELETE] | |
1548// | | | |
1549//
1550//-----------------------------------------------------------------------------
1551func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) {
1552 CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel")
1553
1554 //Req1
1555 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
1556 xappConn1.SendSubsReq(t, nil, cretrans1)
1557 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
1558
1559 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11")
1560 xappConn1.SendSubsReq(t, nil, cretrans2)
1561 crereq2, cremsg2 := e2termConn2.RecvSubsReq(t)
1562
1563 //Resp1
1564 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
1565 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
1566
1567 //Resp2
1568 e2termConn2.SendSubsResp(t, crereq2, cremsg2)
1569 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
1570
1571 //Del1
1572 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1573 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1574 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
1575 xappConn1.RecvSubsDelResp(t, deltrans1)
1576 //Wait that subs is cleaned
1577 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
1578
1579 //Del2
1580 deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2)
1581 delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t)
1582 e2termConn2.SendSubsDelResp(t, delreq2, delmsg2)
1583 xappConn1.RecvSubsDelResp(t, deltrans2)
1584 //Wait that subs is cleaned
1585 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1586
1587 xappConn1.TestMsgChanEmpty(t)
1588 xappConn2.TestMsgChanEmpty(t)
1589 e2termConn1.TestMsgChanEmpty(t)
1590 e2termConn2.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001591 mainCtrl.wait_registry_empty(t, 10)
1592}