From: subhash kumar singh Date: Mon, 2 May 2022 11:47:16 +0000 (+0000) Subject: Model for E2nodeConfigurationUpdate message X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=e5f9d7a7ac49f7b2f90bd1b1f1a48cb8970c0994;p=ric-plt%2Fe2mgr.git Model for E2nodeConfigurationUpdate message Model for E2nodeConfigurationUpdate message has been implemented to parse the xml message received from e2-node. Note: Currently we treated compnent ID for Xn and X2 interface as string which need to be further expanded. Signed-off-by: subhash kumar singh Change-Id: Ife81dbb2ede49d0a63ce38725287cad7f342ef54 --- diff --git a/E2Manager/models/e2_node_configuration_update.go b/E2Manager/models/e2_node_configuration_update.go new file mode 100644 index 0000000..6677ba6 --- /dev/null +++ b/E2Manager/models/e2_node_configuration_update.go @@ -0,0 +1,178 @@ +// +// Copyright 2022 Samsung Electronics Co. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This source code is part of the near-RT RIC (RAN Intelligent Controller) +// platform project (RICP). + +package models + +import ( + "encoding/xml" +) + +type E2nodeConfigurationUpdateMessage struct { + XMLName xml.Name `xml:"E2nodeConfigurationUpdateMessage"` + Text string `xml:",chardata"` + E2APPDU struct { + Text string `xml:",chardata"` + InitiatingMessage struct { + Text string `xml:",chardata"` + ProcedureCode string `xml:"procedureCode"` + Criticality struct { + Text string `xml:",chardata"` + Reject string `xml:"reject"` + } `xml:"criticality"` + Value struct { + Text string `xml:",chardata"` + E2nodeConfigurationUpdate E2nodeConfigurationUpdate `xml:"E2nodeConfigurationUpdate"` + } `xml:"value"` + } `xml:"initiatingMessage"` + } `xml:"E2AP-PDU"` +} + +type E2nodeConfigurationUpdate struct { + Text string `xml:",chardata"` + ProtocolIEs struct { + Text string `xml:",chardata"` + E2nodeConfigurationUpdateIEs []E2nodeConfigurationUpdateIE `xml:"E2nodeConfigurationUpdate-IEs"` + } `xml:"protocolIEs"` +} + +type E2nodeConfigurationUpdateIE struct { + Text string `xml:",chardata"` + ID string `xml:"id"` + Criticality struct { + Text string `xml:",chardata"` + Reject string `xml:"reject"` + } `xml:"criticality"` + Value struct { + Text string `xml:",chardata"` + E2nodeComponentConfigAdditionList E2nodeComponentConfigAdditionList `xml:"E2nodeComponentConfigAddition-List"` + E2nodeComponentConfigUpdateList E2nodeComponentConfigUpdateList `xml:"E2nodeComponentConfigUpdate-List"` + E2nodeComponentConfigRemovalList E2nodeComponentConfigRemovalList `xml:"E2nodeComponentConfigRemoval-List"` + } `xml:"value"` +} + +type E2nodeComponentConfigAdditionList struct { + Text string `xml:",chardata"` + ProtocolIESingleContainer []struct { + Text string `xml:",chardata"` + ID string `xml:"id"` + Criticality struct { + Text string `xml:",chardata"` + Reject string `xml:"reject"` + } `xml:"criticality"` + Value struct { + Text string `xml:",chardata"` + E2nodeComponentConfigAdditionItem struct { + Text string `xml:",chardata"` + E2nodeComponentInterfaceType E2nodeComponentInterfaceType `xml:"e2nodeComponentInterfaceType"` + E2nodeComponentID E2nodeComponentID `xml:"e2nodeComponentID"` + E2nodeComponentConfiguration E2nodeComponentConfiguration `xml:"e2nodeComponentConfiguration"` + } `xml:"E2nodeComponentConfigAddition-Item"` + } `xml:"value"` + } `xml:"ProtocolIE-SingleContainer"` +} + +type E2nodeComponentConfigUpdateList struct { + Text string `xml:",chardata"` + ProtocolIESingleContainer []struct { + Text string `xml:",chardata"` + ID string `xml:"id"` + Criticality struct { + Text string `xml:",chardata"` + Reject string `xml:"reject"` + } `xml:"criticality"` + Value struct { + Text string `xml:",chardata"` + E2nodeComponentConfigUpdateItem struct { + Text string `xml:",chardata"` + E2nodeComponentInterfaceType E2nodeComponentInterfaceType `xml:"e2nodeComponentInterfaceType"` + E2nodeComponentID E2nodeComponentID `xml:"e2nodeComponentID"` + E2nodeComponentConfiguration E2nodeComponentConfiguration `xml:"e2nodeComponentConfiguration"` + } `xml:"E2nodeComponentConfigUpdate-Item"` + } `xml:"value"` + } `xml:"ProtocolIE-SingleContainer"` +} + +type E2nodeComponentConfigRemovalList struct { + Text string `xml:",chardata"` + ProtocolIESingleContainer []struct { + Text string `xml:",chardata"` + ID string `xml:"id"` + Criticality struct { + Text string `xml:",chardata"` + Reject string `xml:"reject"` + } `xml:"criticality"` + Value struct { + Text string `xml:",chardata"` + E2nodeComponentConfigRemovalItem struct { + Text string `xml:",chardata"` + E2nodeComponentInterfaceType E2nodeComponentInterfaceType `xml:"e2nodeComponentInterfaceType"` + E2nodeComponentID E2nodeComponentID `xml:"e2nodeComponentID"` + } `xml:"E2nodeComponentConfigRemoval-Item"` + } `xml:"value"` + } `xml:"ProtocolIE-SingleContainer"` +} + +type E2nodeComponentInterfaceType struct { + Text string `xml:",chardata"` + Ng *struct{} `xml:"ng"` + Xn *struct{} `xml:"xn"` + E1 *struct{} `xml:"e1"` + F1 *struct{} `xml:"f1"` + W1 *struct{} `xml:"w1"` + S1 *struct{} `xml:"s1"` + X2 *struct{} `xml:"x2"` +} + +type E2nodeComponentID struct { + Text string `xml:",chardata"` + E2nodeComponentInterfaceTypeNG struct { + Text string `xml:",chardata"` + AmfName string `xml:"amf-name"` + } `xml:"e2nodeComponentInterfaceTypeNG"` + E2nodeComponentInterfaceTypeXn struct { + Text string `xml:",chardata"` + GlobalNGRANNodeID string `xml:"global-NG-RAN-Node-ID"` + } `xml:"e2nodeComponentInterfaceTypeXn"` + E2nodeComponentInterfaceTypeE1 struct { + Text string `xml:",chardata"` + GNBCUCPID string `xml:"gNB-CU-CP-ID"` + } `xml:"e2nodeComponentInterfaceTypeE1"` + E2nodeComponentInterfaceTypeF1 struct { + Text string `xml:",chardata"` + GNBDUID string `xml:"gNB-DU-ID"` + } `xml:"e2nodeComponentInterfaceTypeF1"` + E2nodeComponentInterfaceTypeW1 struct { + Text string `xml:",chardata"` + NgENBDUID string `xml:"ng-eNB-DU-ID"` + } `xml:"e2nodeComponentInterfaceTypeW1"` + E2nodeComponentInterfaceTypeS1 struct { + Text string `xml:",chardata"` + MmeName string `xml:"mme-name"` + } `xml:"e2nodeComponentInterfaceTypeS1"` + E2nodeComponentInterfaceTypeX2 struct { + Text string `xml:",chardata"` + GlobalENBID string `xml:"global-eNB-ID"` + GlobalEnGNBID string `xml:"global-en-gNB-ID"` + } `xml:"e2nodeComponentInterfaceTypeX2"` +} + +type E2nodeComponentConfiguration struct { + Text string `xml:",chardata"` + E2nodeComponentRequestPart string `xml:"e2nodeComponentRequestPart"` + E2nodeComponentResponsePart string `xml:"e2nodeComponentResponsePart"` +} diff --git a/E2Manager/models/e2_node_configuration_update_test.go b/E2Manager/models/e2_node_configuration_update_test.go new file mode 100644 index 0000000..9f96d5b --- /dev/null +++ b/E2Manager/models/e2_node_configuration_update_test.go @@ -0,0 +1,76 @@ +// +// Copyright 2022 Samsung Electronics Co. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This source code is part of the near-RT RIC (RAN Intelligent Controller) +// platform project (RICP). + +package models_test + +import ( + "e2mgr/models" + "e2mgr/utils" + "encoding/xml" + "testing" + + "github.com/stretchr/testify/assert" +) + +const ( + e2NodeConfigurationUpdateOnlyAdditionXmlPath = "../tests/resources/configurationUpdate/e2NodeConfigurationUpdateOnlyAddition.xml" + e2NodeConfigurationUpdateXmlPath = "../tests/resources/configurationUpdate/e2NodeConfigurationUpdate.xml" +) + +func getTestE2NodeConfigurationUpdateMessage(t *testing.T, reqXmlPath string) *models.E2nodeConfigurationUpdateMessage { + xmlConfUpdate := utils.ReadXmlFile(t, reqXmlPath) + confUpdateMsg := &models.E2nodeConfigurationUpdateMessage{} + err := xml.Unmarshal(utils.NormalizeXml(xmlConfUpdate), &confUpdateMsg.E2APPDU) + assert.Nil(t, err) + return confUpdateMsg +} + +func TestParseE2NodeConfigurationUpdateSuccessAdditionOnly(t *testing.T) { + configurationUpdate := getTestE2NodeConfigurationUpdateMessage(t, e2NodeConfigurationUpdateOnlyAdditionXmlPath) + assert.NotEqual(t, nil, configurationUpdate, "xml is not parsed correctly") + assert.Equal(t, "6", configurationUpdate.E2APPDU.InitiatingMessage.ProcedureCode) + assert.Equal(t, 1, len(configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs)) + assert.Equal(t, 1, len(configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer)) + assert.Equal(t, false, configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigAdditionItem.E2nodeComponentInterfaceType.Ng == nil) + assert.Equal(t, true, configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigAdditionItem.E2nodeComponentInterfaceType.E1 == nil) + assert.Equal(t, true, configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigAdditionItem.E2nodeComponentInterfaceType.E1 == nil) +} + +func TestParseE2NodeConfigurationUpdateSuccess(t *testing.T) { + configurationUpdate := getTestE2NodeConfigurationUpdateMessage(t, e2NodeConfigurationUpdateXmlPath) + assert.NotEqual(t, nil, configurationUpdate, "xml is not parsed correctly") + assert.Equal(t, "6", configurationUpdate.E2APPDU.InitiatingMessage.ProcedureCode) + assert.Equal(t, 3, len(configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs)) + + assert.Equal(t, 7, len(configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer)) + assert.Equal(t, false, configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigAdditionItem.E2nodeComponentInterfaceType.Ng == nil) + assert.Equal(t, true, configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigAdditionItem.E2nodeComponentInterfaceType.E1 == nil) + assert.Equal(t, true, configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[0].Value.E2nodeComponentConfigAdditionList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigAdditionItem.E2nodeComponentInterfaceType.E1 == nil) + + updateIE := configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[1] + assert.Equal(t, 7, len(updateIE.Value.E2nodeComponentConfigUpdateList.ProtocolIESingleContainer)) + assert.Equal(t, false, updateIE.Value.E2nodeComponentConfigUpdateList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigUpdateItem.E2nodeComponentInterfaceType.Ng == nil) + assert.Equal(t, true, updateIE.Value.E2nodeComponentConfigUpdateList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigUpdateItem.E2nodeComponentInterfaceType.E1 == nil) + assert.Equal(t, true, updateIE.Value.E2nodeComponentConfigUpdateList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigUpdateItem.E2nodeComponentInterfaceType.E1 == nil) + + removalIE := configurationUpdate.E2APPDU.InitiatingMessage.Value.E2nodeConfigurationUpdate.ProtocolIEs.E2nodeConfigurationUpdateIEs[2] + assert.Equal(t, 7, len(removalIE.Value.E2nodeComponentConfigRemovalList.ProtocolIESingleContainer)) + assert.Equal(t, false, removalIE.Value.E2nodeComponentConfigRemovalList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigRemovalItem.E2nodeComponentInterfaceType.Ng == nil) + assert.Equal(t, true, removalIE.Value.E2nodeComponentConfigRemovalList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigRemovalItem.E2nodeComponentInterfaceType.E1 == nil) + assert.Equal(t, true, removalIE.Value.E2nodeComponentConfigRemovalList.ProtocolIESingleContainer[0].Value.E2nodeComponentConfigRemovalItem.E2nodeComponentInterfaceType.E1 == nil) +} diff --git a/E2Manager/tests/resources/configurationUpdate/e2NodeConfigurationUpdate.xml b/E2Manager/tests/resources/configurationUpdate/e2NodeConfigurationUpdate.xml new file mode 100644 index 0000000..d416d12 --- /dev/null +++ b/E2Manager/tests/resources/configurationUpdate/e2NodeConfigurationUpdate.xml @@ -0,0 +1,403 @@ + + + 6 + + + + + + 50 + + + + + 51 + + + + + + + nginterf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 51 + + + + + + + + + + 67 6E 62 3A 31 32 33 34 35 36 37 38 39 73 64 66 + 67 31 31 31 + + + + 0011000100110010001100110011010000110101001100010011001000110011 + 0011010000110101001100010011001000110011001101000011001000110010 + 00110010001100100011001000110010 + + + + + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 51 + + + + + + + 100 + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 51 + + + + + + + 100 + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 51 + + + + + + + 121 + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 51 + + + + + + + s1interf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 51 + + + + + + + x2interf + x2interf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + + + + 33 + + + + + 34 + + + + + + + nginterf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 34 + + + + + + + xninterf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 34 + + + + + + + e1interf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 34 + + + + + + + f1interf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 34 + + + + + + + w1interf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 34 + + + + + + + s1interf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + 34 + + + + + + + x2interf + x2interf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + + + + 54 + + + + + 55 + + + + + + + nginterf + + + + + + + 55 + + + + + + + xninterf + + + + + + + 55 + + + + + + + e1interf + + + + + + + 55 + + + + + + + f1interf + + + + + + + 55 + + + + + + + w1interf + + + + + + + 55 + + + + + + + s1interf + + + + + + + 55 + + + + + + + x2interf + x2interf + + + + + + + + + + + + + \ No newline at end of file diff --git a/E2Manager/tests/resources/configurationUpdate/e2NodeConfigurationUpdateOnlyAddition.xml b/E2Manager/tests/resources/configurationUpdate/e2NodeConfigurationUpdateOnlyAddition.xml new file mode 100644 index 0000000..53b59ee --- /dev/null +++ b/E2Manager/tests/resources/configurationUpdate/e2NodeConfigurationUpdateOnlyAddition.xml @@ -0,0 +1,38 @@ + + + 6 + + + + + + 50 + + + + + 51 + + + + + + + nginterf + + + + 72 65 71 70 61 72 74 + 72 65 73 70 61 72 74 + + + + + + + + + + + + \ No newline at end of file