Model for handling Reset Request 50/9950/1
authorsubhash kumar singh <subh.singh@samsung.com>
Mon, 5 Dec 2022 11:30:15 +0000 (11:30 +0000)
committersubhash kumar singh <subh.singh@samsung.com>
Mon, 5 Dec 2022 11:30:15 +0000 (11:30 +0000)
Added model to handle Reset Request message.

Issue-ID: RIC-387
Signed-off-by: subhash kumar singh <subh.singh@samsung.com>
Change-Id: I5b01386f767b04b313aaf090a8cbe1e0a259a630

E2Manager/models/constants.go
E2Manager/models/e2_reset_request.go [new file with mode: 0644]
E2Manager/models/e2_reset_request_test.go [new file with mode: 0644]
E2Manager/tests/resources/reset/reset-request.xml [new file with mode: 0644]

index 143aa5d..cf8bf07 100644 (file)
@@ -30,10 +30,12 @@ const (
        ProtocolIE_ID_id_E2nodeComponentConfigRemoval          = "54"
        ProtocolIE_ID_id_E2nodeComponentConfigRemovalAck       = "56"
        ProtocolIE_ID_id_E2nodeComponentConfigRemovalAck_Item  = "57"
+       ProtocolIE_ID_id_Cause                                 = "1"
 )
 
 const (
        ProcedureCode_id_RICserviceQuery           = "6"
        ProcedureCode_id_E2nodeConfigurationUpdate = "10"
        ProcedureCode_id_RICserviceUpdate          = "7"
+       ProcedureCode_id_Reset                     = "3"
 )
