Add method to extract removal list 45/8145/2
authorsubhash kumar singh <subh.singh@samsung.com>
Wed, 4 May 2022 12:15:16 +0000 (12:15 +0000)
committersubhash kumar singh <subh.singh@samsung.com>
Tue, 10 May 2022 16:14:32 +0000 (16:14 +0000)
Added method to extract configuration removal item.
Note: Xn and X2 interface is not supported.

Signed-off-by: subhash kumar singh <subh.singh@samsung.com>
Change-Id: I28aee1d228d422132eef9a091f2d57270fc15246

E2Manager/models/constants.go
E2Manager/models/e2_node_configuration_update.go
E2Manager/models/e2_node_configuration_update_test.go
E2Manager/tests/resources/configurationUpdate/e2NodeConfigurationUpdate.xml

index c67b9a4..2d1d235 100644 (file)
@@ -23,6 +23,7 @@ const (
        ProtocolIE_ID_id_RANfunctionsAccepted          = "9"
        ProtocolIE_ID_id_TransactionID                 = "49"
        ProtocolIE_ID_id_E2nodeComponentConfigAddition = "50"
+       ProtocolIE_ID_id_E2nodeComponentConfigRemoval  = "54"
 )
 
 const (
index 87c55d6..cbd8beb 100644 (file)
@@ -410,3 +410,102 @@ func (m *E2nodeConfigurationUpdateMessage) ExtractConfigUpdateList() []entities.
        }
        return result
 }
+
+func (m *E2nodeConfigurationUpdateMessage) ExtractConfigDeletionList() []entities.E2NodeComponentConfig {
+       var result []entities.E2NodeComponentConfig
+       e2nodeConfigUpdateIEs := m.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs
+
+       var deletionList *E2nodeComponentConfigRemovalList
+       for _, v := range e2nodeConfigUpdateIEs {
+               if v.ID == ProtocolIE_ID_id_E2nodeComponentConfigRemoval {
+                       deletionList = &(v.Value.E2nodeComponentConfigRemovalList)
+                       break
+               }
+       }
+
+       // need not to check for empty addtionList
+       // as list defined as SIZE(1..maxofE2nodeComponents)
+       if deletionList != nil {
+               for _, val := range deletionList.ProtocolIESingleContainer {
+                       componentItem := val.Value.E2nodeComponentConfigRemovalItem
+
+                       if componentItem.E2nodeComponentInterfaceType.Ng != nil { // NG Interface
+                               result = append(result, entities.E2NodeComponentConfig{
+                                       E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_ng,
+                                       E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeNG{
+                                               E2NodeComponentInterfaceTypeNG: &entities.E2NodeComponentInterfaceNG{
+                                                       AmfName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeNG.AmfName,
+                                               },
+                                       },
+                               })
+                       }
+
+                       if componentItem.E2nodeComponentInterfaceType.Xn != nil { // xn inetrface
+                               // TODO - Not Supported Yet
+                       }
+
+                       if componentItem.E2nodeComponentInterfaceType.E1 != nil { // e1 interface
+                               gnbCuCpId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeE1.GNBCUCPID, 10, 64)
+                               if err != nil {
+                                       continue
+                               }
+
+                               result = append(result, entities.E2NodeComponentConfig{
+                                       E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_e1,
+                                       E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeE1{
+                                               E2NodeComponentInterfaceTypeE1: &entities.E2NodeComponentInterfaceE1{
+                                                       GNBCuCpId: gnbCuCpId,
+                                               },
+                                       },
+                               })
+                       }
+
+                       if componentItem.E2nodeComponentInterfaceType.F1 != nil { // f1 interface
+                               gnbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeF1.GNBDUID, 10, 64)
+                               if err != nil {
+                                       continue
+                               }
+                               result = append(result, entities.E2NodeComponentConfig{
+                                       E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_f1,
+                                       E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeF1{
+                                               E2NodeComponentInterfaceTypeF1: &entities.E2NodeComponentInterfaceF1{
+                                                       GNBDuId: gnbDuId,
+                                               },
+                                       },
+                               })
+                       }
+
+                       if componentItem.E2nodeComponentInterfaceType.W1 != nil { // w1 interface
+                               ngenbDuId, err := strconv.ParseInt(componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeW1.NgENBDUID, 10, 64)
+                               if err != nil {
+                                       continue
+                               }
+
+                               result = append(result, entities.E2NodeComponentConfig{
+                                       E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_w1,
+                                       E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeW1{
+                                               E2NodeComponentInterfaceTypeW1: &entities.E2NodeComponentInterfaceW1{
+                                                       NgenbDuId: ngenbDuId,
+                                               },
+                                       },
+                               })
+                       }
+
+                       if componentItem.E2nodeComponentInterfaceType.S1 != nil { // s1 interface
+                               result = append(result, entities.E2NodeComponentConfig{
+                                       E2NodeComponentInterfaceType: entities.E2NodeComponentInterfaceType_s1,
+                                       E2NodeComponentID: &entities.E2NodeComponentConfig_E2NodeComponentInterfaceTypeS1{
+                                               E2NodeComponentInterfaceTypeS1: &entities.E2NodeComponentInterfaceS1{
+                                                       MmeName: componentItem.E2nodeComponentID.E2nodeComponentInterfaceTypeS1.MmeName,
+                                               },
+                                       },
+                               })
+                       }
+
+                       if componentItem.E2nodeComponentInterfaceType.X2 != nil { // x2 interface
+                               // TODO - Not Supported Yet
+                       }
+               }
+       }
+       return result
+}
index f1bed7d..add48c4 100644 (file)
@@ -98,3 +98,15 @@ func TestExtractUpdateConfigList(t *testing.T) {
 
        assert.Equal(t, 0, len(updateList2), "Update List is not matching")
 }
