X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fhandlers%2Fhttpmsghandlers%2Fhealth_check_handler.go;h=785fa49c562422f923afdfefedc44a0b55a82cf2;hb=2e2df47c2adf829fc8dfcd57362061b1a09e1125;hp=718a49b316682bf61ab21794300c8994bddf6b89;hpb=d0513f4d08e81b760bf3309932f84ae63d5a3904;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/handlers/httpmsghandlers/health_check_handler.go b/E2Manager/handlers/httpmsghandlers/health_check_handler.go index 718a49b..785fa49 100644 --- a/E2Manager/handlers/httpmsghandlers/health_check_handler.go +++ b/E2Manager/handlers/httpmsghandlers/health_check_handler.go @@ -26,16 +26,16 @@ import ( "e2mgr/rmrCgo" "e2mgr/services" "e2mgr/services/rmrsender" + "e2mgr/utils" "encoding/xml" - "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" - "strings" "unsafe" ) var( - emptyTagsToReplaceToSelfClosingTags = []string{"reject", "ignore", "protocolIEs"} + healthCheckSuccessResponse = "Request Accepted" + healthCheckEmptyTagsToReplaceToSelfClosingTags = []string{"reject", "ignore", "protocolIEs", "procedureCode"} ) type HealthCheckRequestHandler struct { @@ -99,7 +99,7 @@ func (h *HealthCheckRequestHandler) Handle(request models.Request) (models.IResp h.logger.Infof("#HealthcheckRequest.Handle - HealthcheckTimeStampSent Update completed to RedisDB") - return nil, nil + return models.NewHealthCheckSuccessResponse(healthCheckSuccessResponse), nil } func (h *HealthCheckRequestHandler) sendRICServiceQuery(nodebInfo *entities.NodebInfo) error { @@ -111,7 +111,7 @@ func (h *HealthCheckRequestHandler) sendRICServiceQuery(nodebInfo *entities.Node //return nil, e2managererrors.NewInternalError() } - payLoad = replaceEmptyTagsWithSelfClosing(payLoad) + payLoad = utils.ReplaceEmptyTagsWithSelfClosing(payLoad,healthCheckEmptyTagsToReplaceToSelfClosingTags) var xAction []byte var msgSrc unsafe.Pointer @@ -148,19 +148,3 @@ func (h *HealthCheckRequestHandler) getRanNameList(request models.Request) []str return ranNameList } - -func replaceEmptyTagsWithSelfClosing(responsePayload []byte) []byte { - - emptyTagVsSelfClosingTagPairs := make([]string, len(emptyTagsToReplaceToSelfClosingTags)*2) - - j := 0 - - for i := 0; i < len(emptyTagsToReplaceToSelfClosingTags); i++ { - emptyTagVsSelfClosingTagPairs[j] = fmt.Sprintf("<%[1]s>", emptyTagsToReplaceToSelfClosingTags[i]) - emptyTagVsSelfClosingTagPairs[j+1] = fmt.Sprintf("<%s/>", emptyTagsToReplaceToSelfClosingTags[i]) - j += 2 - } - - responseString := strings.NewReplacer(emptyTagVsSelfClosingTagPairs...).Replace(string(responsePayload)) - return []byte(responseString) -}