blob: c0d76e2e49fec62be585cd8dc5096b446e78e415 [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// | | |
675// | SubFail | |
676// |<-------------| |
677// | | |
678//
679//-----------------------------------------------------------------------------
680
681func TestSubReqSubFailRespInSubmgr(t *testing.T) {
682
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200683 CaseBegin("TestSubReqSubFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200684
685 // Xapp: Send SubsReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200686 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200687
688 // E2t: Receive SubsReq and send SubsFail
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200689 crereq, cremsg := e2termConn1.RecvSubsReq(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200690 fparams := &teststube2ap.E2StubSubsFailParams{}
Juha Hyttinenfa015662020-01-24 10:05:18 +0200691 fparams.Set(crereq)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200692 e2termConn1.SendSubsFail(t, fparams, cremsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200693
694 // Xapp: Receive SubsFail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200695 e2SubsId := xappConn1.RecvSubsFail(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200696
697 // Wait that subs is cleaned
698 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
699
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200700 xappConn1.TestMsgChanEmpty(t)
701 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200702 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200703 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200704}
705
706//-----------------------------------------------------------------------------
707// TestSubDelReqRetryInSubmgr
708//
709// stub stub
710// +-------+ +---------+ +---------+
711// | xapp | | submgr | | e2term |
712// +-------+ +---------+ +---------+
713// | | |
714// | [SUBS CREATE] |
715// | | |
716// | | |
717// | SubDelReq | |
718// |------------->| |
719// | | |
720// | | SubDelReq |
721// | |------------->|
722// | | |
723// | | SubDelReq |
724// | |------------->|
725// | | |
726// | | SubDelResp |
727// | |<-------------|
728// | | |
729// | SubDelResp | |
730// |<-------------| |
731//
732//-----------------------------------------------------------------------------
733
734func TestSubDelReqRetryInSubmgr(t *testing.T) {
735
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200736 CaseBegin("TestSubDelReqRetryInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200737
738 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200739 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200740 crereq, cremsg := e2termConn1.RecvSubsReq(t)
741 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200742 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200743
744 // Subs Delete
745 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200746 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200747
748 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200749 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200750
751 // E2t: Receive 2nd SubsDelReq and send SubsDelResp
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200752 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
753 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200754
755 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200756 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200757
758 // Wait that subs is cleaned
759 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
760
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200761 xappConn1.TestMsgChanEmpty(t)
762 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200763 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200764 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200765}
766
767//-----------------------------------------------------------------------------
768// TestSubDelReqTwoRetriesNoRespInSubmgr
769//
770// stub stub
771// +-------+ +---------+ +---------+
772// | xapp | | submgr | | e2term |
773// +-------+ +---------+ +---------+
774// | | |
775// | [SUBS CREATE] |
776// | | |
777// | | |
778// | SubDelReq | |
779// |------------->| |
780// | | |
781// | | SubDelReq |
782// | |------------->|
783// | | |
784// | | SubDelReq |
785// | |------------->|
786// | | |
787// | | |
788// | SubDelResp | |
789// |<-------------| |
790//
791//-----------------------------------------------------------------------------
792
793func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) {
794
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200795 CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200796
797 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200798 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200799 crereq, cremsg := e2termConn1.RecvSubsReq(t)
800 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200801 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200802
803 // Subs Delete
804 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200805 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200806
807 // E2t: Receive 1st SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200808 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200809
810 // E2t: Receive 2nd SubsDelReq
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200811 e2termConn1.RecvSubsDelReq(t)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200812
813 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200814 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200815
816 // Wait that subs is cleaned
817 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
818
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200819 xappConn1.TestMsgChanEmpty(t)
820 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200821 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200822 mainCtrl.wait_registry_empty(t, 10)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200823}
824
825//-----------------------------------------------------------------------------
826// TestSubDelReqSubDelFailRespInSubmgr
827//
828// stub stub
829// +-------+ +---------+ +---------+
830// | xapp | | submgr | | e2term |
831// +-------+ +---------+ +---------+
832// | | |
833// | [SUBS CREATE] |
834// | | |
835// | | |
836// | SubDelReq | |
837// |------------->| |
838// | | |
839// | | SubDelReq |
840// | |------------->|
841// | | |
842// | | SubDelFail |
843// | |<-------------|
844// | | |
845// | SubDelResp | |
846// |<-------------| |
847// | | |
848//
849//-----------------------------------------------------------------------------
850
851func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) {
852
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200853 CaseBegin("TestSubReqSubDelFailRespInSubmgr start")
Juha Hyttinenfa015662020-01-24 10:05:18 +0200854
855 // Subs Create
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200856 cretrans := xappConn1.SendSubsReq(t, nil, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200857 crereq, cremsg := e2termConn1.RecvSubsReq(t)
858 e2termConn1.SendSubsResp(t, crereq, cremsg)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200859 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200860
861 // Xapp: Send SubsDelReq
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200862 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200863
864 // E2t: Send receive SubsDelReq and send SubsDelFail
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200865 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
866 e2termConn1.SendSubsDelFail(t, delreq, delmsg)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200867
868 // Xapp: Receive SubsDelResp
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200869 xappConn1.RecvSubsDelResp(t, deltrans)
Juha Hyttinenfa015662020-01-24 10:05:18 +0200870
871 // Wait that subs is cleaned
872 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
873
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200874 xappConn1.TestMsgChanEmpty(t)
875 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200876 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200877 mainCtrl.wait_registry_empty(t, 10)
878}
879
880//-----------------------------------------------------------------------------
881// TestSubReqAndSubDelOkSameAction
882//
883// stub stub
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200884// +-------+ +-------+ +---------+ +---------+
885// | xapp2 | | xapp1 | | submgr | | e2term |
886// +-------+ +-------+ +---------+ +---------+
887// | | | |
888// | | | |
889// | | | |
890// | | SubReq1 | |
891// | |------------->| |
892// | | | |
893// | | | SubReq1 |
894// | | |------------->|
895// | | | SubResp1 |
896// | | |<-------------|
897// | | SubResp1 | |
898// | |<-------------| |
899// | | | |
900// | SubReq2 | |
901// |--------------------------->| |
902// | | | |
903// | SubResp2 | |
904// |<---------------------------| |
905// | | | |
906// | | SubDelReq 1 | |
907// | |------------->| |
908// | | | |
909// | | SubDelResp 1 | |
910// | |<-------------| |
911// | | | |
912// | SubDelReq 2 | |
913// |--------------------------->| |
914// | | | |
915// | | | SubDelReq 2 |
916// | | |------------->|
917// | | | |
918// | | | SubDelReq 2 |
919// | | |------------->|
920// | | | |
921// | SubDelResp 2 | |
922// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +0200923//
924//-----------------------------------------------------------------------------
925func TestSubReqAndSubDelOkSameAction(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200926 CaseBegin("TestSubReqAndSubDelOkSameAction")
Juha Hyttinen3944a222020-01-24 11:51:46 +0200927
928 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200929 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200930 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200931 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200932 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
933 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200934 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200935
936 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200937 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +0200938 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200939 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200940 //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t)
941 //e2termConn1.SendSubsResp(t, crereq2, cremsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200942 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200943
Juha Hyttinenc9eb08a2020-02-28 08:53:33 +0200944 resp, _ := xapp.Subscription.QuerySubscriptions()
945 assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1))
946 assert.Equal(t, resp[0].Meid, "RAN_NAME_1")
947 assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"})
948
Juha Hyttinen3944a222020-01-24 11:51:46 +0200949 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200950 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200951 //e2termConn1.RecvSubsDelReq(t)
952 //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200953 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200954 //Wait that subs is cleaned
955 //mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
956
957 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200958 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200959 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
960 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200961 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200962 //Wait that subs is cleaned
963 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
964
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +0200965 xappConn1.TestMsgChanEmpty(t)
966 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200967 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +0200968 mainCtrl.wait_registry_empty(t, 10)
969}
970
971//-----------------------------------------------------------------------------
972// TestSubReqAndSubDelOkSameActionParallel
973//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +0200974// stub stub stub
975// +-------+ +-------+ +---------+ +---------+
976// | xapp2 | | xapp1 | | submgr | | e2term |
977// +-------+ +-------+ +---------+ +---------+
978// | | | |
979// | | | |
980// | | | |
981// | | SubReq1 | |
982// | |------------->| |
983// | | | |
984// | | | SubReq1 |
985// | | |------------->|
986// | SubReq2 | |
987// |--------------------------->| |
988// | | | SubResp1 |
989// | | |<-------------|
990// | | SubResp1 | |
991// | |<-------------| |
992// | | | |
993// | SubResp2 | |
994// |<---------------------------| |
995// | | | |
996// | | SubDelReq 1 | |
997// | |------------->| |
998// | | | |
999// | | SubDelResp 1 | |
1000// | |<-------------| |
1001// | | | |
1002// | SubDelReq 2 | |
1003// |--------------------------->| |
1004// | | | |
1005// | | | SubDelReq 2 |
1006// | | |------------->|
1007// | | | |
1008// | | | SubDelReq 2 |
1009// | | |------------->|
1010// | | | |
1011// | SubDelResp 2 | |
1012// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001013//
1014//-----------------------------------------------------------------------------
1015func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001016 CaseBegin("TestSubReqAndSubDelOkSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001017
1018 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001019 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001020 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001021 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001022 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001023
1024 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001025 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001026 rparams2.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001027 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001028
1029 //Resp1
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001030 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001031 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001032
1033 //Resp2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001034 e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001035
1036 //Del1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001037 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1038 xappConn1.RecvSubsDelResp(t, deltrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001039
1040 //Del2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001041 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001042 delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t)
1043 e2termConn1.SendSubsDelResp(t, delreq2, delmsg2)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001044 xappConn2.RecvSubsDelResp(t, deltrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001045
1046 //Wait that subs is cleaned
1047 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1048
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001049 xappConn1.TestMsgChanEmpty(t)
1050 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001051 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001052 mainCtrl.wait_registry_empty(t, 10)
1053}
1054
1055//-----------------------------------------------------------------------------
1056// TestSubReqAndSubDelNokSameActionParallel
1057//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001058// stub stub stub
1059// +-------+ +-------+ +---------+ +---------+
1060// | xapp2 | | xapp1 | | submgr | | e2term |
1061// +-------+ +-------+ +---------+ +---------+
1062// | | | |
1063// | | | |
1064// | | | |
1065// | | SubReq1 | |
1066// | |------------->| |
1067// | | | |
1068// | | | SubReq1 |
1069// | | |------------->|
1070// | SubReq2 | |
1071// |--------------------------->| |
1072// | | | SubFail1 |
1073// | | |<-------------|
1074// | | SubFail1 | |
1075// | |<-------------| |
1076// | | | |
1077// | SubFail2 | |
1078// |<---------------------------| |
Juha Hyttinen3944a222020-01-24 11:51:46 +02001079//
1080//-----------------------------------------------------------------------------
1081func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001082 CaseBegin("TestSubReqAndSubDelNokSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001083
1084 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001085 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001086 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001087 cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001088 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001089
1090 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001091 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001092 rparams2.Init()
1093 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001094 cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001095 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1096
1097 //E2T Fail
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001098 fparams := &teststube2ap.E2StubSubsFailParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001099 fparams.Set(crereq1)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001100 e2termConn1.SendSubsFail(t, fparams, cremsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001101
1102 //Fail1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001103 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001104 //Fail2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001105 xappConn2.RecvSubsFail(t, cretrans2)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001106
1107 //Wait that subs is cleaned
1108 mainCtrl.wait_subs_clean(t, e2SubsId1, 15)
1109
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001110 xappConn1.TestMsgChanEmpty(t)
1111 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001112 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001113 mainCtrl.wait_registry_empty(t, 10)
1114}
1115
1116//-----------------------------------------------------------------------------
1117// TestSubReqAndSubDelNoAnswerSameActionParallel
1118//
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001119// stub stub stub
1120// +-------+ +-------+ +---------+ +---------+
1121// | xapp2 | | xapp1 | | submgr | | e2term |
1122// +-------+ +-------+ +---------+ +---------+
1123// | | | |
1124// | | | |
1125// | | | |
1126// | | SubReq1 | |
1127// | |------------->| |
1128// | | | |
1129// | | | SubReq1 |
1130// | | |------------->|
1131// | | SubReq2 | |
1132// |--------------------------->| |
1133// | | | |
1134// | | | SubReq1 |
1135// | | |------------->|
1136// | | | |
1137// | | | |
1138// | | | SubDelReq |
1139// | | |------------->|
1140// | | | |
1141// | | | SubDelResp |
1142// | | |<-------------|
Juha Hyttinen3944a222020-01-24 11:51:46 +02001143//
1144//-----------------------------------------------------------------------------
1145func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) {
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001146 CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel")
Juha Hyttinen3944a222020-01-24 11:51:46 +02001147
1148 //Req1
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001149 rparams1 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001150 rparams1.Init()
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001151 xappConn1.SendSubsReq(t, rparams1, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001152
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001153 e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001154
1155 //Req2
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001156 rparams2 := &teststube2ap.E2StubSubsReqParams{}
Juha Hyttinen3944a222020-01-24 11:51:46 +02001157 rparams2.Init()
1158 seqBef2 := mainCtrl.get_msgcounter(t)
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001159 xappConn2.SendSubsReq(t, rparams2, nil)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001160 mainCtrl.wait_msgcounter_change(t, seqBef2, 10)
1161
1162 //Req1 (retransmitted)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001163 e2termConn1.RecvSubsReq(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001164
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001165 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1166 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001167
1168 //Wait that subs is cleaned
Juha Hyttinen83ada002020-01-30 10:36:33 +02001169 mainCtrl.wait_subs_clean(t, delreq1.RequestId.Seq, 10)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001170
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001171 xappConn1.TestMsgChanEmpty(t)
1172 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001173 e2termConn1.TestMsgChanEmpty(t)
Juha Hyttinen3944a222020-01-24 11:51:46 +02001174 mainCtrl.wait_registry_empty(t, 15)
Juha Hyttinenfa015662020-01-24 10:05:18 +02001175}
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001176
1177//----------------------------- Policy cases ---------------------------------
1178//-----------------------------------------------------------------------------
1179// TestSubReqPolicyAndSubDelOk
1180//
1181// stub stub
1182// +-------+ +---------+ +---------+
1183// | xapp | | submgr | | e2term |
1184// +-------+ +---------+ +---------+
1185// | | |
1186// | SubReq | |
1187// |------------->| |
1188// | | |
1189// | | SubReq |
1190// | |------------->|
1191// | | |
1192// | | SubResp |
1193// | |<-------------|
1194// | | |
1195// | SubResp | |
1196// |<-------------| |
1197// | | |
1198// | | |
1199// | SubDelReq | |
1200// |------------->| |
1201// | | |
1202// | | SubDelReq |
1203// | |------------->|
1204// | | |
1205// | | SubDelResp |
1206// | |<-------------|
1207// | | |
1208// | SubDelResp | |
1209// |<-------------| |
1210//
1211//-----------------------------------------------------------------------------
1212func TestSubReqPolicyAndSubDelOk(t *testing.T) {
1213 CaseBegin("TestSubReqAndSubDelOk")
1214
1215 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1216 rparams1.Init()
1217 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1218 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
1219
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001220 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1221 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001222 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1223 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001224 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001225
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001226 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001227 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001228
1229 //Wait that subs is cleaned
1230 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1231
1232 xappConn1.TestMsgChanEmpty(t)
1233 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001234 e2termConn1.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001235 mainCtrl.wait_registry_empty(t, 10)
1236}
1237
1238//-----------------------------------------------------------------------------
1239// TestSubReqPolicyChangeAndSubDelOk
1240//
1241// stub stub
1242// +-------+ +---------+ +---------+
1243// | xapp | | submgr | | e2term |
1244// +-------+ +---------+ +---------+
1245// | | |
1246// | SubReq | |
1247// |------------->| |
1248// | | |
1249// | | SubReq |
1250// | |------------->|
1251// | | |
1252// | | SubResp |
1253// | |<-------------|
1254// | | |
1255// | SubResp | |
1256// |<-------------| |
1257// | | |
1258// | SubReq | |
1259// |------------->| |
1260// | | |
1261// | | SubReq |
1262// | |------------->|
1263// | | |
1264// | | SubResp |
1265// | |<-------------|
1266// | | |
1267// | SubResp | |
1268// |<-------------| |
1269// | | |
1270// | SubDelReq | |
1271// |------------->| |
1272// | | |
1273// | | SubDelReq |
1274// | |------------->|
1275// | | |
1276// | | SubDelResp |
1277// | |<-------------|
1278// | | |
1279// | SubDelResp | |
1280// |<-------------| |
1281//
1282//-----------------------------------------------------------------------------
1283
1284func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) {
1285 CaseBegin("TestSubReqAndSubDelOk")
1286
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001287 rparams1 := &teststube2ap.E2StubSubsReqParams{}
1288 rparams1.Init()
1289 rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy
1290 cretrans := xappConn1.SendSubsReq(t, rparams1, nil)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001291
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001292 crereq, cremsg := e2termConn1.RecvSubsReq(t)
1293 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001294 e2SubsId := xappConn1.RecvSubsResp(t, cretrans)
1295
1296 //Policy change
1297 rparams1.Req.RequestId.Seq = e2SubsId
1298 rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms
1299 xappConn1.SendSubsReq(t, rparams1, cretrans)
1300
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001301 crereq, cremsg = e2termConn1.RecvSubsReq(t)
1302 e2termConn1.SendSubsResp(t, crereq, cremsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001303 e2SubsId = xappConn1.RecvSubsResp(t, cretrans)
1304 deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001305 delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001306
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001307 e2termConn1.SendSubsDelResp(t, delreq, delmsg)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001308 xappConn1.RecvSubsDelResp(t, deltrans)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001309
1310 //Wait that subs is cleaned
1311 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
1312
1313 xappConn1.TestMsgChanEmpty(t)
1314 xappConn2.TestMsgChanEmpty(t)
Juha Hyttinen896c3ac2020-02-24 12:49:20 +02001315 e2termConn1.TestMsgChanEmpty(t)
1316 mainCtrl.wait_registry_empty(t, 10)
1317}
1318
1319//-----------------------------------------------------------------------------
1320// TestSubReqAndSubDelOkTwoE2termParallel
1321//
1322// stub stub stub
1323// +-------+ +---------+ +---------+ +---------+
1324// | xapp | | submgr | | e2term1 | | e2term2 |
1325// +-------+ +---------+ +---------+ +---------+
1326// | | | |
1327// | | | |
1328// | | | |
1329// | SubReq1 | | |
1330// |------------->| | |
1331// | | | |
1332// | | SubReq1 | |
1333// | |------------->| |
1334// | | | |
1335// | SubReq2 | | |
1336// |------------->| | |
1337// | | | |
1338// | | SubReq2 | |
1339// | |---------------------------->|
1340// | | | |
1341// | | SubResp1 | |
1342// | |<-------------| |
1343// | SubResp1 | | |
1344// |<-------------| | |
1345// | | SubResp2 | |
1346// | |<----------------------------|
1347// | SubResp2 | | |
1348// |<-------------| | |
1349// | | | |
1350// | [SUBS 1 DELETE] | |
1351// | | | |
1352// | [SUBS 2 DELETE] | |
1353// | | | |
1354//
1355//-----------------------------------------------------------------------------
1356func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) {
1357 CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel")
1358
1359 //Req1
1360 cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1")
1361 xappConn1.SendSubsReq(t, nil, cretrans1)
1362 crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
1363
1364 cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11")
1365 xappConn1.SendSubsReq(t, nil, cretrans2)
1366 crereq2, cremsg2 := e2termConn2.RecvSubsReq(t)
1367
1368 //Resp1
1369 e2termConn1.SendSubsResp(t, crereq1, cremsg1)
1370 e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1)
1371
1372 //Resp2
1373 e2termConn2.SendSubsResp(t, crereq2, cremsg2)
1374 e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2)
1375
1376 //Del1
1377 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1)
1378 delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
1379 e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
1380 xappConn1.RecvSubsDelResp(t, deltrans1)
1381 //Wait that subs is cleaned
1382 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
1383
1384 //Del2
1385 deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2)
1386 delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t)
1387 e2termConn2.SendSubsDelResp(t, delreq2, delmsg2)
1388 xappConn1.RecvSubsDelResp(t, deltrans2)
1389 //Wait that subs is cleaned
1390 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
1391
1392 xappConn1.TestMsgChanEmpty(t)
1393 xappConn2.TestMsgChanEmpty(t)
1394 e2termConn1.TestMsgChanEmpty(t)
1395 e2termConn2.TestMsgChanEmpty(t)
Anssi Mannila9bcb0a42020-02-11 11:30:44 +02001396 mainCtrl.wait_registry_empty(t, 10)
1397}