2 // Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
16 // This source code is part of the near-RT RIC (RAN Intelligent Controller)
17 // platform project (RICP).
24 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
27 type E2nodeConfigurationUpdateAcknowledgeE2APPDU struct {
28 XMLName xml.Name `xml:"E2AP-PDU"`
29 Text string `xml:",chardata"`
33 type E2nodeConfigurationUpdateAcknowledgeSuccessfulOutcome struct {
34 XMLName xml.Name `xml:"successfulOutcome"`
35 Text string `xml:",chardata"`
36 ProcedureCode string `xml:"procedureCode"`
38 Text string `xml:",chardata"`
39 Reject string `xml:"reject"`
42 Text string `xml:",chardata"`
43 E2nodeConfigurationUpdateAcknowledge struct {
44 Text string `xml:",chardata"`
46 Text string `xml:",chardata"`
47 E2nodeConfigurationUpdateAcknowledgeIEs []E2nodeConfigurationUpdateAcknowledgeIEs `xml:"E2nodeConfigurationUpdateAcknowledge-IEs"`
49 } `xml:"E2nodeConfigurationUpdateAcknowledge"`
53 type E2nodeConfigurationUpdateAcknowledgeIEs struct {
54 Text string `xml:",chardata"`
57 Text string `xml:",chardata"`
58 Reject string `xml:"reject"`
60 Value interface{} `xml:"value"`
63 type E2nodeConfigurationUpdateAcknowledgeTransID struct {
64 Text string `xml:",chardata"`
65 TransactionID string `xml:"TransactionID"`
68 type E2nodeComponentConfigAdditionAckList struct {
69 Text string `xml:",chardata"`
70 E2nodeComponentConfigAdditionAckList struct {
71 Text string `xml:",chardata"`
72 ProtocolIESingleContainer []AdditionListProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
73 } `xml:"E2nodeComponentConfigAdditionAck-List"`
76 type AdditionListProtocolIESingleContainer struct {
77 Text string `xml:",chardata"`
80 Text string `xml:",chardata"`
81 Reject string `xml:"reject"`
84 Text string `xml:",chardata"`
85 E2nodeComponentConfigAdditionAckItem ComponentAckDetail `xml:"E2nodeComponentConfigAdditionAck-Item"`
89 type E2nodeComponentConfigUpdateAckList struct {
90 Text string `xml:",chardata"`
91 E2nodeComponentConfigUpdateAckList struct {
92 Text string `xml:",chardata"`
93 ProtocolIESingleContainer []UpdateProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
94 } `xml:"E2nodeComponentConfigUpdateAck-List"`
97 type UpdateProtocolIESingleContainer struct {
98 Text string `xml:",chardata"`
101 Text string `xml:",chardata"`
102 Reject string `xml:"reject"`
103 } `xml:"criticality"`
105 Text string `xml:",chardata"`
106 E2nodeComponentConfigUpdateAckItem ComponentAckDetail `xml:"E2nodeComponentConfigUpdateAck-Item"`
110 type E2nodeComponentConfigRemovalAckList struct {
111 Text string `xml:",chardata"`
112 E2nodeComponentConfigRemovalAckList struct {
113 Text string `xml:",chardata"`
114 ProtocolIESingleContainer []RemovalProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
115 } `xml:"E2nodeComponentConfigRemovalAck-List"`
118 type RemovalProtocolIESingleContainer struct {
119 Text string `xml:",chardata"`
122 Text string `xml:",chardata"`
123 Reject string `xml:"reject"`
124 } `xml:"criticality"`
126 Text string `xml:",chardata"`
127 E2nodeComponentConfigRemovalAckItem ComponentAckDetail `xml:"E2nodeComponentConfigRemovalAck-Item"`
131 type ComponentAckDetail struct {
132 Text string `xml:",chardata"`
133 E2nodeComponentInterfaceType E2NodeComponentType `xml:"e2nodeComponentInterfaceType"`
134 E2nodeComponentID E2NodeComponentIDResp `xml:"e2nodeComponentID"`
135 E2nodeConfigUpdateAck E2nodeConfigUpdateAckResp
138 func prepareAdditionAckList(e2nodeConfigs []entities.E2NodeComponentConfig) []AdditionListProtocolIESingleContainer {
139 additionListAckSingle := []AdditionListProtocolIESingleContainer{}
140 for _, v := range e2nodeConfigs {
141 c := convertEntitiyToModelComponent(v)
143 t := AdditionListProtocolIESingleContainer{
144 ID: ProtocolIE_ID_id_E2nodeComponentConfigAdditionAck_Item,
146 Text string `xml:",chardata"`
147 E2nodeComponentConfigAdditionAckItem ComponentAckDetail `xml:"E2nodeComponentConfigAdditionAck-Item"`
149 E2nodeComponentConfigAdditionAckItem: *c,
152 additionListAckSingle = append(additionListAckSingle, t)
154 return additionListAckSingle
157 func prepareUpdateAckList(e2nodeConfigs []entities.E2NodeComponentConfig) []UpdateProtocolIESingleContainer {
158 updateListAckSingle := []UpdateProtocolIESingleContainer{}
159 for _, v := range e2nodeConfigs {
160 c := convertEntitiyToModelComponent(v)
162 t := UpdateProtocolIESingleContainer{
163 ID: ProtocolIE_ID_id_E2nodeComponentConfigUpdateAck_Item,
165 Text string `xml:",chardata"`
166 E2nodeComponentConfigUpdateAckItem ComponentAckDetail `xml:"E2nodeComponentConfigUpdateAck-Item"`
168 E2nodeComponentConfigUpdateAckItem: *c,
171 updateListAckSingle = append(updateListAckSingle, t)
173 return updateListAckSingle
176 func prepareRemovalAckList(e2nodeConfigs []entities.E2NodeComponentConfig) []RemovalProtocolIESingleContainer {
177 removalListAckSingle := []RemovalProtocolIESingleContainer{}
178 for _, v := range e2nodeConfigs {
179 c := convertEntitiyToModelComponent(v)
181 t := RemovalProtocolIESingleContainer{
182 ID: ProtocolIE_ID_id_E2nodeComponentConfigRemovalAck_Item,
184 Text string `xml:",chardata"`
185 E2nodeComponentConfigRemovalAckItem ComponentAckDetail `xml:"E2nodeComponentConfigRemovalAck-Item"`
187 E2nodeComponentConfigRemovalAckItem: *c,
190 removalListAckSingle = append(removalListAckSingle, t)
192 return removalListAckSingle
195 func updateIDAndStatus(t *ComponentAckDetail, c entities.E2NodeComponentConfig, succss bool) {
196 switch c.E2NodeComponentInterfaceType {
197 case entities.E2NodeComponentInterfaceType_ng:
198 t.E2nodeComponentID.Value = E2NodeIFTypeNG{
199 AMFName: c.GetE2NodeComponentInterfaceTypeNG().AmfName,
201 case entities.E2NodeComponentInterfaceType_e1:
202 t.E2nodeComponentID.Value = E2NodeIFTypeE1{
203 GNBCUCPID: c.GetE2NodeComponentInterfaceTypeE1().GetGNBCuCpId(),
205 case entities.E2NodeComponentInterfaceType_s1:
206 t.E2nodeComponentID.Value = E2NodeIFTypeS1{
207 MMENAME: c.GetE2NodeComponentInterfaceTypeS1().GetMmeName(),
209 case entities.E2NodeComponentInterfaceType_f1:
210 t.E2nodeComponentID.Value = E2NodeIFTypeF1{
211 GNBDUID: c.GetE2NodeComponentInterfaceTypeF1().GetGNBDuId(),
213 case entities.E2NodeComponentInterfaceType_w1:
214 t.E2nodeComponentID.Value = E2NodeIFTypeW1{
215 NGENBDUID: c.GetE2NodeComponentInterfaceTypeW1().GetNgenbDuId(),
220 t.E2nodeConfigUpdateAck = E2nodeConfigUpdateAckResp{
222 XMLName xml.Name `xml:"updateOutcome"`
223 Text string `xml:",chardata"`
224 Success string `xml:"success"`
228 t.E2nodeConfigUpdateAck = E2nodeConfigUpdateAckResp{
230 XMLName xml.Name `xml:"updateOutcome"`
231 Text string `xml:",chardata"`
232 Success string `xml:"failure"`
238 func updateInterfaceType(t *ComponentAckDetail, c entities.E2NodeComponentConfig) {
239 switch c.E2NodeComponentInterfaceType {
240 case entities.E2NodeComponentInterfaceType_ng:
241 t.E2nodeComponentInterfaceType = E2NodeComponentType{
244 case entities.E2NodeComponentInterfaceType_e1:
245 t.E2nodeComponentInterfaceType = E2NodeComponentType{
248 case entities.E2NodeComponentInterfaceType_f1:
249 t.E2nodeComponentInterfaceType = E2NodeComponentType{
252 case entities.E2NodeComponentInterfaceType_w1:
253 t.E2nodeComponentInterfaceType = E2NodeComponentType{
256 case entities.E2NodeComponentInterfaceType_s1:
257 t.E2nodeComponentInterfaceType = E2NodeComponentType{
263 func convertEntitiyToModelComponent(component entities.E2NodeComponentConfig) *ComponentAckDetail {
264 componentAckDetail := &ComponentAckDetail{}
265 updateInterfaceType(componentAckDetail, component)
266 updateIDAndStatus(componentAckDetail, component, true)
267 return componentAckDetail
270 func NewE2nodeConfigurationUpdateSuccessResponseMessage(e2nodeConfigupdateMessage *E2nodeConfigurationUpdateMessage) *E2nodeConfigurationUpdateAcknowledgeE2APPDU {
271 successfulOutcome := E2nodeConfigurationUpdateAcknowledgeSuccessfulOutcome{
272 ProcedureCode: ProcedureCode_id_E2nodeConfigurationUpdate,
275 e2nodeConfigurationUpdateAckIEs := []E2nodeConfigurationUpdateAcknowledgeIEs{}
276 txIEs := E2nodeConfigurationUpdateAcknowledgeIEs{
277 ID: ProtocolIE_ID_id_TransactionID,
278 Value: E2nodeConfigurationUpdateAcknowledgeTransID{
279 TransactionID: e2nodeConfigupdateMessage.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.TransactionID,
283 e2nodeConfigurationUpdateAckIEs = append(e2nodeConfigurationUpdateAckIEs, txIEs)
285 items := e2nodeConfigupdateMessage.ExtractConfigAdditionList()
287 addtionListAckIEs := E2nodeConfigurationUpdateAcknowledgeIEs{
288 ID: ProtocolIE_ID_id_E2nodeComponentConfigAdditionAck,
289 Value: E2nodeComponentConfigAdditionAckList{
290 E2nodeComponentConfigAdditionAckList: struct {
291 Text string `xml:",chardata"`
292 ProtocolIESingleContainer []AdditionListProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
294 ProtocolIESingleContainer: prepareAdditionAckList(items),
298 e2nodeConfigurationUpdateAckIEs = append(e2nodeConfigurationUpdateAckIEs, addtionListAckIEs)
301 items = e2nodeConfigupdateMessage.ExtractConfigUpdateList()
303 updateListAckIEs := E2nodeConfigurationUpdateAcknowledgeIEs{
304 ID: ProtocolIE_ID_id_E2nodeComponentConfigUpdateAck,
305 Value: E2nodeComponentConfigUpdateAckList{
306 E2nodeComponentConfigUpdateAckList: struct {
307 Text string `xml:",chardata"`
308 ProtocolIESingleContainer []UpdateProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
310 ProtocolIESingleContainer: prepareUpdateAckList(items),
314 e2nodeConfigurationUpdateAckIEs = append(e2nodeConfigurationUpdateAckIEs, updateListAckIEs)
317 items = e2nodeConfigupdateMessage.ExtractConfigDeletionList()
319 removalListAckIEs := E2nodeConfigurationUpdateAcknowledgeIEs{
320 ID: ProtocolIE_ID_id_E2nodeComponentConfigRemovalAck,
321 Value: E2nodeComponentConfigRemovalAckList{
322 E2nodeComponentConfigRemovalAckList: struct {
323 Text string `xml:",chardata"`
324 ProtocolIESingleContainer []RemovalProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
326 ProtocolIESingleContainer: prepareRemovalAckList(items),
330 e2nodeConfigurationUpdateAckIEs = append(e2nodeConfigurationUpdateAckIEs, removalListAckIEs)
333 successfulOutcome.Value.E2nodeConfigurationUpdateAcknowledge.ProtocolIEs.E2nodeConfigurationUpdateAcknowledgeIEs = e2nodeConfigurationUpdateAckIEs
334 response := &E2nodeConfigurationUpdateAcknowledgeE2APPDU{
335 Outcome: successfulOutcome,