diff options
author | puthuparambil.aditya <aditya.puthuparambil@bell.ca> | 2022-03-29 11:22:31 +0100 |
---|---|---|
committer | puthuparambil.aditya <aditya.puthuparambil@bell.ca> | 2022-04-04 12:06:34 +0100 |
commit | 39450c583c097c3b083ca79a39c5f99a218f6cdc (patch) | |
tree | a975b082dbf11e6536c6fc5bee09215d830a3224 /src/main/java | |
parent | 15bbf1487764bbfeaffcaa6a4a4beaea69f50d1e (diff) |
[dmi-plugin] Fix getResourceDataForPassthroughOperational endpoint
Get endpoint only accepts application/json.
Issue-ID: CPS-957
Change-Id: I7b9dd00f293f183dc76623c8e32699e8e90fd17c
Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca>
Diffstat (limited to 'src/main/java')
4 files changed, 6 insertions, 20 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java index ed7c75b9..5544aeb3 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Nordix Foundation + * Modifications Copyright (C) 2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,7 +94,6 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { * @param resourceIdentifier resource identifier to fetch data * @param cmHandle cm handle identifier * @param dataAccessRequest data Access Request - * @param acceptParamInHeader accept header parameter * @param optionsParamInQuery options query parameter * @return {@code ResponseEntity} response entity */ @@ -102,12 +102,10 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { final String cmHandle, final @Valid DataAccessRequest dataAccessRequest, - final String acceptParamInHeader, final @Valid String optionsParamInQuery) { if (isReadOperation(dataAccessRequest)) { final String resourceDataAsJson = dmiService.getResourceData(cmHandle, resourceIdentifier, - acceptParamInHeader, optionsParamInQuery, DmiService.RESTCONF_CONTENT_PASSTHROUGH_OPERATIONAL_QUERY_PARAM); return ResponseEntity.ok(resourceDataAsJson); @@ -120,13 +118,11 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { final String cmHandle, final @Valid DataAccessRequest dataAccessRequest, - final String acceptParamInHeader, final @Valid String optionsParamInQuery) { final String sdncResponse; if (isReadOperation(dataAccessRequest)) { sdncResponse = dmiService.getResourceData(cmHandle, resourceIdentifier, - acceptParamInHeader, optionsParamInQuery, DmiService.RESTCONF_CONTENT_PASSTHROUGH_RUNNING_QUERY_PARAM); } else { diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java index 0f3fcc0c..e5b08d9a 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Nordix Foundation + * Modifications Copyright (C) 2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,14 +71,12 @@ public interface DmiService { * * @param cmHandle cm handle identifier * @param resourceIdentifier resource identifier - * @param acceptParamInHeader accept header parameter * @param optionsParamInQuery options query parameter * @param restconfContentQueryParam restconf content i.e. datastore to use * @return {@code Object} response from network function */ String getResourceData(@NotNull String cmHandle, @NotNull String resourceIdentifier, - String acceptParamInHeader, String optionsParamInQuery, String restconfContentQueryParam); diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java index 38b044db..22d47442 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Nordix Foundation - * Modifications Copyright (C) 2021 Bell Canada + * Modifications Copyright (C) 2021-2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,13 +150,11 @@ public class DmiServiceImpl implements DmiService { @Override public String getResourceData(final String cmHandle, final String resourceIdentifier, - final String acceptParamInHeader, final String optionsParamInQuery, final String restconfContentQueryParam) { final ResponseEntity<String> responseEntity = sdncOperations.getResouceDataForOperationalAndRunning(cmHandle, resourceIdentifier, optionsParamInQuery, - acceptParamInHeader, restconfContentQueryParam); return prepareAndSendResponse(responseEntity, cmHandle); } diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java b/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java index c6e221e3..7e2443e5 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021-2022 Nordix Foundation - * Modifications Copyright (C) 2021 Bell Canada + * Modifications Copyright (C) 2021-2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -127,23 +127,16 @@ public class SdncOperations { * @param nodeId network resource identifier * @param resourceId resource identifier * @param optionsParamInQuery fields query - * @param acceptParamInHeader accept parameter * @param restConfContentQueryParam restConf content query param * @return {@code ResponseEntity} response entity */ public ResponseEntity<String> getResouceDataForOperationalAndRunning(final String nodeId, final String resourceId, final String optionsParamInQuery, - final String acceptParamInHeader, final String restConfContentQueryParam) { final String getResourceDataUrl = prepareResourceDataUrl(nodeId, - resourceId, - buildQueryParamMap(optionsParamInQuery, restConfContentQueryParam)); - final HttpHeaders httpHeaders = new HttpHeaders(); - if (acceptParamInHeader != null && !acceptParamInHeader.isBlank()) { - httpHeaders.set(HttpHeaders.ACCEPT, acceptParamInHeader); - } - return sdncRestconfClient.getOperation(getResourceDataUrl, httpHeaders); + resourceId, buildQueryParamMap(optionsParamInQuery, restConfContentQueryParam)); + return sdncRestconfClient.getOperation(getResourceDataUrl); } /** |