2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
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
10 http://www.apache.org/licenses/LICENSE-2.0
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 ==================================================================================
23 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
27 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
31 func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteRequest(t *testing.T) {
33 testCtxt.SetDesc("SubsDeleteReq")
35 e2SubsReq := testCtxt.packerif.NewPackerSubscriptionDeleteRequest()
37 testCtxt.testPrint("########## ##########")
38 testCtxt.testPrint("init")
40 areqenc := e2ap.E2APSubscriptionDeleteRequest{}
41 areqenc.RequestId.Id = 1
42 areqenc.RequestId.Seq = 22
43 areqenc.FunctionId = 33
45 seterr := e2SubsReq.Set(&areqenc)
47 testCtxt.testError(t, "set err: %s", seterr.Error())
50 testCtxt.testPrint("print:\n%s", e2SubsReq.String())
51 testCtxt.testPrint("pack")
52 err, packedMsg := e2SubsReq.Pack(nil)
54 testCtxt.testError(t, "Pack failed: %s", err.Error())
57 testCtxt.testPrint("unpack")
58 err = e2SubsReq.UnPack(packedMsg)
60 testCtxt.testError(t, "UnPack failed: %s", err.Error())
63 testCtxt.testPrint("print:\n%s", e2SubsReq.String())
64 geterr, areqdec := e2SubsReq.Get()
66 testCtxt.testError(t, "get nil: %s", geterr.Error())
69 testCtxt.testValueEquality(t, "msg", &areqenc, areqdec)
72 func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteResponse(t *testing.T) {
74 testCtxt.SetDesc("SubsDeleteResp")
76 e2SubsResp := testCtxt.packerif.NewPackerSubscriptionDeleteResponse()
78 testCtxt.testPrint("########## ##########")
79 testCtxt.testPrint("init")
81 arespenc := e2ap.E2APSubscriptionDeleteResponse{}
82 arespenc.RequestId.Id = 1
83 arespenc.RequestId.Seq = 22
84 arespenc.FunctionId = 33
86 seterr := e2SubsResp.Set(&arespenc)
88 testCtxt.testError(t, "set err: %s", seterr.Error())
91 testCtxt.testPrint("print:\n%s", e2SubsResp.String())
92 testCtxt.testPrint("pack")
93 err, packedMsg := e2SubsResp.Pack(nil)
95 testCtxt.testError(t, "Pack failed: %s", err.Error())
98 testCtxt.testPrint("unpack")
99 err = e2SubsResp.UnPack(packedMsg)
101 testCtxt.testError(t, "UnPack failed: %s", err.Error())
104 testCtxt.testPrint("print:\n%s", e2SubsResp.String())
105 geterr, arespdec := e2SubsResp.Get()
107 testCtxt.testError(t, "get nil: %s", geterr.Error())
110 testCtxt.testValueEquality(t, "msg", &arespenc, arespdec)
113 func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteFailure(t *testing.T) {
115 testCtxt.SetDesc("SubsDeleteFail")
117 e2SubsFail := testCtxt.packerif.NewPackerSubscriptionDeleteFailure()
119 testCtxt.testPrint("########## ##########")
120 testCtxt.testPrint("init")
122 afailenc := e2ap.E2APSubscriptionDeleteFailure{}
123 afailenc.RequestId.Id = 1
124 afailenc.RequestId.Seq = 22
125 afailenc.FunctionId = 33
126 afailenc.Cause.Content = 1
127 afailenc.Cause.CauseVal = 1
128 // NOT SUPPORTED CURRENTLY
129 // afailenc.CriticalityDiagnostics.Present = false
130 // afailenc.CriticalityDiagnostics.ProcCodePresent = true
131 // afailenc.CriticalityDiagnostics.ProcCode = 1
132 // afailenc.CriticalityDiagnostics.TrigMsgPresent = true
133 // afailenc.CriticalityDiagnostics.TrigMsg = 2
134 // afailenc.CriticalityDiagnostics.ProcCritPresent = true
135 // afailenc.CriticalityDiagnostics.ProcCrit = e2ap.E2AP_CriticalityReject
136 // for index := uint32(0); index < 256; index++ {
137 // ieitem := e2ap.CriticalityDiagnosticsIEListItem{}
138 // ieitem.IeCriticality = e2ap.E2AP_CriticalityReject
139 // ieitem.IeID = index
140 // ieitem.TypeOfError = 1
141 // afailenc.CriticalityDiagnostics.CriticalityDiagnosticsIEList.Items = append(afailenc.CriticalityDiagnostics.CriticalityDiagnosticsIEList.Items, ieitem)
144 seterr := e2SubsFail.Set(&afailenc)
146 testCtxt.testError(t, "set err: %s", seterr.Error())
149 testCtxt.testPrint("print:\n%s", e2SubsFail.String())
150 testCtxt.testPrint("pack")
151 err, packedMsg := e2SubsFail.Pack(nil)
153 testCtxt.testError(t, "Pack failed: %s", err.Error())
156 testCtxt.testPrint("unpack")
157 err = e2SubsFail.UnPack(packedMsg)
159 testCtxt.testError(t, "UnPack failed: %s", err.Error())
162 testCtxt.testPrint("print:\n%s", e2SubsFail.String())
163 geterr, afaildec := e2SubsFail.Get()
165 testCtxt.testError(t, "get nil: %s", geterr.Error())
168 testCtxt.testValueEquality(t, "msg", &afailenc, afaildec)