summaryrefslogtreecommitdiffstats
path: root/appc-provider/appc-provider-bundle/src
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-01-16 09:55:37 +0000
committerJoss Armstrong <joss.armstrong@ericsson.com>2019-01-16 09:56:24 +0000
commit9121ab6986853965360d7b12dd66027f988ffdf2 (patch)
treee46d3e94d5405a1c567ac8fe06a5b09a3892e284 /appc-provider/appc-provider-bundle/src
parentd64120dc8e7a8b26fea60efa6f898d1c4a67361a (diff)
Remove deprecated mock implementations of LCM
Removal of deprecated code Issue-ID: APPC-1328 Change-Id: I075ed20b648b78c51cbfcb123958340ab379ac09 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-provider/appc-provider-bundle/src')
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/AppcProviderClient.java8
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockQuiesceHelper.java102
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockRebootHelper.java69
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockResumeHelper.java83
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockUpgradeHelper.java228
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockVolumeHelper.java139
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/QuiesceTrafficService.java3
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/RebootService.java3
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/ResumeTrafficService.java3
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/util/RequestInputBuilder.java3
10 files changed, 10 insertions, 631 deletions
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/AppcProviderClient.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/AppcProviderClient.java
index ec8ce478b..fa417a4a2 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/AppcProviderClient.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/AppcProviderClient.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,18 +32,12 @@ import org.onap.appc.logging.LoggingUtils;
import org.onap.appc.util.StringHelper;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
import org.slf4j.MDC;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.Properties;
-import java.util.TimeZone;
public class AppcProviderClient {
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockQuiesceHelper.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockQuiesceHelper.java
deleted file mode 100644
index b1ee6b830..000000000
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockQuiesceHelper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.provider.lcm.mock;
-
-import org.onap.appc.executor.objects.LCMCommandStatus;
-import org.onap.appc.requesthandler.objects.RequestHandlerInput;
-import org.onap.appc.requesthandler.objects.RequestHandlerOutput;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import org.onap.appc.util.JsonUtil;
-import java.io.IOException;
-
-import java.util.Map;
-
-
-/**
- * This class is here because LCM quiesce backend is not implemented.
- * Hence this class is here to mock the handling response of LCM quiesce REST API.
- *
- * When backend is implemented, this file should be removed.
- */
-public class MockQuiesceHelper extends AbstractMockHelper {
- private final String MOCK_QUIESCE_DIR = "/tmp/lcm/quiescetraffic";
- private final String PAUSE = "pause";
-
- public RequestHandlerOutput quiesceTraffic(RequestHandlerInput input) {
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The quiesce-traffic command is not supported");
- return setOutputStatus();
- }
-
- String vnfId = input.getRequestContext().getActionIdentifiers().getVnfId();
- String vnfPath = String.format("%s/%s", MOCK_QUIESCE_DIR, vnfId);
- if (!isDirectoryExist(vnfPath)) {
- status = buildStatusForVnfId(LCMCommandStatus.VNF_NOT_FOUND, vnfId);
- return setOutputStatus();
- }
-
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String pausePath = String.format("%s/%s", vnfPath, PAUSE);
- if (isDirectoryExist(pausePath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("VNF %s is already quiesced", vnfId));
- return setOutputStatus();
- }
-
- File pauseDir = new File(pausePath);
- boolean success = pauseDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.ACCEPTED) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to quiesce traffic VNF %s", vnfId));
-
- return setOutputStatus();
- }
-
- private boolean mockConditionExists() {
- return isDirectoryExist(MOCK_QUIESCE_DIR);
- }
-
- private boolean isDirectoryExist(String path) {
- return Files.isDirectory(Paths.get(path));
- }
-
- private Map<String, String> getJsonMap(String jsonString) {
- try {
- return JsonUtil.convertJsonStringToFlatMap(jsonString);
- } catch (IOException e) {
- logger.error(String.format("MockQuiesceHelper got exception when convert json map for (%s)", jsonString), e);
- }
- return null;
- }
-}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockRebootHelper.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockRebootHelper.java
deleted file mode 100644
index b73a9afdc..000000000
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockRebootHelper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.provider.lcm.mock;
-
-import org.onap.appc.executor.objects.LCMCommandStatus;
-import org.onap.appc.requesthandler.objects.RequestHandlerInput;
-import org.onap.appc.requesthandler.objects.RequestHandlerOutput;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-
-/**
- * This class is here because LCM reboot backend is not implemented.
- * Hence this class is here to mock the handling response of LCM reboot REST API.
- * <p>
- * When backend is implemented, this file should be removed.
- */
-public class MockRebootHelper extends AbstractMockHelper {
- private final String MOCK_REBOOT_FILENAME = "/tmp/lcm/reboot";
-
- /**
- * Process service request through reading the mockFile.
- * If the file doesn't exist, it will return "The reboot command is not supported"
- * Otherwise, it will build an accepted result.
- *
- * @param requestHandlerInput of the input
- * @return RequestHandlerOutput
- */
- public RequestHandlerOutput reboot(RequestHandlerInput requestHandlerInput) {
- File file = new File(MOCK_REBOOT_FILENAME);
- if (!file.exists()) {
- // when mock file does not exist, return generic service not supported
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED, "The reboot command is not supported");
- } else {
- try {
- properties.load(new FileInputStream(MOCK_REBOOT_FILENAME));
- status = buildStatusWithoutParams(LCMCommandStatus.ACCEPTED);
- } catch (IOException e) {
- // when loading propertes from mock file failed, return with associated message
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("cannot load properties from %s", MOCK_REBOOT_FILENAME));
- }
- }
-
- return setOutputStatus();
- }
-}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockResumeHelper.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockResumeHelper.java
deleted file mode 100644
index d1c21b691..000000000
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockResumeHelper.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.provider.lcm.mock;
-
-import org.onap.appc.executor.objects.LCMCommandStatus;
-import org.onap.appc.requesthandler.objects.RequestHandlerInput;
-import org.onap.appc.requesthandler.objects.RequestHandlerOutput;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Map;
-
-/**
- * This class is here because LCM resume backend is not implemented.
- * Hence this class is here to mock the handling response of LCM resume REST API.
- *
- * When backend is implemented, this file should be removed.
- */
-public class MockResumeHelper extends AbstractMockHelper {
- private final String MOCK_RESUME_DIR = "/tmp/lcm/resumetraffic";
- private final String RESUME = "resume";
-
- public RequestHandlerOutput resumeTraffic(RequestHandlerInput input) {
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The resume-traffic command is not supported");
- return setOutputStatus();
- }
-
- String vnfId = input.getRequestContext().getActionIdentifiers().getVnfId();
- String vnfPath = String.format("%s/%s", MOCK_RESUME_DIR, vnfId);
- if (!isDirectoryExist(vnfPath)) {
- status = buildStatusForVnfId(LCMCommandStatus.VNF_NOT_FOUND, vnfId);
- return setOutputStatus();
- }
-
- String resumePath = String.format("%s/%s", vnfPath, RESUME);
- if (isDirectoryExist(resumePath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("VNF %s is already resumed", vnfId));
- return setOutputStatus();
- }
-
- File resumeDir = new File(resumePath);
- boolean success = resumeDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.ACCEPTED) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to resume traffic VNF %s", vnfId));
-
- return setOutputStatus();
- }
-
- private boolean mockConditionExists() {
- return isDirectoryExist(MOCK_RESUME_DIR);
- }
-
- private boolean isDirectoryExist(String path) {
- return Files.isDirectory(Paths.get(path));
- }
-}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockUpgradeHelper.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockUpgradeHelper.java
deleted file mode 100644
index d71d4fab0..000000000
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockUpgradeHelper.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.provider.lcm.mock;
-
-import org.onap.appc.executor.objects.LCMCommandStatus;
-import org.onap.appc.requesthandler.objects.RequestHandlerInput;
-import org.onap.appc.requesthandler.objects.RequestHandlerOutput;
-import org.onap.appc.util.JsonUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Map;
-
-/**
- * This class is here because LCM upgrade actions are not implemented.
- * Hence this class is here to mock the handling response of LCM upgrade actions REST API.
- *
- * When backend is implemented, this file should be removed.
- */
-public class MockUpgradeHelper extends AbstractMockHelper {
- private final String MOCK_UPGRADE_DIR = "/tmp/lcm/upgrade";
- private final String UPGRADE = "upgrade";
-
- public RequestHandlerOutput upgradePreCheck(RequestHandlerInput input) {
-
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The upgrade-pre-check command is not supported");
- return setOutputStatus();
- }
-
- String vnfId = input.getRequestContext().getActionIdentifiers().getVnfId();
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String upgradePath = String.format(MOCK_UPGRADE_DIR+"/%s-%s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"));
-
- if (isDirectoryExist(upgradePath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("UpgradeCheck from %s to %s is already happened to VNF %s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"), vnfId));
- return setOutputStatus();
- }
-
- File upgradeDir = new File(upgradePath);
- boolean success = upgradeDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.SUCCESS) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to upgradePreCheck for VNF %s", vnfId));
-
- return setOutputStatus();
- }
-
- public RequestHandlerOutput upgradePostCheck(RequestHandlerInput input) {
-
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The upgrade-post-check command is not supported");
- return setOutputStatus();
- }
-
- String vnfId = input.getRequestContext().getActionIdentifiers().getVnfId();
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String upgradePath = String.format(MOCK_UPGRADE_DIR+"/%s/%s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"));
-
- if (isDirectoryExist(upgradePath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("UpgradePostcheck from %s to %s is already happened to VNF %s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"), vnfId));
- return setOutputStatus();
- }
-
- File upgradeDir = new File(upgradePath);
- boolean success = upgradeDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.SUCCESS) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to upgradePostCheck for %s ", vnfId));
-
- return setOutputStatus();
- }
-
- public RequestHandlerOutput upgradeSoftware(RequestHandlerInput input) {
-
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The upgrade-software command is not supported");
- return setOutputStatus();
- }
-
- String vnfId = input.getRequestContext().getActionIdentifiers().getVnfId();
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String upgradePath = String.format(MOCK_UPGRADE_DIR+"/%s/%s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"));
-
- if (isDirectoryExist(upgradePath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("UpgradeSoftware from %s to %s is already happened to VNF %s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"), vnfId));
- return setOutputStatus();
- }
-
- File upgradeDir = new File(upgradePath);
- boolean success = upgradeDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.SUCCESS) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to upgradeSoftware for VNF %s", vnfId));
-
- return setOutputStatus();
- }
-
- public RequestHandlerOutput upgradeBackup(RequestHandlerInput input) {
-
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The upgrade-backup command is not supported");
- return setOutputStatus();
- }
-
- String vnfId = input.getRequestContext().getActionIdentifiers().getVnfId();
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String upgradePath = String.format(MOCK_UPGRADE_DIR+"/%s/%s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"));
-
- if (isDirectoryExist(upgradePath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("UpgradeBackup from %s to %s is already happened to VNF %s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"), vnfId));
- return setOutputStatus();
- }
-
- File upgradeDir = new File(upgradePath);
- boolean success = upgradeDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.SUCCESS) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to upgradeBackup for VNF %s", vnfId));
-
- return setOutputStatus();
- }
-
- public RequestHandlerOutput upgradeBackout(RequestHandlerInput input) {
-
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The upgrade-backout command is not supported");
- return setOutputStatus();
- }
-
- String vnfId = input.getRequestContext().getActionIdentifiers().getVnfId();
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String upgradePath = String.format(MOCK_UPGRADE_DIR+"/%s/%s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"));
-
- if (isDirectoryExist(upgradePath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("UpgradeBackout from %s to %s is already happened to VNF %s", jsonMap.get("existing-software-version"),jsonMap.get("new-software-version"), vnfId));
- return setOutputStatus();
- }
-
- File upgradeDir = new File(upgradePath);
- boolean success = upgradeDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.SUCCESS) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to upgradebackout for VNF %s", vnfId));
-
- return setOutputStatus();
- }
-
- private boolean mockConditionExists() {
- return isDirectoryExist(MOCK_UPGRADE_DIR);
- }
-
- private boolean isDirectoryExist(String path) {
- return Files.isDirectory(Paths.get(path));
- }
-
- private Map<String, String> getJsonMap(String jsonString) {
- try {
- return JsonUtil.convertJsonStringToFlatMap(jsonString);
- } catch (IOException e) {
- logger.error(String.format("MockUpgradeHelper got exception when convert json map for (%s)", jsonString), e);
- }
- return null;
- }
-}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockVolumeHelper.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockVolumeHelper.java
deleted file mode 100644
index ad64baa2b..000000000
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/mock/MockVolumeHelper.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.provider.lcm.mock;
-
-import org.onap.appc.executor.objects.LCMCommandStatus;
-import org.onap.appc.requesthandler.objects.RequestHandlerInput;
-import org.onap.appc.requesthandler.objects.RequestHandlerOutput;
-import org.onap.appc.util.JsonUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Map;
-
-/**
- * This class is here because LCM attachVolume and detachVolume backends are not implemented.
- * Hence this class is here to mock the handling response of LCM attachVolume and detachVolume REST API.
- *
- * When backend is implemented, this file should be removed.
- */
-public class MockVolumeHelper extends AbstractMockHelper {
- private final String MOCK_VOLUME_DIR = "/tmp/lcm/volume";
- private final String VOLUME_ID_KEY = "volumeAttachment.volumeId";
-
- public RequestHandlerOutput attachVolume(RequestHandlerInput input) {
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The attach-volume command is not supported");
- return setOutputStatus();
- }
-
- String vserverId = input.getRequestContext().getActionIdentifiers().getVserverId();
- String vserverPath = String.format("%s/%s", MOCK_VOLUME_DIR, vserverId);
- if (!isDirectoryExist(vserverPath)) {
- status = buildStatusForId(LCMCommandStatus.VSERVER_NOT_FOUND, vserverId);
- return setOutputStatus();
- }
-
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String volumeId = jsonMap.get(VOLUME_ID_KEY);
- String volumeIdPath = String.format("%s/%s", vserverPath, volumeId);
- if (isDirectoryExist(volumeIdPath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Volume %s is already attached to VM %s", volumeId, vserverId));
- return setOutputStatus();
- }
-
- File volumeDir = new File(volumeIdPath);
- boolean success = volumeDir.mkdir();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.SUCCESS) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to attach volume %s to VM %s", volumeId, vserverId));
-
- return setOutputStatus();
- }
-
- public RequestHandlerOutput detachVolume(RequestHandlerInput input) {
- if (!mockConditionExists()) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- "The detach-volume command is not supported");
- return setOutputStatus();
- }
-
- String vserverId = input.getRequestContext().getActionIdentifiers().getVserverId();
- String vserverPath = String.format("%s/%s", MOCK_VOLUME_DIR, vserverId);
- if (!isDirectoryExist(vserverPath)) {
- status = buildStatusForId(LCMCommandStatus.VSERVER_NOT_FOUND, vserverId);
- return setOutputStatus();
- }
-
- Map<String, String> jsonMap = getJsonMap(input.getRequestContext().getPayload());
- if (jsonMap == null) {
- status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, "payload reading failed");
- return setOutputStatus();
- }
-
- String volumeId = jsonMap.get(VOLUME_ID_KEY);
- String volumeIdPath = String.format("%s/%s", vserverPath, volumeId);
- if (!isDirectoryExist(volumeIdPath)) {
- status = buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Volume %s is not attached to VM %s", volumeId, vserverId));
- return setOutputStatus();
- }
-
- File volumeDir = new File(volumeIdPath);
- boolean success = volumeDir.delete();
- status = success ?
- buildStatusWithoutParams(LCMCommandStatus.SUCCESS) :
- buildStatusForErrorMsg(LCMCommandStatus.REJECTED,
- String.format("Failed to attach volume %s to VM %s", volumeId, vserverId));
-
- return setOutputStatus();
- }
-
- private boolean mockConditionExists() {
- return isDirectoryExist(MOCK_VOLUME_DIR);
- }
-
- private boolean isDirectoryExist(String path) {
- return Files.isDirectory(Paths.get(path));
- }
-
- private Map<String, String> getJsonMap(String jsonString) {
- try {
- return JsonUtil.convertJsonStringToFlatMap(jsonString);
- } catch (IOException e) {
- logger.error(String.format("MockVolumeHelper got exception when convert json map for (%s)", jsonString), e);
- }
- return null;
- }
-}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/QuiesceTrafficService.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/QuiesceTrafficService.java
index 6ec7522f9..a5e860680 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/QuiesceTrafficService.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/QuiesceTrafficService.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +27,6 @@ package org.onap.appc.provider.lcm.service;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Action;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.QuiesceTrafficInput;
-import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.QuiesceTrafficOutput;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.QuiesceTrafficOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Payload;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.action.identifiers.ActionIdentifiers;
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/RebootService.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/RebootService.java
index 19f51e39d..fe8a826b9 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/RebootService.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/RebootService.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications (C) 2019 Ericsson
+ * ================================================================================
* 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
@@ -24,7 +26,6 @@ package org.onap.appc.provider.lcm.service;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Action;
-import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Payload;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.RebootInput;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.RebootOutputBuilder;
import org.onap.appc.executor.objects.LCMCommandStatus;
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/ResumeTrafficService.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/ResumeTrafficService.java
index 39c28a2fe..daf1609af 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/ResumeTrafficService.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/ResumeTrafficService.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +27,6 @@ package org.onap.appc.provider.lcm.service;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Action;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.ResumeTrafficInput;
-import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.ResumeTrafficOutput;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.ResumeTrafficOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.action.identifiers.ActionIdentifiers;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Payload;
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/util/RequestInputBuilder.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/util/RequestInputBuilder.java
index dcc6c4141..2119e39c0 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/util/RequestInputBuilder.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/util/RequestInputBuilder.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +29,6 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
-import org.apache.commons.lang3.StringUtils;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Payload;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.action.identifiers.ActionIdentifiers;
import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.CommonHeader;