blob: 3b43c3a36bcf64c90408b72835a689791c8d7adb [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 (
23 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
24 "testing"
25)
26
27//-----------------------------------------------------------------------------
28// TestSubReqAndRouteNok
29//
30// stub stub
31// +-------+ +---------+ +---------+
32// | xapp | | submgr | | rtmgr |
33// +-------+ +---------+ +---------+
34// | | |
35// | SubReq | |
36// |------------->| |
37// | | |
38// | | RouteCreate |
39// | |------------->|
40// | | |
41// | | RouteCreate |
42// | | status:400 |
43// | |<-------------|
44// | | |
45// | [SUBS INT DELETE] |
46// | | |
47//
48//-----------------------------------------------------------------------------
49
50func TestSubReqAndRouteNok(t *testing.T) {
51 xapp.Logger.Info("TestSubReqAndRouteNok")
52
53 waiter := rtmgrHttp.AllocNextEvent(false)
54 newSubsId := mainCtrl.get_subid(t)
55 xappConn1.handle_xapp_subs_req(t, nil)
56 waiter.WaitResult(t)
57
58 //Wait that subs is cleaned
59 mainCtrl.wait_subs_clean(t, int(newSubsId), 10)
60
61 xappConn1.TestMsgCnt(t)
62 xappConn2.TestMsgCnt(t)
63 e2termConn.TestMsgCnt(t)
64}
65
66//-----------------------------------------------------------------------------
67// TestSubReqAndSubDelOk
68//
69// stub stub
70// +-------+ +---------+ +---------+
71// | xapp | | submgr | | e2term |
72// +-------+ +---------+ +---------+
73// | | |
74// | SubReq | |
75// |------------->| |
76// | | |
77// | | SubReq |
78// | |------------->|
79// | | |
80// | | SubResp |
81// | |<-------------|
82// | | |
83// | SubResp | |
84// |<-------------| |
85// | | |
86// | | |
87// | SubDelReq | |
88// |------------->| |
89// | | |
90// | | SubDelReq |
91// | |------------->|
92// | | |
93// | | SubDelResp |
94// | |<-------------|
95// | | |
96// | SubDelResp | |
97// |<-------------| |
98//
99//-----------------------------------------------------------------------------
100func TestSubReqAndSubDelOk(t *testing.T) {
101 xapp.Logger.Info("TestSubReqAndSubDelOk")
102
103 waiter := rtmgrHttp.AllocNextEvent(true)
104 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
105 waiter.WaitResult(t)
106
107 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
108 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
109 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
110 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
111 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
112
113 waiter = rtmgrHttp.AllocNextEvent(true)
114 e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
115 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
116 waiter.WaitResult(t)
117
118 //Wait that subs is cleaned
119 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
120
121 xappConn1.TestMsgCnt(t)
122 xappConn2.TestMsgCnt(t)
123 e2termConn.TestMsgCnt(t)
124}
125
126//-----------------------------------------------------------------------------
127// TestSubReqRetransmission
128//
129// stub stub
130// +-------+ +---------+ +---------+
131// | xapp | | submgr | | e2term |
132// +-------+ +---------+ +---------+
133// | | |
134// | SubReq | |
135// |------------->| |
136// | | |
137// | | SubReq |
138// | |------------->|
139// | | |
140// | SubReq | |
141// | (retrans) | |
142// |------------->| |
143// | | |
144// | | SubResp |
145// | |<-------------|
146// | | |
147// | SubResp | |
148// |<-------------| |
149// | | |
150// | [SUBS DELETE] |
151// | | |
152//
153//-----------------------------------------------------------------------------
154func TestSubReqRetransmission(t *testing.T) {
155 xapp.Logger.Info("TestSubReqRetransmission")
156
157 //Subs Create
158 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
159 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
160
161 seqBef := mainCtrl.get_msgcounter(t)
162 xappConn1.handle_xapp_subs_req(t, cretrans) //Retransmitted SubReq
163 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
164
165 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
166 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
167
168 //Subs Delete
169 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
170 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
171 e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
172 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
173
174 //Wait that subs is cleaned
175 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
176
177 xappConn1.TestMsgCnt(t)
178 xappConn2.TestMsgCnt(t)
179 e2termConn.TestMsgCnt(t)
180}
181
182//-----------------------------------------------------------------------------
183// TestSubDelReqRetransmission
184//
185// stub stub
186// +-------+ +---------+ +---------+
187// | xapp | | submgr | | e2term |
188// +-------+ +---------+ +---------+
189// | | |
190// | [SUBS CREATE] |
191// | | |
192// | | |
193// | SubDelReq | |
194// |------------->| |
195// | | |
196// | | SubDelReq |
197// | |------------->|
198// | | |
199// | SubDelReq | |
200// | (same sub) | |
201// | (same xid) | |
202// |------------->| |
203// | | |
204// | | SubDelResp |
205// | |<-------------|
206// | | |
207// | SubDelResp | |
208// |<-------------| |
209//
210//-----------------------------------------------------------------------------
211func TestSubDelReqRetransmission(t *testing.T) {
212 xapp.Logger.Info("TestSubDelReqRetransmission")
213
214 //Subs Create
215 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
216 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
217 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
218 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
219
220 //Subs Delete
221 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
222 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
223
224 seqBef := mainCtrl.get_msgcounter(t)
225 xappConn1.handle_xapp_subs_del_req(t, deltrans, e2SubsId) //Retransmitted SubDelReq
226 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
227
228 e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
229 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
230
231 //Wait that subs is cleaned
232 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
233
234 xappConn1.TestMsgCnt(t)
235 xappConn2.TestMsgCnt(t)
236 e2termConn.TestMsgCnt(t)
237}
238
239//-----------------------------------------------------------------------------
240// TestSubDelReqCollision
241//
242// stub stub
243// +-------+ +---------+ +---------+
244// | xapp | | submgr | | e2term |
245// +-------+ +---------+ +---------+
246// | | |
247// | [SUBS CREATE] |
248// | | |
249// | | |
250// | SubDelReq | |
251// |------------->| |
252// | | |
253// | | SubDelReq |
254// | |------------->|
255// | | |
256// | SubDelReq | |
257// | (same sub) | |
258// | (diff xid) | |
259// |------------->| |
260// | | |
261// | | SubDelResp |
262// | |<-------------|
263// | | |
264// | SubDelResp | |
265// |<-------------| |
266//
267//-----------------------------------------------------------------------------
268func TestSubDelReqCollision(t *testing.T) {
269 xapp.Logger.Info("TestSubDelReqCollision")
270
271 //Subs Create
272 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
273 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
274 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
275 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
276
277 //Subs Delete
278 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
279 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
280
281 seqBef := mainCtrl.get_msgcounter(t)
282 deltranscol := xappConn1.newXappTransaction(nil, "RAN_NAME_1")
283 xappConn1.handle_xapp_subs_del_req(t, deltranscol, e2SubsId) //Colliding SubDelReq
284 mainCtrl.wait_msgcounter_change(t, seqBef, 10)
285
286 e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
287 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
288
289 //Wait that subs is cleaned
290 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
291
292 xappConn1.TestMsgCnt(t)
293 xappConn2.TestMsgCnt(t)
294 e2termConn.TestMsgCnt(t)
295}
296
297//-----------------------------------------------------------------------------
298// TestSubReqAndSubDelOkTwoParallel
299//
300// stub stub
301// +-------+ +---------+ +---------+
302// | xapp | | submgr | | e2term |
303// +-------+ +---------+ +---------+
304// | | |
305// | | |
306// | | |
307// | SubReq1 | |
308// |------------->| |
309// | | |
310// | | SubReq1 |
311// | |------------->|
312// | | |
313// | SubReq2 | |
314// |------------->| |
315// | | |
316// | | SubReq2 |
317// | |------------->|
318// | | |
319// | | SubResp1 |
320// | |<-------------|
321// | | SubResp2 |
322// | |<-------------|
323// | | |
324// | SubResp1 | |
325// |<-------------| |
326// | SubResp2 | |
327// |<-------------| |
328// | | |
329// | [SUBS 1 DELETE] |
330// | | |
331// | [SUBS 2 DELETE] |
332// | | |
333//
334//-----------------------------------------------------------------------------
335func TestSubReqAndSubDelOkTwoParallel(t *testing.T) {
336 xapp.Logger.Info("TestSubReqAndSubDelOkTwoParallel")
337
338 //Req1
339 cretrans1 := xappConn1.handle_xapp_subs_req(t, nil)
340 crereq1, cremsg1 := e2termConn.handle_e2term_subs_req(t)
341
342 //Req2
343 cretrans2 := xappConn2.handle_xapp_subs_req(t, nil)
344 crereq2, cremsg2 := e2termConn.handle_e2term_subs_req(t)
345
346 //Resp1
347 e2termConn.handle_e2term_subs_resp(t, crereq1, cremsg1)
348 e2SubsId1 := xappConn1.handle_xapp_subs_resp(t, cretrans1)
349
350 //Resp2
351 e2termConn.handle_e2term_subs_resp(t, crereq2, cremsg2)
352 e2SubsId2 := xappConn2.handle_xapp_subs_resp(t, cretrans2)
353
354 //Del1
355 deltrans1 := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId1)
356 delreq1, delmsg1 := e2termConn.handle_e2term_subs_del_req(t)
357 e2termConn.handle_e2term_subs_del_resp(t, delreq1, delmsg1)
358 xappConn1.handle_xapp_subs_del_resp(t, deltrans1)
359 //Wait that subs is cleaned
360 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
361
362 //Del2
363 deltrans2 := xappConn2.handle_xapp_subs_del_req(t, nil, e2SubsId2)
364 delreq2, delmsg2 := e2termConn.handle_e2term_subs_del_req(t)
365 e2termConn.handle_e2term_subs_del_resp(t, delreq2, delmsg2)
366 xappConn2.handle_xapp_subs_del_resp(t, deltrans2)
367 //Wait that subs is cleaned
368 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
369
370 xappConn1.TestMsgCnt(t)
371 xappConn2.TestMsgCnt(t)
372 e2termConn.TestMsgCnt(t)
373}
374
375//-----------------------------------------------------------------------------
376// TestSameSubsDiffRan
377// Same subscription to different RANs
378//
379// stub stub
380// +-------+ +---------+ +---------+
381// | xapp | | submgr | | e2term |
382// +-------+ +---------+ +---------+
383// | | |
384// | | |
385// | | |
386// | SubReq(r1) | |
387// |------------->| |
388// | | |
389// | | SubReq(r1) |
390// | |------------->|
391// | | |
392// | | SubResp(r1) |
393// | |<-------------|
394// | | |
395// | SubResp(r1) | |
396// |<-------------| |
397// | | |
398// | SubReq(r2) | |
399// |------------->| |
400// | | |
401// | | SubReq(r2) |
402// | |------------->|
403// | | |
404// | | SubResp(r2) |
405// | |<-------------|
406// | | |
407// | SubResp(r2) | |
408// |<-------------| |
409// | | |
410// | [SUBS r1 DELETE] |
411// | | |
412// | [SUBS r2 DELETE] |
413// | | |
414//
415//-----------------------------------------------------------------------------
416func TestSameSubsDiffRan(t *testing.T) {
417 xapp.Logger.Info("TestSameSubsDiffRan")
418
419 //Req1
420 cretrans1 := xappConn1.newXappTransaction(nil, "RAN_NAME_1")
421 xappConn1.handle_xapp_subs_req(t, cretrans1)
422 crereq1, cremsg1 := e2termConn.handle_e2term_subs_req(t)
423 e2termConn.handle_e2term_subs_resp(t, crereq1, cremsg1)
424 e2SubsId1 := xappConn1.handle_xapp_subs_resp(t, cretrans1)
425
426 //Req2
427 cretrans2 := xappConn1.newXappTransaction(nil, "RAN_NAME_2")
428 xappConn1.handle_xapp_subs_req(t, cretrans2)
429 crereq2, cremsg2 := e2termConn.handle_e2term_subs_req(t)
430 e2termConn.handle_e2term_subs_resp(t, crereq2, cremsg2)
431 e2SubsId2 := xappConn1.handle_xapp_subs_resp(t, cretrans2)
432
433 //Del1
434 deltrans1 := xappConn1.newXappTransaction(nil, "RAN_NAME_1")
435 xappConn1.handle_xapp_subs_del_req(t, deltrans1, e2SubsId1)
436 delreq1, delmsg1 := e2termConn.handle_e2term_subs_del_req(t)
437 e2termConn.handle_e2term_subs_del_resp(t, delreq1, delmsg1)
438 xappConn1.handle_xapp_subs_del_resp(t, deltrans1)
439 //Wait that subs is cleaned
440 mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
441
442 //Del2
443 deltrans2 := xappConn1.newXappTransaction(nil, "RAN_NAME_2")
444 xappConn1.handle_xapp_subs_del_req(t, deltrans2, e2SubsId2)
445 delreq2, delmsg2 := e2termConn.handle_e2term_subs_del_req(t)
446 e2termConn.handle_e2term_subs_del_resp(t, delreq2, delmsg2)
447 xappConn1.handle_xapp_subs_del_resp(t, deltrans2)
448 //Wait that subs is cleaned
449 mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
450
451 xappConn1.TestMsgCnt(t)
452 xappConn2.TestMsgCnt(t)
453 e2termConn.TestMsgCnt(t)
454}
455
456//-----------------------------------------------------------------------------
457// TestSubReqRetryInSubmgr
458//
459// stub stub
460// +-------+ +---------+ +---------+
461// | xapp | | submgr | | e2term |
462// +-------+ +---------+ +---------+
463// | | |
464// | SubReq | |
465// |------------->| |
466// | | |
467// | | SubReq |
468// | |------------->|
469// | | |
470// | | |
471// | | SubReq |
472// | |------------->|
473// | | |
474// | | SubResp |
475// | |<-------------|
476// | | |
477// | SubResp | |
478// |<-------------| |
479// | | |
480// | [SUBS DELETE] |
481// | | |
482//
483//-----------------------------------------------------------------------------
484
485func TestSubReqRetryInSubmgr(t *testing.T) {
486
487 xapp.Logger.Info("TestSubReqRetryInSubmgr start")
488
489 // Xapp: Send SubsReq
490 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
491
492 // E2t: Receive 1st SubsReq
493 e2termConn.handle_e2term_subs_req(t)
494
495 // E2t: Receive 2nd SubsReq and send SubsResp
496 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
497 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
498
499 // Xapp: Receive SubsResp
500 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
501
502 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
503 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
504 e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
505 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
506
507 // Wait that subs is cleaned
508 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
509
510 xappConn1.TestMsgCnt(t)
511 xappConn2.TestMsgCnt(t)
512 e2termConn.TestMsgCnt(t)
513}
514
515//-----------------------------------------------------------------------------
516// TestSubReqTwoRetriesNoRespSubDelRespInSubmgr
517//
518// stub stub
519// +-------+ +---------+ +---------+
520// | xapp | | submgr | | e2term |
521// +-------+ +---------+ +---------+
522// | | |
523// | SubReq | |
524// |------------->| |
525// | | |
526// | | SubReq |
527// | |------------->|
528// | | |
529// | | |
530// | | SubReq |
531// | |------------->|
532// | | |
533// | | SubDelReq |
534// | |------------->|
535// | | |
536// | | |
537// | | SubDelReq |
538// | |------------->|
539// | | |
540// | | |
541// | | SubDelResp |
542// | |<-------------|
543// | | |
544//
545//-----------------------------------------------------------------------------
546
547func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
548
549 xapp.Logger.Info("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
550
551 // Xapp: Send SubsReq
552 xappConn1.handle_xapp_subs_req(t, nil)
553
554 // E2t: Receive 1st SubsReq
555 e2termConn.handle_e2term_subs_req(t)
556
557 // E2t: Receive 2nd SubsReq
558 e2termConn.handle_e2term_subs_req(t)
559
560 // E2t: Send receive SubsDelReq and send SubsResp
561 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
562 e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
563
564 // Wait that subs is cleaned
565 mainCtrl.wait_subs_clean(t, int(delreq.RequestId.Seq), 10)
566
567 xappConn1.TestMsgCnt(t)
568 xappConn2.TestMsgCnt(t)
569 e2termConn.TestMsgCnt(t)
570}
571
572//-----------------------------------------------------------------------------
573// TestSubReqTwoRetriesNoRespAtAllInSubmgr
574//
575// stub stub
576// +-------+ +---------+ +---------+
577// | xapp | | submgr | | e2term |
578// +-------+ +---------+ +---------+
579// | | |
580// | SubReq | |
581// |------------->| |
582// | | |
583// | | SubReq |
584// | |------------->|
585// | | |
586// | | |
587// | | SubReq |
588// | |------------->|
589// | | |
590// | | SubDelReq |
591// | |------------->|
592// | | |
593// | | |
594// | | SubDelReq |
595// | |------------->|
596// | | |
597// | | |
598//
599//-----------------------------------------------------------------------------
600
601func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) {
602
603 xapp.Logger.Info("TestSubReqTwoRetriesNoRespAtAllInSubmgr start")
604
605 // Xapp: Send SubsReq
606 xappConn1.handle_xapp_subs_req(t, nil)
607
608 // E2t: Receive 1st SubsReq
609 e2termConn.handle_e2term_subs_req(t)
610
611 // E2t: Receive 2nd SubsReq
612 e2termConn.handle_e2term_subs_req(t)
613
614 // E2t: Receive 1st SubsDelReq
615 e2termConn.handle_e2term_subs_del_req(t)
616
617 // E2t: Receive 2nd SubsDelReq
618 delreq, _ := e2termConn.handle_e2term_subs_del_req(t)
619
620 // Wait that subs is cleaned
621 mainCtrl.wait_subs_clean(t, int(delreq.RequestId.Seq), 15)
622
623 xappConn1.TestMsgCnt(t)
624 xappConn2.TestMsgCnt(t)
625 e2termConn.TestMsgCnt(t)
626}
627
628//-----------------------------------------------------------------------------
629// TestSubReqSubFailRespInSubmgr
630//
631// stub stub
632// +-------+ +---------+ +---------+
633// | xapp | | submgr | | e2term |
634// +-------+ +---------+ +---------+
635// | | |
636// | SubReq | |
637// |------------->| |
638// | | |
639// | | SubReq |
640// | |------------->|
641// | | |
642// | | SubFail |
643// | |<-------------|
644// | | |
645// | SubFail | |
646// |<-------------| |
647// | | |
648//
649//-----------------------------------------------------------------------------
650
651func TestSubReqSubFailRespInSubmgr(t *testing.T) {
652
653 xapp.Logger.Info("TestSubReqSubFailRespInSubmgr start")
654
655 // Xapp: Send SubsReq
656 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
657
658 // E2t: Receive SubsReq and send SubsFail
659 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
660 fparams := &test_subs_fail_params{}
661 fparams.Set(crereq)
662 e2termConn.handle_e2term_subs_fail(t, fparams, cremsg)
663
664 // Xapp: Receive SubsFail
665 e2SubsId := xappConn1.handle_xapp_subs_fail(t, cretrans)
666
667 // Wait that subs is cleaned
668 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
669
670 xappConn1.TestMsgCnt(t)
671 xappConn2.TestMsgCnt(t)
672 e2termConn.TestMsgCnt(t)
673}
674
675//-----------------------------------------------------------------------------
676// TestSubDelReqRetryInSubmgr
677//
678// stub stub
679// +-------+ +---------+ +---------+
680// | xapp | | submgr | | e2term |
681// +-------+ +---------+ +---------+
682// | | |
683// | [SUBS CREATE] |
684// | | |
685// | | |
686// | SubDelReq | |
687// |------------->| |
688// | | |
689// | | SubDelReq |
690// | |------------->|
691// | | |
692// | | SubDelReq |
693// | |------------->|
694// | | |
695// | | SubDelResp |
696// | |<-------------|
697// | | |
698// | SubDelResp | |
699// |<-------------| |
700//
701//-----------------------------------------------------------------------------
702
703func TestSubDelReqRetryInSubmgr(t *testing.T) {
704
705 xapp.Logger.Info("TestSubDelReqRetryInSubmgr start")
706
707 // Subs Create
708 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
709 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
710 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
711 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
712
713 // Subs Delete
714 // Xapp: Send SubsDelReq
715 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
716
717 // E2t: Receive 1st SubsDelReq
718 e2termConn.handle_e2term_subs_del_req(t)
719
720 // E2t: Receive 2nd SubsDelReq and send SubsDelResp
721 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
722 e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
723
724 // Xapp: Receive SubsDelResp
725 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
726
727 // Wait that subs is cleaned
728 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
729
730 xappConn1.TestMsgCnt(t)
731 xappConn2.TestMsgCnt(t)
732 e2termConn.TestMsgCnt(t)
733}
734
735//-----------------------------------------------------------------------------
736// TestSubDelReqTwoRetriesNoRespInSubmgr
737//
738// stub stub
739// +-------+ +---------+ +---------+
740// | xapp | | submgr | | e2term |
741// +-------+ +---------+ +---------+
742// | | |
743// | [SUBS CREATE] |
744// | | |
745// | | |
746// | SubDelReq | |
747// |------------->| |
748// | | |
749// | | SubDelReq |
750// | |------------->|
751// | | |
752// | | SubDelReq |
753// | |------------->|
754// | | |
755// | | |
756// | SubDelResp | |
757// |<-------------| |
758//
759//-----------------------------------------------------------------------------
760
761func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) {
762
763 xapp.Logger.Info("TestSubDelReTwoRetriesNoRespInSubmgr start")
764
765 // Subs Create
766 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
767 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
768 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
769 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
770
771 // Subs Delete
772 // Xapp: Send SubsDelReq
773 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
774
775 // E2t: Receive 1st SubsDelReq
776 e2termConn.handle_e2term_subs_del_req(t)
777
778 // E2t: Receive 2nd SubsDelReq
779 e2termConn.handle_e2term_subs_del_req(t)
780
781 // Xapp: Receive SubsDelResp
782 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
783
784 // Wait that subs is cleaned
785 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
786
787 xappConn1.TestMsgCnt(t)
788 xappConn2.TestMsgCnt(t)
789 e2termConn.TestMsgCnt(t)
790}
791
792//-----------------------------------------------------------------------------
793// TestSubDelReqSubDelFailRespInSubmgr
794//
795// stub stub
796// +-------+ +---------+ +---------+
797// | xapp | | submgr | | e2term |
798// +-------+ +---------+ +---------+
799// | | |
800// | [SUBS CREATE] |
801// | | |
802// | | |
803// | SubDelReq | |
804// |------------->| |
805// | | |
806// | | SubDelReq |
807// | |------------->|
808// | | |
809// | | SubDelFail |
810// | |<-------------|
811// | | |
812// | SubDelResp | |
813// |<-------------| |
814// | | |
815//
816//-----------------------------------------------------------------------------
817
818func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) {
819
820 xapp.Logger.Info("TestSubReqSubDelFailRespInSubmgr start")
821
822 // Subs Create
823 cretrans := xappConn1.handle_xapp_subs_req(t, nil)
824 crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
825 e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
826 e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
827
828 // Xapp: Send SubsDelReq
829 deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
830
831 // E2t: Send receive SubsDelReq and send SubsDelFail
832 delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
833 e2termConn.handle_e2term_subs_del_fail(t, delreq, delmsg)
834
835 // Xapp: Receive SubsDelResp
836 xappConn1.handle_xapp_subs_del_resp(t, deltrans)
837
838 // Wait that subs is cleaned
839 mainCtrl.wait_subs_clean(t, e2SubsId, 10)
840
841 xappConn1.TestMsgCnt(t)
842 xappConn2.TestMsgCnt(t)
843 e2termConn.TestMsgCnt(t)
844}