+//-----------------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------------
+func (xappConn *testingXappControl) handle_xapp_subs_fail(t *testing.T, trans *xappTransaction) int {
+ xapp.Logger.Info("handle_xapp_subs_fail")
+ e2SubsFail := e2asnpacker.NewPackerSubscriptionFailure()
+ var e2SubsId int
+
+ //-------------------------------
+ // xapp activity: Recv Subs Fail
+ //-------------------------------
+ select {
+ case msg := <-xappConn.rmrConChan:
+ if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_FAILURE"] {
+ testError(t, "(%s) Received RIC_SUB_FAILURE wrong mtype expected %s got %s, error", xappConn.desc, "RIC_SUB_FAILURE", xapp.RicMessageTypeToName[msg.Mtype])
+ return -1
+ } else if msg.Xid != trans.xid {
+ testError(t, "(%s) Received RIC_SUB_FAILURE wrong xid expected %s got %s, error", xappConn.desc, trans.xid, msg.Xid)
+ return -1
+ } else {
+ packedData := &packer.PackedData{}
+ packedData.Buf = msg.Payload
+ e2SubsId = msg.SubId
+ unpackerr := e2SubsFail.UnPack(packedData)
+
+ if unpackerr != nil {
+ testError(t, "(%s) RIC_SUB_FAILURE unpack failed err: %s", xappConn.desc, unpackerr.Error())
+ }
+ geterr, resp := e2SubsFail.Get()
+ if geterr != nil {
+ testError(t, "(%s) RIC_SUB_FAILURE get failed err: %s", xappConn.desc, geterr.Error())
+ }
+
+ xapp.Logger.Info("(%s) Recv Subs Fail rmr: xid=%s subid=%d, asn: seqnro=%d", xappConn.desc, msg.Xid, msg.SubId, resp.RequestId.Seq)
+ return e2SubsId
+ }
+ case <-time.After(15 * time.Second):
+ testError(t, "(%s) Not Received RIC_SUB_FAILURE within 15 secs", xappConn.desc)
+ return -1
+ }
+ return -1
+}
+