Restructured test files. stubs locates in own files etc.
Change-Id: Idb5de62c8f7b13836f818bdbd8ec49244442965b
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go
new file mode 100644
index 0000000..3b43c3a
--- /dev/null
+++ b/pkg/control/ut_messaging_test.go
@@ -0,0 +1,844 @@
+/*
+==================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property.
+ Copyright (c) 2019 Nokia
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+
+package control
+
+import (
+ "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+ "testing"
+)
+
+//-----------------------------------------------------------------------------
+// TestSubReqAndRouteNok
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | rtmgr |
+// +-------+ +---------+ +---------+
+// | | |
+// | SubReq | |
+// |------------->| |
+// | | |
+// | | RouteCreate |
+// | |------------->|
+// | | |
+// | | RouteCreate |
+// | | status:400 |
+// | |<-------------|
+// | | |
+// | [SUBS INT DELETE] |
+// | | |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubReqAndRouteNok(t *testing.T) {
+ xapp.Logger.Info("TestSubReqAndRouteNok")
+
+ waiter := rtmgrHttp.AllocNextEvent(false)
+ newSubsId := mainCtrl.get_subid(t)
+ xappConn1.handle_xapp_subs_req(t, nil)
+ waiter.WaitResult(t)
+
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, int(newSubsId), 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqAndSubDelOk
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | SubReq | |
+// |------------->| |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | SubResp |
+// | |<-------------|
+// | | |
+// | SubResp | |
+// |<-------------| |
+// | | |
+// | | |
+// | SubDelReq | |
+// |------------->| |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | SubDelResp |
+// | |<-------------|
+// | | |
+// | SubDelResp | |
+// |<-------------| |
+//
+//-----------------------------------------------------------------------------
+func TestSubReqAndSubDelOk(t *testing.T) {
+ xapp.Logger.Info("TestSubReqAndSubDelOk")
+
+ waiter := rtmgrHttp.AllocNextEvent(true)
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+ waiter.WaitResult(t)
+
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+
+ waiter = rtmgrHttp.AllocNextEvent(true)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+ waiter.WaitResult(t)
+
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqRetransmission
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | SubReq | |
+// |------------->| |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | SubReq | |
+// | (retrans) | |
+// |------------->| |
+// | | |
+// | | SubResp |
+// | |<-------------|
+// | | |
+// | SubResp | |
+// |<-------------| |
+// | | |
+// | [SUBS DELETE] |
+// | | |
+//
+//-----------------------------------------------------------------------------
+func TestSubReqRetransmission(t *testing.T) {
+ xapp.Logger.Info("TestSubReqRetransmission")
+
+ //Subs Create
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+
+ seqBef := mainCtrl.get_msgcounter(t)
+ xappConn1.handle_xapp_subs_req(t, cretrans) //Retransmitted SubReq
+ mainCtrl.wait_msgcounter_change(t, seqBef, 10)
+
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+
+ //Subs Delete
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubDelReqRetransmission
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | [SUBS CREATE] |
+// | | |
+// | | |
+// | SubDelReq | |
+// |------------->| |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | SubDelReq | |
+// | (same sub) | |
+// | (same xid) | |
+// |------------->| |
+// | | |
+// | | SubDelResp |
+// | |<-------------|
+// | | |
+// | SubDelResp | |
+// |<-------------| |
+//
+//-----------------------------------------------------------------------------
+func TestSubDelReqRetransmission(t *testing.T) {
+ xapp.Logger.Info("TestSubDelReqRetransmission")
+
+ //Subs Create
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+
+ //Subs Delete
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+
+ seqBef := mainCtrl.get_msgcounter(t)
+ xappConn1.handle_xapp_subs_del_req(t, deltrans, e2SubsId) //Retransmitted SubDelReq
+ mainCtrl.wait_msgcounter_change(t, seqBef, 10)
+
+ e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubDelReqCollision
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | [SUBS CREATE] |
+// | | |
+// | | |
+// | SubDelReq | |
+// |------------->| |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | SubDelReq | |
+// | (same sub) | |
+// | (diff xid) | |
+// |------------->| |
+// | | |
+// | | SubDelResp |
+// | |<-------------|
+// | | |
+// | SubDelResp | |
+// |<-------------| |
+//
+//-----------------------------------------------------------------------------
+func TestSubDelReqCollision(t *testing.T) {
+ xapp.Logger.Info("TestSubDelReqCollision")
+
+ //Subs Create
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+
+ //Subs Delete
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+
+ seqBef := mainCtrl.get_msgcounter(t)
+ deltranscol := xappConn1.newXappTransaction(nil, "RAN_NAME_1")
+ xappConn1.handle_xapp_subs_del_req(t, deltranscol, e2SubsId) //Colliding SubDelReq
+ mainCtrl.wait_msgcounter_change(t, seqBef, 10)
+
+ e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqAndSubDelOkTwoParallel
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | | |
+// | | |
+// | SubReq1 | |
+// |------------->| |
+// | | |
+// | | SubReq1 |
+// | |------------->|
+// | | |
+// | SubReq2 | |
+// |------------->| |
+// | | |
+// | | SubReq2 |
+// | |------------->|
+// | | |
+// | | SubResp1 |
+// | |<-------------|
+// | | SubResp2 |
+// | |<-------------|
+// | | |
+// | SubResp1 | |
+// |<-------------| |
+// | SubResp2 | |
+// |<-------------| |
+// | | |
+// | [SUBS 1 DELETE] |
+// | | |
+// | [SUBS 2 DELETE] |
+// | | |
+//
+//-----------------------------------------------------------------------------
+func TestSubReqAndSubDelOkTwoParallel(t *testing.T) {
+ xapp.Logger.Info("TestSubReqAndSubDelOkTwoParallel")
+
+ //Req1
+ cretrans1 := xappConn1.handle_xapp_subs_req(t, nil)
+ crereq1, cremsg1 := e2termConn.handle_e2term_subs_req(t)
+
+ //Req2
+ cretrans2 := xappConn2.handle_xapp_subs_req(t, nil)
+ crereq2, cremsg2 := e2termConn.handle_e2term_subs_req(t)
+
+ //Resp1
+ e2termConn.handle_e2term_subs_resp(t, crereq1, cremsg1)
+ e2SubsId1 := xappConn1.handle_xapp_subs_resp(t, cretrans1)
+
+ //Resp2
+ e2termConn.handle_e2term_subs_resp(t, crereq2, cremsg2)
+ e2SubsId2 := xappConn2.handle_xapp_subs_resp(t, cretrans2)
+
+ //Del1
+ deltrans1 := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId1)
+ delreq1, delmsg1 := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq1, delmsg1)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans1)
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
+
+ //Del2
+ deltrans2 := xappConn2.handle_xapp_subs_del_req(t, nil, e2SubsId2)
+ delreq2, delmsg2 := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq2, delmsg2)
+ xappConn2.handle_xapp_subs_del_resp(t, deltrans2)
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSameSubsDiffRan
+// Same subscription to different RANs
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | | |
+// | | |
+// | SubReq(r1) | |
+// |------------->| |
+// | | |
+// | | SubReq(r1) |
+// | |------------->|
+// | | |
+// | | SubResp(r1) |
+// | |<-------------|
+// | | |
+// | SubResp(r1) | |
+// |<-------------| |
+// | | |
+// | SubReq(r2) | |
+// |------------->| |
+// | | |
+// | | SubReq(r2) |
+// | |------------->|
+// | | |
+// | | SubResp(r2) |
+// | |<-------------|
+// | | |
+// | SubResp(r2) | |
+// |<-------------| |
+// | | |
+// | [SUBS r1 DELETE] |
+// | | |
+// | [SUBS r2 DELETE] |
+// | | |
+//
+//-----------------------------------------------------------------------------
+func TestSameSubsDiffRan(t *testing.T) {
+ xapp.Logger.Info("TestSameSubsDiffRan")
+
+ //Req1
+ cretrans1 := xappConn1.newXappTransaction(nil, "RAN_NAME_1")
+ xappConn1.handle_xapp_subs_req(t, cretrans1)
+ crereq1, cremsg1 := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq1, cremsg1)
+ e2SubsId1 := xappConn1.handle_xapp_subs_resp(t, cretrans1)
+
+ //Req2
+ cretrans2 := xappConn1.newXappTransaction(nil, "RAN_NAME_2")
+ xappConn1.handle_xapp_subs_req(t, cretrans2)
+ crereq2, cremsg2 := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq2, cremsg2)
+ e2SubsId2 := xappConn1.handle_xapp_subs_resp(t, cretrans2)
+
+ //Del1
+ deltrans1 := xappConn1.newXappTransaction(nil, "RAN_NAME_1")
+ xappConn1.handle_xapp_subs_del_req(t, deltrans1, e2SubsId1)
+ delreq1, delmsg1 := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq1, delmsg1)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans1)
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId1, 10)
+
+ //Del2
+ deltrans2 := xappConn1.newXappTransaction(nil, "RAN_NAME_2")
+ xappConn1.handle_xapp_subs_del_req(t, deltrans2, e2SubsId2)
+ delreq2, delmsg2 := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq2, delmsg2)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans2)
+ //Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId2, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqRetryInSubmgr
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | SubReq | |
+// |------------->| |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | SubResp |
+// | |<-------------|
+// | | |
+// | SubResp | |
+// |<-------------| |
+// | | |
+// | [SUBS DELETE] |
+// | | |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubReqRetryInSubmgr(t *testing.T) {
+
+ xapp.Logger.Info("TestSubReqRetryInSubmgr start")
+
+ // Xapp: Send SubsReq
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+
+ // E2t: Receive 1st SubsReq
+ e2termConn.handle_e2term_subs_req(t)
+
+ // E2t: Receive 2nd SubsReq and send SubsResp
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+
+ // Xapp: Receive SubsResp
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+
+ // Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqTwoRetriesNoRespSubDelRespInSubmgr
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | SubReq | |
+// |------------->| |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | |
+// | | SubDelResp |
+// | |<-------------|
+// | | |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
+
+ xapp.Logger.Info("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
+
+ // Xapp: Send SubsReq
+ xappConn1.handle_xapp_subs_req(t, nil)
+
+ // E2t: Receive 1st SubsReq
+ e2termConn.handle_e2term_subs_req(t)
+
+ // E2t: Receive 2nd SubsReq
+ e2termConn.handle_e2term_subs_req(t)
+
+ // E2t: Send receive SubsDelReq and send SubsResp
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
+
+ // Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, int(delreq.RequestId.Seq), 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqTwoRetriesNoRespAtAllInSubmgr
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | SubReq | |
+// |------------->| |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) {
+
+ xapp.Logger.Info("TestSubReqTwoRetriesNoRespAtAllInSubmgr start")
+
+ // Xapp: Send SubsReq
+ xappConn1.handle_xapp_subs_req(t, nil)
+
+ // E2t: Receive 1st SubsReq
+ e2termConn.handle_e2term_subs_req(t)
+
+ // E2t: Receive 2nd SubsReq
+ e2termConn.handle_e2term_subs_req(t)
+
+ // E2t: Receive 1st SubsDelReq
+ e2termConn.handle_e2term_subs_del_req(t)
+
+ // E2t: Receive 2nd SubsDelReq
+ delreq, _ := e2termConn.handle_e2term_subs_del_req(t)
+
+ // Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, int(delreq.RequestId.Seq), 15)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubReqSubFailRespInSubmgr
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | SubReq | |
+// |------------->| |
+// | | |
+// | | SubReq |
+// | |------------->|
+// | | |
+// | | SubFail |
+// | |<-------------|
+// | | |
+// | SubFail | |
+// |<-------------| |
+// | | |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubReqSubFailRespInSubmgr(t *testing.T) {
+
+ xapp.Logger.Info("TestSubReqSubFailRespInSubmgr start")
+
+ // Xapp: Send SubsReq
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+
+ // E2t: Receive SubsReq and send SubsFail
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ fparams := &test_subs_fail_params{}
+ fparams.Set(crereq)
+ e2termConn.handle_e2term_subs_fail(t, fparams, cremsg)
+
+ // Xapp: Receive SubsFail
+ e2SubsId := xappConn1.handle_xapp_subs_fail(t, cretrans)
+
+ // Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubDelReqRetryInSubmgr
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | [SUBS CREATE] |
+// | | |
+// | | |
+// | SubDelReq | |
+// |------------->| |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | SubDelResp |
+// | |<-------------|
+// | | |
+// | SubDelResp | |
+// |<-------------| |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubDelReqRetryInSubmgr(t *testing.T) {
+
+ xapp.Logger.Info("TestSubDelReqRetryInSubmgr start")
+
+ // Subs Create
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+
+ // Subs Delete
+ // Xapp: Send SubsDelReq
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+
+ // E2t: Receive 1st SubsDelReq
+ e2termConn.handle_e2term_subs_del_req(t)
+
+ // E2t: Receive 2nd SubsDelReq and send SubsDelResp
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_resp(t, delreq, delmsg)
+
+ // Xapp: Receive SubsDelResp
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+
+ // Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubDelReqTwoRetriesNoRespInSubmgr
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | [SUBS CREATE] |
+// | | |
+// | | |
+// | SubDelReq | |
+// |------------->| |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | |
+// | SubDelResp | |
+// |<-------------| |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) {
+
+ xapp.Logger.Info("TestSubDelReTwoRetriesNoRespInSubmgr start")
+
+ // Subs Create
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+
+ // Subs Delete
+ // Xapp: Send SubsDelReq
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+
+ // E2t: Receive 1st SubsDelReq
+ e2termConn.handle_e2term_subs_del_req(t)
+
+ // E2t: Receive 2nd SubsDelReq
+ e2termConn.handle_e2term_subs_del_req(t)
+
+ // Xapp: Receive SubsDelResp
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+
+ // Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}
+
+//-----------------------------------------------------------------------------
+// TestSubDelReqSubDelFailRespInSubmgr
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | [SUBS CREATE] |
+// | | |
+// | | |
+// | SubDelReq | |
+// |------------->| |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | SubDelFail |
+// | |<-------------|
+// | | |
+// | SubDelResp | |
+// |<-------------| |
+// | | |
+//
+//-----------------------------------------------------------------------------
+
+func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) {
+
+ xapp.Logger.Info("TestSubReqSubDelFailRespInSubmgr start")
+
+ // Subs Create
+ cretrans := xappConn1.handle_xapp_subs_req(t, nil)
+ crereq, cremsg := e2termConn.handle_e2term_subs_req(t)
+ e2termConn.handle_e2term_subs_resp(t, crereq, cremsg)
+ e2SubsId := xappConn1.handle_xapp_subs_resp(t, cretrans)
+
+ // Xapp: Send SubsDelReq
+ deltrans := xappConn1.handle_xapp_subs_del_req(t, nil, e2SubsId)
+
+ // E2t: Send receive SubsDelReq and send SubsDelFail
+ delreq, delmsg := e2termConn.handle_e2term_subs_del_req(t)
+ e2termConn.handle_e2term_subs_del_fail(t, delreq, delmsg)
+
+ // Xapp: Receive SubsDelResp
+ xappConn1.handle_xapp_subs_del_resp(t, deltrans)
+
+ // Wait that subs is cleaned
+ mainCtrl.wait_subs_clean(t, e2SubsId, 10)
+
+ xappConn1.TestMsgCnt(t)
+ xappConn2.TestMsgCnt(t)
+ e2termConn.TestMsgCnt(t)
+}