X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fhandlers%2Frmrmsghandlers%2Fe2_setup_request_notification_handler.go;h=8ec18eb4ec9fcfed2ecae6070f53bfb01e72d3bf;hb=70a16499e8c7042383f3fe115e6180f398dbab7d;hp=90a417caa206ccf4ea639de441ec3e02b46e0dd1;hpb=dbf8e0032295fac936779b0f117d0600b94c85fc;p=ric-plt%2Fe2mgr.git
diff --git a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go
index 90a417c..8ec18eb 100644
--- a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go
+++ b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go
@@ -34,6 +34,8 @@ import (
"fmt"
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+ "strconv"
+ "strings"
)
type E2SetupRequestNotificationHandler struct {
@@ -58,7 +60,7 @@ func NewE2SetupRequestNotificationHandler(logger *logger.Logger, config *configu
func (h E2SetupRequestNotificationHandler) Handle(request *models.NotificationRequest){
ranName := request.RanName
- h.logger.Infof("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - received E2 Setup Request. Payload: %x", ranName, request.Payload)
+ h.logger.Infof("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - received E2_SETUP_REQUEST. Payload: %x", ranName, request.Payload)
setupRequest, e2tIpAddress, err := h.parseSetupRequest(request.Payload)
if err != nil {
@@ -113,21 +115,41 @@ func (h E2SetupRequestNotificationHandler) Handle(request *models.NotificationRe
h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - failed to associate E2T to nodeB entity. Error: %s", ranName, err)
return
}
- successResponse := models.NewE2SetupSuccessResponseMessage()
- successResponse.SetPlmnId(h.config.GlobalRicId.PlmnId)
- successResponse.SetRicId(h.config.GlobalRicId.RicNearRtId)
- successResponse.SetExtractRanFunctionsIDList(setupRequest)
- responsePayload, err := xml.Marshal(&successResponse.E2APPDU)
+
+ ricNearRtId, err := convertTo20BitString(h.config.GlobalRicId.RicNearRtId)
+ if err != nil{
+ h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - failed to convert RicNearRtId value %s to 20 bit string . Error: %s", ranName, h.config.GlobalRicId.RicNearRtId, err)
+ return
+ }
+ successResponse := models.NewE2SetupSuccessResponseMessage(h.config.GlobalRicId.PlmnId, ricNearRtId,setupRequest)
h.logger.Debugf("#E2SetupRequestNotificationHandler.Handle - E2_SETUP_RESPONSE has been built successfully %+v", 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)
+ h.logger.Warnf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - Error marshalling RIC_E2_SETUP_RESP. Payload: %s", ranName, responsePayload)
}
+
+ responsePayload = replaceCriticalityTagsWithSelfClosing(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)
+ h.logger.Infof("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - RIC_E2_SETUP_RESP message has been built successfully. Message: %x", ranName, msg)
_ = h.rmrSender.Send(msg)
}
+func replaceCriticalityTagsWithSelfClosing(responsePayload []byte) []byte {
+ responseString := strings.Replace(string(responsePayload), "", "", -1)
+ responseString = strings.Replace(responseString, "", "", -1)
+ return []byte(responseString)
+}
+
+func convertTo20BitString(ricNearRtId string) (string, error){
+ r, err := strconv.ParseUint(ricNearRtId, 16, 32)
+ if err != nil{
+ return "", err
+ }
+ return fmt.Sprintf("%020b", r)[:20], nil
+}
+
func (h E2SetupRequestNotificationHandler) parseSetupRequest(payload []byte)(*models.E2SetupRequestMessage, string, error){
pipInd := bytes.IndexByte(payload, '|')