+
+func TestExtractDeleteConfigList(t *testing.T) {
+       configurationRemoval1 := getTestE2NodeConfigurationUpdateMessage(t, e2NodeConfigurationUpdateXmlPath)
+       removalList1 := configurationRemoval1.ExtractConfigDeletionList()
+
+       assert.Equal(t, 5, len(removalList1), "Removal List is not matching")
+
+       configurationRemoval2 := getTestE2NodeConfigurationUpdateMessage(t, e2NodeConfigurationUpdateOnlyAdditionXmlPath)
+       removalList2 := configurationRemoval2.ExtractConfigDeletionList()
+
+       assert.Equal(t, 0, len(removalList2), "Removal List is not matching")
+}
index 86bd1c2..2f81148 100644 (file)
                                             <e2nodeComponentInterfaceType><e1/></e2nodeComponentInterfaceType>
                                             <e2nodeComponentID>
                                                 <e2nodeComponentInterfaceTypeE1>
-                                                    <gNB-CU-CP-ID>e1interf</gNB-CU-CP-ID>
+                                                    <gNB-CU-CP-ID>1234</gNB-CU-CP-ID>
                                                 </e2nodeComponentInterfaceTypeE1>
                                             </e2nodeComponentID>
                                         </E2nodeComponentConfigRemoval-Item>
                                             <e2nodeComponentInterfaceType><f1/></e2nodeComponentInterfaceType>
                                             <e2nodeComponentID>
                                                 <e2nodeComponentInterfaceTypeF1>
-                                                    <gNB-DU-ID>f1interf</gNB-DU-ID>
+                                                    <gNB-DU-ID>2345</gNB-DU-ID>
                                                 </e2nodeComponentInterfaceTypeF1>
                                             </e2nodeComponentID>
                                         </E2nodeComponentConfigRemoval-Item>
                                             <e2nodeComponentInterfaceType><w1/></e2nodeComponentInterfaceType>
                                             <e2nodeComponentID>
                                                 <e2nodeComponentInterfaceTypeW1>
-                                                    <ng-eNB-DU-ID>w1interf</ng-eNB-DU-ID>
+                                                    <ng-eNB-DU-ID>3456</ng-eNB-DU-ID>
                                                 </e2nodeComponentInterfaceTypeW1>
                                             </e2nodeComponentID>
                                         </E2nodeComponentConfigRemoval-Item>