2 // Copyright 2022 Samsung Electronics Co.
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).
25 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
28 type E2nodeConfigurationUpdateMessage struct {
29 XMLName xml.Name `xml:"E2nodeConfigurationUpdateMessage"`
30 Text string `xml:",chardata"`
32 Text string `xml:",chardata"`
33 InitiatingMessage struct {
34 Text string `xml:",chardata"`
35 ProcedureCode string `xml:"procedureCode"`
37 Text string `xml:",chardata"`
38 Reject string `xml:"reject"`
41 Text string `xml:",chardata"`
42 E2nodeConfigurationUpdate E2nodeConfigurationUpdate `xml:"E2nodeConfigurationUpdate"`
44 } `xml:"initiatingMessage"`
48 type E2nodeConfigurationUpdate struct {
49 Text string `xml:",chardata"`
51 Text string `xml:",chardata"`
52 E2nodeConfigurationUpdateIEs []E2nodeConfigurationUpdateIE `xml:"E2nodeConfigurationUpdate-IEs"`
56 type E2nodeConfigurationUpdateIE struct {
57 Text string `xml:",chardata"`
60 Text string `xml:",chardata"`
61 Reject string `xml:"reject"`
64 Text string `xml:",chardata"`
65 TransactionID string `xml:"TransactionID"`
66 E2nodeComponentConfigAdditionList E2nodeComponentConfigAdditionList `xml:"E2nodeComponentConfigAddition-List"`
67 E2nodeComponentConfigUpdateList E2nodeComponentConfigUpdateList `xml:"E2nodeComponentConfigUpdate-List"`
68 E2nodeComponentConfigRemovalList E2nodeComponentConfigRemovalList `xml:"E2nodeComponentConfigRemoval-List"`
72 type E2nodeComponentConfigAdditionList struct {
73 Text string `xml:",chardata"`
74 ProtocolIESingleContainer []struct {
75 Text string `xml:",chardata"`
78 Text string `xml:",chardata"`
79 Reject string `xml:"reject"`
82 Text string `xml:",chardata"`
83 E2nodeComponentConfigAdditionItem struct {
84 Text string `xml:",chardata"`
85 E2nodeComponentInterfaceType E2nodeComponentInterfaceType `xml:"e2nodeComponentInterfaceType"`
86 E2nodeComponentID E2nodeComponentID `xml:"e2nodeComponentID"`
87 E2nodeComponentConfiguration E2nodeComponentConfiguration `xml:"e2nodeComponentConfiguration"`
88 } `xml:"E2nodeComponentConfigAddition-Item"`
90 } `xml:"ProtocolIE-SingleContainer"`
93 type E2nodeComponentConfigUpdateList struct {
94 Text string `xml:",chardata"`
95 ProtocolIESingleContainer []struct {
96 Text string `xml:",chardata"`
99 Text string `xml:",chardata"`
100 Reject string `xml:"reject"`
101 } `xml:"criticality"`
103 Text string `xml:",chardata"`
104 E2nodeComponentConfigUpdateItem struct {
105 Text string `xml:",chardata"`
106 E2nodeComponentInterfaceType E2nodeComponentInterfaceType `xml:"e2nodeComponentInterfaceType"`
107 E2nodeComponentID E2nodeComponentID `xml:"e2nodeComponentID"`
108 E2nodeComponentConfiguration E2nodeComponentConfiguration `xml:"e2nodeComponentConfiguration"`
109 } `xml:"E2nodeComponentConfigUpdate-Item"`
111 } `xml:"ProtocolIE-SingleContainer"`
114 type E2nodeComponentConfigRemovalList struct {
115 Text string `xml:",chardata"`
116 ProtocolIESingleContainer []struct {
117 Text string `xml:",chardata"`
120 Text string `xml:",chardata"`
121 Reject string `xml:"reject"`
122 } `xml:"criticality"`
124 Text string `xml:",chardata"`
125 E2nodeComponentConfigRemovalItem struct {
126 Text string `xml:",chardata"`
127 E2nodeComponentInterfaceType E2nodeComponentInterfaceType `xml:"e2nodeComponentInterfaceType"`
128 E2nodeComponentID E2nodeComponentID `xml:"e2nodeComponentID"`
129 } `xml:"E2nodeComponentConfigRemoval-Item"`
131 } `xml:"ProtocolIE-SingleContainer"`
134 type E2nodeComponentInterfaceType struct {
135 Text string `xml:",chardata"`
136 Ng *struct{} `xml:"ng"`
137 Xn *struct{} `xml:"xn"`
138 E1 *struct{} `xml:"e1"`
139 F1 *struct{} `xml:"f1"`
140 W1 *struct{} `xml:"w1"`
141 S1 *struct{} `xml:"s1"`
142 X2 *struct{} `xml:"x2"`
145 type E2nodeComponentID struct {
146 Text string `xml:",chardata"`
147 E2nodeComponentInterfaceTypeNG struct {
148 Text string `xml:",chardata"`
149 AmfName string `xml:"amf-name"`
150 } `xml:"e2nodeComponentInterfaceTypeNG"`
151 E2nodeComponentInterfaceTypeXn struct {
152 Text string `xml:",chardata"`
153 GlobalNGRANNodeID string `xml:"global-NG-RAN-Node-ID"`
154 } `xml:"e2nodeComponentInterfaceTypeXn"`
155 E2nodeComponentInterfaceTypeE1 struct {
156 Text string `xml:",chardata"`
157 GNBCUCPID string `xml:"gNB-CU-CP-ID"`
158 } `xml:"e2nodeComponentInterfaceTypeE1"`
159 E2nodeComponentInterfaceTypeF1 struct {
160 Text string `xml:",chardata"`
161 GNBDUID string `xml:"gNB-DU-ID"`
162 } `xml:"e2nodeComponentInterfaceTypeF1"`
163 E2nodeComponentInterfaceTypeW1 struct {
164 Text string `xml:",chardata"`
165 NgENBDUID string `xml:"ng-eNB-DU-ID"`
166 } `xml:"e2nodeComponentInterfaceTypeW1"`
167 E2nodeComponentInterfaceTypeS1 struct {
168 Text string `xml:",chardata"`
169 MmeName string `xml:"mme-name"`
170 } `xml:"e2nodeComponentInterfaceTypeS1"`
171 E2nodeComponentInterfaceTypeX2 struct {
172 Text string `xml:",chardata"`
173 GlobalENBID string `xml:"global-eNB-ID"`
174 GlobalEnGNBID string `xml:"global-en-gNB-ID"`
175 } `xml:"e2nodeComponentInterfaceTypeX2"`
178 type E2nodeComponentConfiguration struct {
179 Text string `xml:",chardata"`
180 E2nodeComponentRequestPart string `xml:"e2nodeComponentRequestPart"`
181 E2nodeComponentResponsePart string `xml:"e2nodeComponentResponsePart"`
184 func (m *E2nodeConfigurationUpdateMessage) ExtractConfigAdditionList() []entities.E2NodeComponentConfig {
185 var result []entities.E2NodeComponentConfig
186 e2nodeConfigUpdateIEs := m.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs
188 var additionList *E2nodeComponentConfigAdditionList
189 for _, v := range e2nodeConfigUpdateIEs {
190 if v.ID == ProtocolIE_ID_id_E2nodeComponentConfigAddition {
191 additionList = &(v.Value.E2nodeComponentConfigAdditionList)
196 // need not to check for empty addtionList
197 // as list defined as SIZE(1..maxofE2nodeComponents)
198 if additionList != nil {
199 for _, val := range additionList.ProtocolIESingleContainer {
200 componentItem := val.Value.E2nodeComponentConfigAdditionItem
201 if componentItem.E2nodeComponentInterfaceType.Ng != nil { // NG Interface
202 result = append(result, entities.E2NodeComponentConfig{
203 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_ng,
204 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
205 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
206 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeNG{
207 E2NodeComponentInterfaceTypeNG: &entities.E2NodeComponentInterfaceNG{
208 AmfName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeNG.AmfName,
214 // TODO - Not Supported Yet
215 if componentItem.E2nodeComponentInterfaceType.Xn != nil { // xn inetrface
216 // result = append(result, entities.E2NodeComponentConfig{
217 // E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_xn,
218 // E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
219 // E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
220 // E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeXn{},
224 if componentItem.E2nodeComponentInterfaceType.E1 != nil { // e1 interface
225 gnbCuCpId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeE1.GNBCUCPID, 10, 64)
230 result = append(result, entities.E2NodeComponentConfig{
231 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_e1,
232 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
233 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
234 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeE1{
235 E2NodeComponentInterfaceTypeE1: &entities.E2NodeComponentInterfaceE1{
236 GNBCuCpId: gnbCuCpId,
242 if componentItem.E2nodeComponentInterfaceType.F1 != nil { // f1 interface
243 gnbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeF1.GNBDUID, 10, 64)
247 result = append(result, entities.E2NodeComponentConfig{
248 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_f1,
249 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
250 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
251 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeF1{
252 E2NodeComponentInterfaceTypeF1: &entities.E2NodeComponentInterfaceF1{
259 if componentItem.E2nodeComponentInterfaceType.W1 != nil { // w1 interface
260 ngenbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeW1.NgENBDUID, 10, 64)
265 result = append(result, entities.E2NodeComponentConfig{
266 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_w1,
267 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
268 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
269 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeW1{
270 E2NodeComponentInterfaceTypeW1: &entities.E2NodeComponentInterfaceW1{
271 NgenbDuId: ngenbDuId,
277 if componentItem.E2nodeComponentInterfaceType.S1 != nil { // s1 interface
278 result = append(result, entities.E2NodeComponentConfig{
279 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_s1,
280 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
281 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
282 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeS1{
283 E2NodeComponentInterfaceTypeS1: &entities.E2NodeComponentInterfaceS1{
284 MmeName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeS1.MmeName,
290 // TODO - Not Supported Yet
291 if componentItem.E2nodeComponentInterfaceType.X2 != nil { // x2 interface
292 // result = append(result, entities.E2NodeComponentConfig{
293 // E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_x2,
294 // E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
295 // E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
296 // E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeX2{},
305 func (m *E2nodeConfigurationUpdateMessage) ExtractConfigUpdateList() []entities.E2NodeComponentConfig {
306 var result []entities.E2NodeComponentConfig
307 e2nodeConfigUpdateIEs := m.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs
309 var updateList *E2nodeComponentConfigUpdateList
310 for _, v := range e2nodeConfigUpdateIEs {
312 updateList = &(v.Value.E2nodeComponentConfigUpdateList)
317 // need not to check for empty addtionList
318 // as list defined as SIZE(1..maxofE2nodeComponents)
319 if updateList != nil {
320 for _, val := range updateList.ProtocolIESingleContainer {
321 componentItem := val.Value.E2nodeComponentConfigUpdateItem
322 if componentItem.E2nodeComponentInterfaceType.Ng != nil { // NG Interface
323 result = append(result, entities.E2NodeComponentConfig{
324 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_ng,
325 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
326 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
327 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeNG{
328 E2NodeComponentInterfaceTypeNG: &entities.E2NodeComponentInterfaceNG{
329 AmfName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeNG.AmfName,
336 if componentItem.E2nodeComponentInterfaceType.Xn != nil { // xn inetrface
337 // TODO - Not Supported Yet
341 if componentItem.E2nodeComponentInterfaceType.E1 != nil { // e1 interface
342 gnbCuCpId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeE1.GNBCUCPID, 10, 64)
344 result = append(result, entities.E2NodeComponentConfig{
345 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_e1,
346 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
347 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
348 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeE1{
349 E2NodeComponentInterfaceTypeE1: &entities.E2NodeComponentInterfaceE1{
350 GNBCuCpId: gnbCuCpId,
358 if componentItem.E2nodeComponentInterfaceType.F1 != nil { // f1 interface
359 gnbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeF1.GNBDUID, 10, 64)
361 result = append(result, entities.E2NodeComponentConfig{
362 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_f1,
363 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
364 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
365 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeF1{
366 E2NodeComponentInterfaceTypeF1: &entities.E2NodeComponentInterfaceF1{
375 if componentItem.E2nodeComponentInterfaceType.W1 != nil { // w1 interface
376 ngenbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeW1.NgENBDUID, 10, 64)
378 result = append(result, entities.E2NodeComponentConfig{
379 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_w1,
380 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
381 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
382 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeW1{
383 E2NodeComponentInterfaceTypeW1: &entities.E2NodeComponentInterfaceW1{
384 NgenbDuId: ngenbDuId,
392 if componentItem.E2nodeComponentInterfaceType.S1 != nil { // s1 interface
393 result = append(result, entities.E2NodeComponentConfig{
394 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_s1,
395 E2NodeComponentRequestPart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentRequestPart),
396 E2NodeComponentResponsePart: []byte(componentItem.E2nodeComponentConfiguration.E2nodeComponentResponsePart),
397 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeS1{
398 E2NodeComponentInterfaceTypeS1: &entities.E2NodeComponentInterfaceS1{
399 MmeName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeS1.MmeName,
406 if componentItem.E2nodeComponentInterfaceType.X2 != nil { // x2 interface
407 // TODO - Not Supported Yet
415 func (m *E2nodeConfigurationUpdateMessage) ExtractConfigDeletionList() []entities.E2NodeComponentConfig {
416 var result []entities.E2NodeComponentConfig
417 e2nodeConfigUpdateIEs := m.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs
419 var deletionList *E2nodeComponentConfigRemovalList
420 for _, v := range e2nodeConfigUpdateIEs {
421 if v.ID == ProtocolIE_ID_id_E2nodeComponentConfigRemoval {
422 deletionList = &(v.Value.E2nodeComponentConfigRemovalList)
427 // need not to check for empty addtionList
428 // as list defined as SIZE(1..maxofE2nodeComponents)
429 if deletionList != nil {
430 for _, val := range deletionList.ProtocolIESingleContainer {
431 componentItem := val.Value.E2nodeComponentConfigRemovalItem
433 if componentItem.E2nodeComponentInterfaceType.Ng != nil { // NG Interface
434 result = append(result, entities.E2NodeComponentConfig{
435 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_ng,
436 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeNG{
437 E2NodeComponentInterfaceTypeNG: &entities.E2NodeComponentInterfaceNG{
438 AmfName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeNG.AmfName,
444 if componentItem.E2nodeComponentInterfaceType.Xn != nil { // xn inetrface
445 // TODO - Not Supported Yet
448 if componentItem.E2nodeComponentInterfaceType.E1 != nil { // e1 interface
449 gnbCuCpId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeE1.GNBCUCPID, 10, 64)
454 result = append(result, entities.E2NodeComponentConfig{
455 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_e1,
456 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeE1{
457 E2NodeComponentInterfaceTypeE1: &entities.E2NodeComponentInterfaceE1{
458 GNBCuCpId: gnbCuCpId,
464 if componentItem.E2nodeComponentInterfaceType.F1 != nil { // f1 interface
465 gnbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeF1.GNBDUID, 10, 64)
469 result = append(result, entities.E2NodeComponentConfig{
470 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_f1,
471 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeF1{
472 E2NodeComponentInterfaceTypeF1: &entities.E2NodeComponentInterfaceF1{
479 if componentItem.E2nodeComponentInterfaceType.W1 != nil { // w1 interface
480 ngenbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeW1.NgENBDUID, 10, 64)
485 result = append(result, entities.E2NodeComponentConfig{
486 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_w1,
487 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeW1{
488 E2NodeComponentInterfaceTypeW1: &entities.E2NodeComponentInterfaceW1{
489 NgenbDuId: ngenbDuId,
495 if componentItem.E2nodeComponentInterfaceType.S1 != nil { // s1 interface
496 result = append(result, entities.E2NodeComponentConfig{
497 E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_s1,
498 E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeS1{
499 E2NodeComponentInterfaceTypeS1: &entities.E2NodeComponentInterfaceS1{
500 MmeName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeS1.MmeName,
506 if componentItem.E2nodeComponentInterfaceType.X2 != nil { // x2 interface
507 // TODO - Not Supported Yet