kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | package control |
| 21 | |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 22 | /* |
Juha Hyttinen | ff8dccd | 2019-12-10 14:34:07 +0200 | [diff] [blame] | 23 | #cgo LDFLAGS: -le2ap_wrapper -le2ap |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 24 | */ |
| 25 | import "C" |
| 26 | |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 27 | import ( |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 28 | "encoding/hex" |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 29 | "encoding/json" |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 30 | "fmt" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 31 | |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 32 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
| 33 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 34 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models" |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 35 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 36 | ) |
| 37 | |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 38 | var packerif e2ap.E2APPackerIf = e2ap_wrapper.NewAsn1E2Packer() |
| 39 | |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 40 | func GetPackerIf() e2ap.E2APPackerIf { |
| 41 | return packerif |
| 42 | } |
| 43 | |
| 44 | func SetPackerIf(iface e2ap.E2APPackerIf) { |
| 45 | packerif = iface |
| 46 | } |
| 47 | |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 48 | type E2ap struct { |
| 49 | } |
| 50 | |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 51 | //----------------------------------------------------------------------------- |
| 52 | // |
| 53 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 54 | func (e *E2ap) SetASN1DebugPrintStatus(logLevel int) { |
Anssi Mannila | e1af87f | 2021-11-10 13:10:54 +0200 | [diff] [blame] | 55 | e2ap_wrapper.SetASN1DebugPrintStatus(logLevel) |
| 56 | } |
| 57 | |
Himanshu Puorhit | 84662c4 | 2023-08-29 15:46:18 +0530 | [diff] [blame] | 58 | func (e *E2ap) SetE2IEOrderCheck(ieOrderCheck uint8) { |
| 59 | e2ap_wrapper.SetE2IEOrderCheck(ieOrderCheck) |
| 60 | } |
| 61 | |
Anssi Mannila | e1af87f | 2021-11-10 13:10:54 +0200 | [diff] [blame] | 62 | //----------------------------------------------------------------------------- |
| 63 | // |
| 64 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 65 | func (e *E2ap) FillSubscriptionReqMsgs(params interface{}, subreqList *e2ap.SubscriptionRequestList, restSubscription *RESTSubscription) error { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 66 | xapp.Logger.Debug("FillSubscriptionReqMsgs") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 67 | |
| 68 | p := params.(*models.SubscriptionParams) |
| 69 | |
| 70 | for _, subscriptionDetail := range p.SubscriptionDetails { |
| 71 | subReqMsg := e2ap.E2APSubscriptionRequest{} |
| 72 | |
| 73 | if p.RANFunctionID != nil { |
| 74 | subReqMsg.FunctionId = (e2ap.FunctionId)(*p.RANFunctionID) |
| 75 | } |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 76 | e2EventInstanceID := restSubscription.GetE2IdFromXappIdToE2Id(*subscriptionDetail.XappEventInstanceID) |
| 77 | subReqMsg.RequestId = e2ap.RequestId{uint32(*subscriptionDetail.XappEventInstanceID), uint32(e2EventInstanceID)} |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 78 | |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 79 | if len(subscriptionDetail.EventTriggers) > 0 { |
| 80 | for _, val := range subscriptionDetail.EventTriggers { |
| 81 | subReqMsg.EventTriggerDefinition.Data.Data = append(subReqMsg.EventTriggerDefinition.Data.Data, byte(val)) |
| 82 | } |
| 83 | subReqMsg.EventTriggerDefinition.Data.Length = uint64(len(subscriptionDetail.EventTriggers)) |
| 84 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 85 | for _, actionToBeSetup := range subscriptionDetail.ActionToBeSetupList { |
| 86 | actionToBeSetupItem := e2ap.ActionToBeSetupItem{} |
| 87 | actionToBeSetupItem.ActionType = e2ap.E2AP_ActionTypeInvalid |
| 88 | actionToBeSetupItem.ActionId = uint64(*actionToBeSetup.ActionID) |
| 89 | |
| 90 | actionToBeSetupItem.ActionType = e2ap.E2AP_ActionTypeStrMap[*actionToBeSetup.ActionType] |
| 91 | actionToBeSetupItem.RicActionDefinitionPresent = true |
| 92 | |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 93 | if len(actionToBeSetup.ActionDefinition) > 0 { |
| 94 | for _, val := range actionToBeSetup.ActionDefinition { |
| 95 | actionToBeSetupItem.ActionDefinitionChoice.Data.Data = append(actionToBeSetupItem.ActionDefinitionChoice.Data.Data, byte(val)) |
| 96 | } |
| 97 | actionToBeSetupItem.ActionDefinitionChoice.Data.Length = uint64(len(actionToBeSetup.ActionDefinition)) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 98 | |
| 99 | } |
| 100 | if actionToBeSetup.SubsequentAction != nil { |
| 101 | actionToBeSetupItem.SubsequentAction.Present = true |
| 102 | actionToBeSetupItem.SubsequentAction.Type = e2ap.E2AP_SubSeqActionTypeStrMap[*actionToBeSetup.SubsequentAction.SubsequentActionType] |
| 103 | actionToBeSetupItem.SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitStrMap[*actionToBeSetup.SubsequentAction.TimeToWait] |
| 104 | } |
| 105 | subReqMsg.ActionSetups = append(subReqMsg.ActionSetups, actionToBeSetupItem) |
| 106 | } |
| 107 | subreqList.E2APSubscriptionRequests = append(subreqList.E2APSubscriptionRequests, subReqMsg) |
| 108 | } |
| 109 | return nil |
| 110 | } |
| 111 | |
| 112 | //----------------------------------------------------------------------------- |
| 113 | // |
| 114 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 115 | func (e *E2ap) CheckActionNotAdmittedList(msgType int, actionNotAdmittedList e2ap.ActionNotAdmittedList, c *Control) ErrorInfo { |
| 116 | |
| 117 | var prefixString string |
| 118 | var errorInfo ErrorInfo |
| 119 | var actionNotAdmittedString string |
| 120 | if len(actionNotAdmittedList.Items) > 0 { |
| 121 | if msgType == xapp.RIC_SUB_RESP { |
| 122 | prefixString = "RICSubscriptionResponse partially accepted:" |
| 123 | c.UpdateCounter(cPartialSubRespFromE2) |
| 124 | } else if msgType == xapp.RIC_SUB_FAILURE { |
| 125 | prefixString = "RICSubscriptionFailure:" |
| 126 | } |
| 127 | jsonActionNotAdmittedList, err := json.Marshal(actionNotAdmittedList.Items) |
| 128 | if err != nil { |
| 129 | actionNotAdmittedString = "ActionNotAdmittedList > 0. Submgr json.Marshal error" |
| 130 | xapp.Logger.Error("CheckActionNotAdmittedList() json.Marshal error %s", err.Error()) |
| 131 | } else { |
| 132 | actionNotAdmittedString = "ActionNotAdmittedList: " + string(jsonActionNotAdmittedList) |
| 133 | } |
| 134 | } |
Anssi Mannila | 6bd5791 | 2022-06-16 09:47:23 +0300 | [diff] [blame] | 135 | |
| 136 | if msgType == xapp.RIC_SUB_FAILURE { |
| 137 | prefixString = "RICSubscriptionFailure" |
| 138 | err := fmt.Errorf("%s", prefixString) |
| 139 | errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") |
| 140 | } |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 141 | err := fmt.Errorf("%s %s", prefixString, actionNotAdmittedString) |
| 142 | errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") |
| 143 | return errorInfo |
| 144 | } |
| 145 | |
| 146 | //----------------------------------------------------------------------------- |
| 147 | // |
| 148 | //----------------------------------------------------------------------------- |
| 149 | func (e *E2ap) UnpackSubscriptionRequest(payload []byte) (*e2ap.E2APSubscriptionRequest, error) { |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 150 | e2SubReq := packerif.NewPackerSubscriptionRequest() |
Juha Hyttinen | a9bf76c | 2020-02-05 14:06:57 +0200 | [diff] [blame] | 151 | err, subReq := e2SubReq.UnPack(&e2ap.PackedData{payload}) |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 152 | if err != nil { |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 153 | return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 154 | } |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 155 | return subReq, nil |
| 156 | } |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 157 | |
Juha Hyttinen | a9bf76c | 2020-02-05 14:06:57 +0200 | [diff] [blame] | 158 | func (c *E2ap) PackSubscriptionRequest(req *e2ap.E2APSubscriptionRequest) (int, *e2ap.PackedData, error) { |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 159 | e2SubReq := packerif.NewPackerSubscriptionRequest() |
Juha Hyttinen | 01a4c49 | 2020-02-04 19:29:26 +0200 | [diff] [blame] | 160 | err, packedData := e2SubReq.Pack(req) |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 161 | if err != nil { |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 162 | return 0, nil, err |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 163 | } |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 164 | return xapp.RIC_SUB_REQ, packedData, nil |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | //----------------------------------------------------------------------------- |
| 168 | // |
| 169 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 170 | func (e *E2ap) UnpackSubscriptionResponse(payload []byte) (*e2ap.E2APSubscriptionResponse, error) { |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 171 | e2SubResp := packerif.NewPackerSubscriptionResponse() |
Juha Hyttinen | a9bf76c | 2020-02-05 14:06:57 +0200 | [diff] [blame] | 172 | err, subResp := e2SubResp.UnPack(&e2ap.PackedData{payload}) |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 173 | if err != nil { |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 174 | return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 175 | } |
| 176 | return subResp, nil |
| 177 | } |
| 178 | |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 179 | func (e *E2ap) PackSubscriptionResponse(req *e2ap.E2APSubscriptionResponse) (int, *e2ap.PackedData, error) { |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 180 | e2SubResp := packerif.NewPackerSubscriptionResponse() |
Juha Hyttinen | 01a4c49 | 2020-02-04 19:29:26 +0200 | [diff] [blame] | 181 | err, packedData := e2SubResp.Pack(req) |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 182 | if err != nil { |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 183 | return 0, nil, err |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 184 | } |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 185 | return xapp.RIC_SUB_RESP, packedData, nil |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | //----------------------------------------------------------------------------- |
| 189 | // |
| 190 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 191 | func (e *E2ap) UnpackSubscriptionFailure(payload []byte) (*e2ap.E2APSubscriptionFailure, error) { |
Juha Hyttinen | 60bfcf9 | 2020-01-14 15:14:24 +0200 | [diff] [blame] | 192 | e2SubFail := packerif.NewPackerSubscriptionFailure() |
Juha Hyttinen | a9bf76c | 2020-02-05 14:06:57 +0200 | [diff] [blame] | 193 | err, subFail := e2SubFail.UnPack(&e2ap.PackedData{payload}) |
Juha Hyttinen | 60bfcf9 | 2020-01-14 15:14:24 +0200 | [diff] [blame] | 194 | if err != nil { |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 195 | return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) |
Juha Hyttinen | 60bfcf9 | 2020-01-14 15:14:24 +0200 | [diff] [blame] | 196 | } |
| 197 | return subFail, nil |
| 198 | } |
| 199 | |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 200 | func (e *E2ap) PackSubscriptionFailure(req *e2ap.E2APSubscriptionFailure) (int, *e2ap.PackedData, error) { |
Juha Hyttinen | 60bfcf9 | 2020-01-14 15:14:24 +0200 | [diff] [blame] | 201 | e2SubFail := packerif.NewPackerSubscriptionFailure() |
Juha Hyttinen | 01a4c49 | 2020-02-04 19:29:26 +0200 | [diff] [blame] | 202 | err, packedData := e2SubFail.Pack(req) |
Juha Hyttinen | 60bfcf9 | 2020-01-14 15:14:24 +0200 | [diff] [blame] | 203 | if err != nil { |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 204 | return 0, nil, err |
Juha Hyttinen | 60bfcf9 | 2020-01-14 15:14:24 +0200 | [diff] [blame] | 205 | } |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 206 | return xapp.RIC_SUB_FAILURE, packedData, nil |
Juha Hyttinen | 60bfcf9 | 2020-01-14 15:14:24 +0200 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | //----------------------------------------------------------------------------- |
| 210 | // |
| 211 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 212 | func (e *E2ap) UnpackSubscriptionDeleteRequest(payload []byte) (*e2ap.E2APSubscriptionDeleteRequest, error) { |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 213 | e2SubDelReq := packerif.NewPackerSubscriptionDeleteRequest() |
Juha Hyttinen | a9bf76c | 2020-02-05 14:06:57 +0200 | [diff] [blame] | 214 | err, subDelReq := e2SubDelReq.UnPack(&e2ap.PackedData{payload}) |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 215 | if err != nil { |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 216 | return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 217 | } |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 218 | return subDelReq, nil |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 219 | } |
| 220 | |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 221 | func (e *E2ap) PackSubscriptionDeleteRequest(req *e2ap.E2APSubscriptionDeleteRequest) (int, *e2ap.PackedData, error) { |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 222 | e2SubDelReq := packerif.NewPackerSubscriptionDeleteRequest() |
Juha Hyttinen | 01a4c49 | 2020-02-04 19:29:26 +0200 | [diff] [blame] | 223 | err, packedData := e2SubDelReq.Pack(req) |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 224 | if err != nil { |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 225 | return 0, nil, err |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 226 | } |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 227 | return xapp.RIC_SUB_DEL_REQ, packedData, nil |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 228 | } |
| 229 | |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 230 | //----------------------------------------------------------------------------- |
| 231 | // |
| 232 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 233 | func (e *E2ap) UnpackSubscriptionDeleteResponse(payload []byte) (*e2ap.E2APSubscriptionDeleteResponse, error) { |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 234 | e2SubDelResp := packerif.NewPackerSubscriptionDeleteResponse() |
Juha Hyttinen | a9bf76c | 2020-02-05 14:06:57 +0200 | [diff] [blame] | 235 | err, subDelResp := e2SubDelResp.UnPack(&e2ap.PackedData{payload}) |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 236 | if err != nil { |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 237 | return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) |
Juha Hyttinen | aafee7f | 2020-01-14 14:54:51 +0200 | [diff] [blame] | 238 | } |
| 239 | return subDelResp, nil |
| 240 | } |
| 241 | |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 242 | func (e *E2ap) PackSubscriptionDeleteResponse(req *e2ap.E2APSubscriptionDeleteResponse) (int, *e2ap.PackedData, error) { |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 243 | e2SubDelResp := packerif.NewPackerSubscriptionDeleteResponse() |
Juha Hyttinen | 01a4c49 | 2020-02-04 19:29:26 +0200 | [diff] [blame] | 244 | err, packedData := e2SubDelResp.Pack(req) |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 245 | if err != nil { |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 246 | return 0, nil, err |
Juha Hyttinen | 86a4620 | 2020-01-14 12:49:09 +0200 | [diff] [blame] | 247 | } |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 248 | return xapp.RIC_SUB_DEL_RESP, packedData, nil |
Anssi Mannila | 8046c70 | 2020-01-02 13:39:05 +0200 | [diff] [blame] | 249 | } |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 250 | |
| 251 | //----------------------------------------------------------------------------- |
| 252 | // |
| 253 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 254 | func (e *E2ap) UnpackSubscriptionDeleteFailure(payload []byte) (*e2ap.E2APSubscriptionDeleteFailure, error) { |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 255 | e2SubDelFail := packerif.NewPackerSubscriptionDeleteFailure() |
Juha Hyttinen | a9bf76c | 2020-02-05 14:06:57 +0200 | [diff] [blame] | 256 | err, subDelFail := e2SubDelFail.UnPack(&e2ap.PackedData{payload}) |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 257 | if err != nil { |
Juha Hyttinen | 662f68d | 2020-01-15 14:49:18 +0200 | [diff] [blame] | 258 | return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 259 | } |
| 260 | return subDelFail, nil |
| 261 | } |
| 262 | |
Konstantinos Archangelof | 37f85a0 | 2021-05-24 12:30:06 +0000 | [diff] [blame] | 263 | /* |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 264 | func (e *E2ap) PackSubscriptionDeleteFailure(req *e2ap.E2APSubscriptionDeleteFailure) (int, *e2ap.PackedData, error) { |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 265 | e2SubDelFail := packerif.NewPackerSubscriptionDeleteFailure() |
Juha Hyttinen | 01a4c49 | 2020-02-04 19:29:26 +0200 | [diff] [blame] | 266 | err, packedData := e2SubDelFail.Pack(req) |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 267 | if err != nil { |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 268 | return 0, nil, err |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 269 | } |
Juha Hyttinen | 63284a2 | 2020-01-15 10:45:11 +0200 | [diff] [blame] | 270 | return xapp.RIC_SUB_DEL_FAILURE, packedData, nil |
Juha Hyttinen | 375c141 | 2020-01-14 20:17:50 +0200 | [diff] [blame] | 271 | } |
Konstantinos Archangelof | 37f85a0 | 2021-05-24 12:30:06 +0000 | [diff] [blame] | 272 | */ |
gunjarastogi | 4378baf | 2023-01-18 17:51:55 +0530 | [diff] [blame] | 273 | |
| 274 | //----------------------------------------------------------------------------- |
| 275 | // Changes to support "RIC_SUB_DEL_REQUIRED" |
| 276 | //----------------------------------------------------------------------------- |
| 277 | func (c *E2ap) UnpackSubscriptionDeleteRequired(payload []byte) (*e2ap.SubscriptionDeleteRequiredList, error) { |
| 278 | e2SubDelRequ := packerif.NewPackerSubscriptionDeleteRequired() |
| 279 | err, subsToBeRemove := e2SubDelRequ.UnPack(&e2ap.PackedData{payload}) |
| 280 | if err != nil { |
| 281 | return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) |
| 282 | } |
| 283 | return subsToBeRemove, nil |
| 284 | } |
| 285 | |
| 286 | func (c *E2ap) PackSubscriptionDeleteRequired(req *e2ap.SubscriptionDeleteRequiredList) (int, *e2ap.PackedData, error) { |
| 287 | e2SubDelRequ := packerif.NewPackerSubscriptionDeleteRequired() |
| 288 | err, packedData := e2SubDelRequ.Pack(req) |
| 289 | if err != nil { |
| 290 | return 0, nil, err |
| 291 | } |
| 292 | return xapp.RIC_SUB_DEL_REQUIRED, packedData, nil |
| 293 | } |