diff --git a/E2Manager/models/e2_reset_request.go b/E2Manager/models/e2_reset_request.go
new file mode 100644 (file)
index 0000000..582453f
--- /dev/null
@@ -0,0 +1,127 @@
+//
+// 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 E2ResetRequestMessage struct {
+       XMLName xml.Name `xml:"E2ResetRequestMessage"`
+       Text    string   `xml:",chardata"`
+       E2APPDU struct {
+               XMLName           xml.Name `xml:"E2AP-PDU"`
+               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"`
+                               ResetRequest struct {
+                                       Text        string `xml:",chardata"`
+                                       ProtocolIEs struct {
+                                               Text            string `xml:",chardata"`
+                                               ResetRequestIEs []struct {
+                                                       Text        string `xml:",chardata"`
+                                                       ID          string `xml:"id"`
+                                                       Criticality struct {
+                                                               Text   string `xml:",chardata"`
+                                                               Ignore string `xml:"ignore"`
+                                                       } `xml:"criticality"`
+                                                       Value struct {
+                                                               Text          string            `xml:",chardata"`
+                                                               TransactionID string            `xml:"TransactionID"`
+                                                               Cause         CauseResetRequest `xml:"Cause"`
+                                                       } `xml:"value"`
+                                               } `xml:"ResetRequestIEs"`
+                                       } `xml:"protocolIEs"`
+                               } `xml:"ResetRequest"`
+                       } `xml:"value"`
+               } `xml:"initiatingMessage"`
+       } `xml:"E2AP-PDU"`
+}
+
+type CauseResetRequest struct {
+       Text       string     `xml:",chardata"`
+       E2Node     E2Node     `xml:"e2Node"`
+       RicRequest RicRequest `xml:"ricRequest"`
+       Misc       Misc       `xml:"misc"`
+       Protocol   Protocol   `xml:"protocol"`
+       Transport  Transport  `xml:"transport"`
+       RicService RicService `xml:"ricService"`
+}
+
+type E2Node struct {
+       Text                   string    `xml:",chardata"`
+       E2nodeComponentUnknown *struct{} `xml:"e2node-component-unknown"`
+}
+
+type RicRequest struct {
+       Text                                       string    `xml:",chardata"`
+       RanFunctionIDInvalid                       *struct{} `xml:"ran-function-id-invalid"`
+       ActionNotSupported                         *struct{} `xml:"action-not-supported"`
+       ExcessiveActions                           *struct{} `xml:"excessive-actions"`
+       DuplicateAction                            *struct{} `xml:"duplicate-action"`
+       DuplicateEventTrigger                      *struct{} `xml:"duplicate-event-trigger"`
+       FunctionResourceLimit                      *struct{} `xml:"function-resource-limit"`
+       RequestIDUnknown                           *struct{} `xml:"request-id-unknown"`
+       InconsistentActionSubsequentActionSequence *struct{} `xml:"inconsistent-action-subsequent-action-sequence"`
+       ControlMessageInvalid                      *struct{} `xml:"control-message-invalid"`
+       RicCallProcessIDInvalid                    *struct{} `xml:"ric-call-process-id-invalid"`
+       ControlTimerExpired                        *struct{} `xml:"control-timer-expired"`
+       ControlFailedToExecute                     *struct{} `xml:"control-failed-to-execute"`
+       SystemNotReady                             *struct{} `xml:"system-not-ready"`
+       Unspecified                                *struct{} `xml:"unspecified"`
+}
+
+type Misc struct {
+       Text                      string    `xml:",chardata"`
+       ControlProcessingOverload *struct{} `xml:"control-processing-overload"`
+       HardwareFailure           *struct{} `xml:"hardware-failure"`
+       OmIntervention            *struct{} `xml:"om-intervention"`
+       Unspecified               *struct{} `xml:"unspecified"`
+}
+
+type Protocol struct {
+       Text                                         string    `xml:",chardata"`
+       TransferSyntaxError                          *struct{} `xml:"transfer-syntax-error"`
+       AbstractSyntaxErrorReject                    *struct{} `xml:"abstract-syntax-error-reject"`
+       AbstractSyntaxErrorIgnoreAndNotify           *struct{} `xml:"abstract-syntax-error-ignore-and-notify"`
+       MessageNotCompatibleWithReceiverState        *struct{} `xml:"message-not-compatible-with-receiver-state"`
+       SemanticError                                *struct{} `xml:"semantic-error"`
+       AbstractSyntaxErrorFalselyConstructedMessage *struct{} `xml:"abstract-syntax-error-falsely-constructed-message"`
+       Unspecified                                  *struct{} `xml:"unspecified"`
+}
+
+type Transport struct {
+       Text                         string    `xml:",chardata"`
+       Unspecified                  *struct{} `xml:"unspecified"`
+       TransportResourceUnavailable *struct{} `xml:"transport-resource-unavailable"`
+}
+
+type RicService struct {
+       Text                    string    `xml:",chardata"`
+       RanFunctionNotSupported *struct{} `xml:"ran-function-not-supported"`
+       ExcessiveFunctions      *struct{} `xml:"excessive-functions"`
+       RicResourceLimit        *struct{} `xml:"ric-resource-limit"`
+}
diff --git a/E2Manager/models/e2_reset_request_test.go b/E2Manager/models/e2_reset_request_test.go
new file mode 100644 (file)
index 0000000..0e397c0
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// 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 (
+       ResetRequstXMLPath = "../tests/resources/reset/reset-request.xml"
+)
+
+func getResetRequestMessage(t *testing.T, reqXmlPath string) *models.E2ResetRequestMessage {
+       resetRequest := utils.ReadXmlFile(t, reqXmlPath)
+       resetRequestMsg := &models.E2ResetRequestMessage{}
+       err := xml.Unmarshal(utils.NormalizeXml(resetRequest), &resetRequestMsg.E2APPDU)
+       assert.Nil(t, err)
+       return resetRequestMsg
+}
+
+func TestParseResetRequest(t *testing.T) {
+       rr := getResetRequestMessage(t, ResetRequstXMLPath)
+       assert.NotEqual(t, nil, rr, "xml is not parsed correctly")
+       assert.Equal(t, models.ProcedureCode_id_Reset, rr.E2APPDU.InitiatingMessage.ProcedureCode)
+       assert.Equal(t, 2, len(rr.E2APPDU.InitiatingMessage.Value.ResetRequest.ProtocolIEs.ResetRequestIEs))
+
+       txid := rr.E2APPDU.InitiatingMessage.Value.ResetRequest.ProtocolIEs.ResetRequestIEs[0]
+       cause := rr.E2APPDU.InitiatingMessage.Value.ResetRequest.ProtocolIEs.ResetRequestIEs[1]
+
+       assert.Equal(t, models.ProtocolIE_ID_id_TransactionID, txid.ID)
+       assert.Equal(t, models.ProtocolIE_ID_id_Cause, cause.ID)
+
+       assert.Equal(t, false, cause.Value.Cause.E2Node.E2nodeComponentUnknown == nil)
+       assert.Equal(t, true, cause.Value.Cause.Misc.ControlProcessingOverload == nil)
+}
diff --git a/E2Manager/tests/resources/reset/reset-request.xml b/E2Manager/tests/resources/reset/reset-request.xml
new file mode 100644 (file)
index 0000000..cc27c05
--- /dev/null
@@ -0,0 +1,36 @@
+<E2AP-PDU>
+    <initiatingMessage>
+        <procedureCode>3</procedureCode>
+        <criticality>
+            <reject/>
+        </criticality>
+        <value>
+            <ResetRequest>
+                <protocolIEs>
+                    <ResetRequestIEs>
+                        <id>49</id>
+                        <criticality>
+                            <ignore />
+                        </criticality>
+                        <value>
+                            <TransactionID>1</TransactionID>
+                        </value>
+                    </ResetRequestIEs>
+                    <ResetRequestIEs>
+                        <id>1</id>
+                        <criticality>
+                            <ignore />
+                        </criticality>
+                        <value>
+                            <Cause>
+                                <e2Node>
+                                    <e2node-component-unknown/>
+                                </e2Node>
+                            </Cause>
+                        </value>
+                    </ResetRequestIEs>
+                </protocolIEs>
+            </ResetRequest>
+        </value>
+    </initiatingMessage>
+</E2AP-PDU>
\ No newline at end of file