RIC-193 - Setup from RAN: Integration fix

Change-Id: Id4e18db88757cd51e32cff4d77fd662e6c9f8043
Signed-off-by: ns019t <ns019t@intl.att.com>
diff --git a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go
index 907e448..f40636b 100644
--- a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go
+++ b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go
@@ -115,14 +115,14 @@
 	successResponse.SetPlmnId(h.config.GlobalRicId.PlmnId)
 	successResponse.SetRicId(h.config.GlobalRicId.RicNearRtId)
 	successResponse.SetExtractRanFunctionsIDList(setupRequest)
-	responsePayload, err := xml.Marshal(successResponse)
+	responsePayload, err := xml.Marshal(&successResponse.E2APPDU)
 
 	if err != nil{
 		h.logger.Warnf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - Error marshalling E2 Setup Response. Response: %x", ranName, responsePayload)
 	}
 	msg := models.NewRmrMessage(rmrCgo.RIC_E2_SETUP_RESP, ranName, responsePayload, request.TransactionId)
 	h.logger.Infof("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - E2 Setup Request has been built. Message: %x", ranName, msg)
-	err = h.rmrSender.Send(msg)
+	_ = h.rmrSender.Send(msg)
 }
 
 func (h E2SetupRequestNotificationHandler) parseSetupRequest(payload []byte)(*models.E2SetupRequestMessage, string, error){
@@ -143,7 +143,7 @@
 	}
 
 	setupRequest := &models.E2SetupRequestMessage{}
-	err := xml.Unmarshal(payload[pipInd + 1:], &setupRequest)
+	err := xml.Unmarshal(payload[pipInd + 1:], &setupRequest.E2APPDU)
 	if err != nil {
 		return nil, "", errors.New(fmt.Sprintf("#E2SetupRequestNotificationHandler.parseSetupRequest - Error unmarshalling E2 Setup Request payload: %x", payload))
 	}
diff --git a/E2Manager/models/e2_setup_success_response_message.go b/E2Manager/models/e2_setup_success_response_message.go
index 23410fc..52239be 100644
--- a/E2Manager/models/e2_setup_success_response_message.go
+++ b/E2Manager/models/e2_setup_success_response_message.go
@@ -25,27 +25,29 @@
 type E2SetupSuccessResponseMessage struct {
 	XMLName xml.Name `xml:"E2SetupSuccessResponseMessage"`
 	Text    string   `xml:",chardata"`
-	E2APPDU struct {
-		Text              string `xml:",chardata"`
-		SuccessfulOutcome 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"`
-				E2setupResponse struct {
-					Text        string `xml:",chardata"`
-					ProtocolIEs struct {
-						Text               string `xml:",chardata"`
-						E2setupResponseIEs []E2setupResponseIEs`xml:"E2setupResponseIEs"`
-					} `xml:"protocolIEs"`
-				} `xml:"E2setupResponse"`
-			} `xml:"value"`
-		} `xml:"successfulOutcome"`
-	} `xml:"E2AP-PDU"`
+	E2APPDU E2APPDU`xml:"E2AP-PDU"`
+}
+
+type E2APPDU struct {
+	Text              string `xml:",chardata"`
+	SuccessfulOutcome 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"`
+			E2setupResponse struct {
+				Text        string `xml:",chardata"`
+				ProtocolIEs struct {
+					Text               string `xml:",chardata"`
+					E2setupResponseIEs []E2setupResponseIEs`xml:"E2setupResponseIEs"`
+				} `xml:"protocolIEs"`
+			} `xml:"E2setupResponse"`
+		} `xml:"value"`
+	} `xml:"successfulOutcome"`
 }
 
 type E2setupResponseIEs struct {
@@ -86,8 +88,8 @@
 	} `xml:"value"`
 }
 
-func NewE2SetupSuccessResponseMessage() *E2SetupSuccessResponseMessage{
-	msg := &E2SetupSuccessResponseMessage{}
+func NewE2SetupSuccessResponseMessage() E2SetupSuccessResponseMessage{
+	msg := E2SetupSuccessResponseMessage{}
 	msg.E2APPDU.SuccessfulOutcome.Value.E2setupResponse.ProtocolIEs.E2setupResponseIEs = make([]E2setupResponseIEs, 2)
 	return msg
 }
diff --git a/E2Manager/tests/resources/setupRequest_en-gNB.xml b/E2Manager/tests/resources/setupRequest_en-gNB.xml
index 4fde3e9..28e4bfe 100644
--- a/E2Manager/tests/resources/setupRequest_en-gNB.xml
+++ b/E2Manager/tests/resources/setupRequest_en-gNB.xml
@@ -1,4 +1,3 @@
-<E2SetupRequestMessage>

 <E2AP-PDU>

     <initiatingMessage>

         <procedureCode>1</procedureCode>

@@ -56,5 +55,4 @@
             </E2setupRequest>

         </value>

     </initiatingMessage>

-</E2AP-PDU>

-</E2SetupRequestMessage>
\ No newline at end of file
+</E2AP-PDU>
\ No newline at end of file
diff --git a/E2Manager/tests/resources/setupRequest_gnb.xml b/E2Manager/tests/resources/setupRequest_gnb.xml
index 3b27b75..e8587e6 100644
--- a/E2Manager/tests/resources/setupRequest_gnb.xml
+++ b/E2Manager/tests/resources/setupRequest_gnb.xml
@@ -1,4 +1,3 @@
-<E2SetupRequestMessage>

 <E2AP-PDU>

     <initiatingMessage>

         <procedureCode>1</procedureCode>

@@ -56,5 +55,4 @@
             </E2setupRequest>

         </value>

     </initiatingMessage>

-</E2AP-PDU>

-</E2SetupRequestMessage>
\ No newline at end of file
+</E2AP-PDU>
\ No newline at end of file
diff --git a/E2Manager/tests/resources/setupRequest_ng-eNB.xml b/E2Manager/tests/resources/setupRequest_ng-eNB.xml
index ba2795c..575dac6 100644
--- a/E2Manager/tests/resources/setupRequest_ng-eNB.xml
+++ b/E2Manager/tests/resources/setupRequest_ng-eNB.xml
@@ -1,4 +1,3 @@
-<E2SetupRequestMessage>

 <E2AP-PDU>

     <initiatingMessage>

         <procedureCode>1</procedureCode>

@@ -56,5 +55,4 @@
             </E2setupRequest>

         </value>

     </initiatingMessage>

-</E2AP-PDU>

-</E2SetupRequestMessage>
\ No newline at end of file
+</E2AP-PDU>
\ No newline at end of file