summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test/java
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-10-07 11:30:01 +0200
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-10-07 14:38:10 +0200
commit59d7428cd46159897c3412efa799e9ac46949d0c (patch)
treefeeb554b3b9db782fd7f4d2877862ae3e18a8fa7 /csarvalidation/src/test/java
parent59c181781e97af765b4c0c0a221eb300f1ddfb8b (diff)
Refactor functional tests for CSAR validation.
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Change-Id: Icaa53313d66a01dccc779959b49b74857402cb71 Issue-ID: VNFSDK-661
Diffstat (limited to 'csarvalidation/src/test/java')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java180
-rw-r--r--csarvalidation/src/test/java/org/onap/functional/CsarValidationUtility.java65
-rw-r--r--csarvalidation/src/test/java/org/onap/functional/PnfValidationFunctionalTest.java132
-rw-r--r--csarvalidation/src/test/java/org/onap/functional/VnfValidationFunctionalTest.java75
-rw-r--r--csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java84
-rw-r--r--csarvalidation/src/test/java/org/onap/functional/cli/OnapCliWrapper.java42
6 files changed, 398 insertions, 180 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
deleted file mode 100644
index 491b20a..0000000
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * Copyright 2017 Huawei Technologies Co., Ltd.
- * Copyright 2020 Nokia
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- */
-
-package org.onap.cvc.csar;
-
-import org.apache.commons.lang3.StringUtils;
-import org.assertj.core.api.Assertions;
-import org.junit.Test;
-import org.onap.cli.fw.cmd.OnapCommand;
-import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.output.OnapCommandResult;
-import org.onap.cli.fw.output.OnapCommandResultAttribute;
-import org.onap.cli.main.OnapCli;
-
-import java.net.URISyntaxException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.absoluteFilePath;
-
-
-public class CsarValidatorTest {
-
- private static final String CERTIFICATION_RULE = "r130206";
- private static final String OPERATION_STATUS_FAILED = "FAILED";
- private static final String OPERATION_STATUS_PASS = "PASS";
-
- @Test
- public void shouldReportThanVnfValidationFailed() throws URISyntaxException {
- // given
- OnapCliWrapper cli = new OnapCliWrapper(new String[]{
- "--product", "onap-dublin",
- "csar-validate",
- "--format", "json",
- "--csar", absoluteFilePath("VoLTE.csar")});
-
- // when
- cli.handle();
-
- // then
- final OnapCommandResult onapCommandResult = cli.getCommandResult();
- verifyThatOperation(onapCommandResult, OPERATION_STATUS_FAILED);
- verifyThatXRulesFails(onapCommandResult, 7);
- verifyThatOperationFinishedWithoutAnyError(cli);
- }
-
-
- @Test
- public void shouldReportOnlyWarningWhenCsarDoNotHaveCertificateAndHashesInManifest() throws URISyntaxException {
- // given
- OnapCliWrapper cli = new OnapCliWrapper(new String[]{
- "--product", "onap-dublin",
- "csar-validate",
- "--format", "json",
- "--pnf",
- "--csar", absoluteFilePath("pnf/validFile.csar")});
- // when
- cli.handle();
-
- // then
- final OnapCommandResult onapCommandResult = cli.getCommandResult();
- verifyThatOperation(onapCommandResult, OPERATION_STATUS_PASS);
- assertTrue(onapCommandResult.getOutput().toString().contains(
- "\"warnings\":[{" +
- "\"vnfreqNo\":\"R130206\"," +
- "\"code\":\"0x1006\"," +
- "\"message\":\"Warning. Consider adding package integrity and authenticity assurance according to ETSI NFV-SOL 004 Security Option 1\"," +
- "\"file\":\"\"," +
- "\"lineNumber\":-1}]"));
- verifyThatOperationFinishedWithoutAnyError(cli);
- }
-
- @Test
- public void shouldNotReportThatPnfValidationFailedWhenZipDoNotHaveCertificatesAndHashesInManifest() throws URISyntaxException {
- // given
- OnapCliWrapper cli = new OnapCliWrapper(new String[]{
- "--product", "onap-dublin",
- "csar-validate",
- "--format", "json",
- "--pnf",
- "--csar", absoluteFilePath("pnf/signed-package-valid-signature.zip")});
-
- // when
- cli.handle();
-
- // then
- final OnapCommandResult onapCommandResult = cli.getCommandResult();
- verifyThatOperation(onapCommandResult, OPERATION_STATUS_PASS);
- verifyThatOperationFinishedWithoutAnyError(cli);
- }
-
- @Test
- public void shouldReportThatPnfValidationFailedWhenCsarContainsCertificateInCmsAndInToscaAndInRootAndHashIsIncorrect_allOtherRulesShouldPass() throws URISyntaxException {
- // given
- OnapCliWrapper cli = new OnapCliWrapper(new String[]{
- "--product", "onap-dublin",
- "csar-validate",
- "--format", "json",
- "--pnf",
- "--csar", absoluteFilePath("pnf/r130206/cert-in-cms-and-root-and-tosca-incorrect-hash.csar")});
- // when
- cli.handle();
-
- // then
- final OnapCommandResult onapCommandResult = cli.getCommandResult();
- verifyThatOperation(onapCommandResult, OPERATION_STATUS_FAILED);
- verifyThatXRulesFails(onapCommandResult, 1);
- verifyThatRuleFails(onapCommandResult, CERTIFICATION_RULE);
- verifyThatOperationFinishedWithoutAnyError(cli);
- }
-
- private void verifyThatXRulesFails(OnapCommandResult onapCommandResult, int noOfRules) {
- verifyDataOccurrenceInResult(onapCommandResult, "\"passed\":false", noOfRules);
- }
-
- private void verifyThatRuleFails(OnapCommandResult onapCommandResult, String nameOfRule) {
- final String value = String.format("\"passed\":false,\"vnfreqName\":\"%s\"", nameOfRule);
- verifyDataOccurrenceInResult(onapCommandResult, value, 1);
- }
-
- private void verifyDataOccurrenceInResult(OnapCommandResult onapCommandResult, String data, int dataOccurrence) {
- final String json = getResultValue(onapCommandResult, "results");
- int occurrence = StringUtils.countMatches(json, data);
- Assertions.assertThat(occurrence).isEqualTo(dataOccurrence);
- }
-
- private void verifyThatOperation(OnapCommandResult onapCommandResult, String operationStatus) {
- final String value = getResultValue(onapCommandResult, "criteria");
- Assertions.assertThat(value).isEqualTo(operationStatus);
- }
-
- private String getResultValue(OnapCommandResult onapCommandResult, String attributeName) {
- final OnapCommandResultAttribute results = getOnapCommandResultAttribute(onapCommandResult, attributeName);
- return results.getValues().get(0);
- }
-
- private OnapCommandResultAttribute getOnapCommandResultAttribute(OnapCommandResult onapCommandResult, String name) {
- return onapCommandResult.getRecords().stream()
- .filter(it -> it.getName().equals(name))
- .findFirst()
- .orElseThrow(() -> new RuntimeException(String.format("Unable to find '%s' attribute!", name)));
- }
-
- private void verifyThatOperationFinishedWithoutAnyError(OnapCliWrapper cli) {
- assertEquals(0, cli.getExitCode());
- }
-
- static class OnapCliWrapper extends OnapCli {
-
- private OnapCommandResult commandResult;
-
- OnapCliWrapper(String[] args) {
- super(args);
- }
-
- @Override
- public void handleTracking(OnapCommand cmd) throws OnapCommandException {
- super.handleTracking(cmd);
- this.commandResult = cmd.getResult();
- }
-
- OnapCommandResult getCommandResult() {
- return this.commandResult;
- }
- }
-}
diff --git a/csarvalidation/src/test/java/org/onap/functional/CsarValidationUtility.java b/csarvalidation/src/test/java/org/onap/functional/CsarValidationUtility.java
new file mode 100644
index 0000000..24ef778
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/functional/CsarValidationUtility.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright 2020 Nokia
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+package org.onap.functional;
+
+import com.google.gson.Gson;
+import org.onap.cli.fw.output.OnapCommandResult;
+import org.onap.functional.cli.OnapCliValidationResponseWrapper;
+import org.onap.functional.cli.OnapCliWrapper;
+
+import java.util.Arrays;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public final class CsarValidationUtility {
+
+ private static final int NOR_ERROR_CODE = 0;
+ private static final String UNKNOWN_LINE_NUMBER = "-1";
+ private static final String UNKNOWN_FILE = "";
+
+ private CsarValidationUtility(){}
+
+ public static final String CERTIFICATION_RULE = "r130206";
+ public static final String OPERATION_STATUS_FAILED = "FAILED";
+ public static final String OPERATION_STATUS_PASS = "PASS";
+
+ public static OnapCliValidationResponseWrapper getCliCommandValidationResult(OnapCliWrapper cli) {
+ final OnapCommandResult onapCommandResult = cli.getCommandResult();
+ return new Gson().fromJson(onapCommandResult.getOutput().toString(), OnapCliValidationResponseWrapper.class);
+ }
+
+ public static OnapCliValidationResponseWrapper.ValidationResultWrapper.ValidationErrorWrapper createExpectedError(
+ String rule, String errorCode, String errorMessage
+ ) {
+ return new OnapCliValidationResponseWrapper.ValidationResultWrapper.ValidationErrorWrapper(
+ rule.toUpperCase(), errorCode,
+ errorMessage,
+ UNKNOWN_FILE, UNKNOWN_LINE_NUMBER
+ );
+ }
+
+ public static boolean ruleHaveOneOfCodes(String ruleCode, String... codes ) {
+ return Arrays.asList(codes).contains(ruleCode);
+ }
+
+ public static void verifyThatOperationFinishedWithoutAnyError(OnapCliWrapper cli) {
+ assertThat(cli.getExitCode()).isEqualTo(NOR_ERROR_CODE);
+ }
+
+
+
+}
diff --git a/csarvalidation/src/test/java/org/onap/functional/PnfValidationFunctionalTest.java b/csarvalidation/src/test/java/org/onap/functional/PnfValidationFunctionalTest.java
new file mode 100644
index 0000000..903691e
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/functional/PnfValidationFunctionalTest.java
@@ -0,0 +1,132 @@
+/**
+ * Copyright 2020 Nokia
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+package org.onap.functional;
+
+import org.junit.Test;
+import org.onap.functional.cli.OnapCliValidationResponseWrapper;
+import org.onap.functional.cli.OnapCliWrapper;
+
+import java.net.URISyntaxException;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.absoluteFilePath;
+import static org.onap.functional.CsarValidationUtility.CERTIFICATION_RULE;
+import static org.onap.functional.CsarValidationUtility.OPERATION_STATUS_FAILED;
+import static org.onap.functional.CsarValidationUtility.OPERATION_STATUS_PASS;
+import static org.onap.functional.CsarValidationUtility.createExpectedError;
+import static org.onap.functional.CsarValidationUtility.getCliCommandValidationResult;
+import static org.onap.functional.CsarValidationUtility.verifyThatOperationFinishedWithoutAnyError;
+
+
+public class PnfValidationFunctionalTest {
+
+ @Test
+ public void shouldReportOnlyWarningWhenCsarDoNotHaveCertificateAndHashesInManifest() throws URISyntaxException {
+ // given
+ OnapCliValidationResponseWrapper.ValidationResultWrapper.ValidationErrorWrapper expectedWarning =
+ createExpectedError(CERTIFICATION_RULE, "0x1006",
+ "Warning. Consider adding package integrity and authenticity assurance according to ETSI NFV-SOL 004 Security Option 1");
+
+ OnapCliWrapper cli = new OnapCliWrapper(createPnfValidationRequestInfo( "pnf/validFile.csar"));
+
+ // when
+ cli.handle();
+
+ // then
+ final OnapCliValidationResponseWrapper result = getCliCommandValidationResult(cli);
+
+ assertThat(result.criteria).isEqualTo(OPERATION_STATUS_PASS);
+ result.results.forEach((ruleValidationResult)->{
+ assertThat(ruleValidationResult.errors).hasSize(0);
+ if (ruleValidationResult.vnfreqName.equals(CERTIFICATION_RULE)) {
+ assertThat(ruleValidationResult.warnings)
+ .hasSize(1)
+ .containsOnly(expectedWarning);
+ } else {
+ assertThat(ruleValidationResult.warnings).hasSize(0);
+ }
+ });
+ verifyThatOperationFinishedWithoutAnyError(cli);
+ }
+
+ @Test
+ public void shouldNotReportThatPnfValidationFailedWhenZipDoNotHaveCertificatesAndHashesInManifest() throws URISyntaxException {
+ // given
+ OnapCliWrapper cli = new OnapCliWrapper(createPnfValidationRequestInfo( "pnf/signed-package-valid-signature.zip"));
+
+ // when
+ cli.handle();
+
+ // then
+ final OnapCliValidationResponseWrapper result = getCliCommandValidationResult(cli);
+
+ assertThat(result.criteria).isEqualTo(OPERATION_STATUS_PASS);
+ verifyThatOperationFinishedWithoutAnyError(cli);
+ }
+
+ @Test
+ public void shouldReportThatPnfValidationFailedWhenCsarContainsCertificateInCmsAndInToscaAndInRootAndHashIsIncorrect_allOtherRulesShouldPass() throws URISyntaxException {
+ // given
+
+ List<OnapCliValidationResponseWrapper.ValidationResultWrapper.ValidationErrorWrapper> expectedErrors =
+ List.of(
+ createExpectedError(CERTIFICATION_RULE, "0x4007",
+ "File has invalid signature!"),
+ createExpectedError(CERTIFICATION_RULE, "0x4004",
+ "Source 'Files/pnf-sw-information/pnf-sw-information.yaml' has wrong hash!"),
+ createExpectedError(CERTIFICATION_RULE, "0x4011",
+ "ETSI-Entry-Certificate entry in Tosca.meta is defined despite the certificate is included in the signature container"),
+ createExpectedError(CERTIFICATION_RULE, "0x4012",
+ "ETSI-Entry-Certificate certificate present despite the certificate is included in the signature container"),
+ createExpectedError(CERTIFICATION_RULE, "0x4013",
+ "Certificate present in root catalog despite the certificate is included in the signature container")
+ );
+ OnapCliWrapper cli = new OnapCliWrapper(createPnfValidationRequestInfo( "pnf/r130206/cert-in-cms-and-root-and-tosca-incorrect-hash.csar"));
+
+ // when
+ cli.handle();
+
+ // then
+ final OnapCliValidationResponseWrapper result = getCliCommandValidationResult(cli);
+
+ assertThat(result.criteria).isEqualTo(OPERATION_STATUS_FAILED);
+ result.results.forEach((ruleValidationResult)->{
+ assertThat(ruleValidationResult.warnings).hasSize(0);
+ if (ruleValidationResult.vnfreqName.equals(CERTIFICATION_RULE)) {
+ assertThat(ruleValidationResult.errors)
+ .hasSize(5)
+ .containsAll(expectedErrors);
+ } else {
+ assertThat(ruleValidationResult.errors).hasSize(0);
+ }
+ });
+ verifyThatOperationFinishedWithoutAnyError(cli);
+ }
+
+ private String[] createPnfValidationRequestInfo(String csarPath) throws URISyntaxException {
+ return new String[]{
+ "--product", "onap-dublin",
+ "csar-validate",
+ "--format", "json",
+ "--pnf",
+ "--csar", absoluteFilePath(csarPath)
+ };
+ }
+
+
+}
diff --git a/csarvalidation/src/test/java/org/onap/functional/VnfValidationFunctionalTest.java b/csarvalidation/src/test/java/org/onap/functional/VnfValidationFunctionalTest.java
new file mode 100644
index 0000000..adaea59
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/functional/VnfValidationFunctionalTest.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ * Copyright 2020 Nokia
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+package org.onap.functional;
+
+import org.junit.Test;
+import org.onap.functional.cli.OnapCliValidationResponseWrapper;
+import org.onap.functional.cli.OnapCliWrapper;
+
+import java.net.URISyntaxException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.absoluteFilePath;
+import static org.onap.functional.CsarValidationUtility.OPERATION_STATUS_FAILED;
+import static org.onap.functional.CsarValidationUtility.getCliCommandValidationResult;
+import static org.onap.functional.CsarValidationUtility.ruleHaveOneOfCodes;
+import static org.onap.functional.CsarValidationUtility.verifyThatOperationFinishedWithoutAnyError;
+
+public class VnfValidationFunctionalTest {
+
+
+ @Test
+ public void shouldReportThanVnfValidationFailed() throws URISyntaxException {
+ // given
+ OnapCliWrapper cli = new OnapCliWrapper(createVnfValidationRequestInfo("VoLTE.csar"));
+
+ // when
+ cli.handle();
+
+ // then
+ final OnapCliValidationResponseWrapper result = getCliCommandValidationResult(cli);
+ assertThat(result.criteria).isEqualTo(OPERATION_STATUS_FAILED);
+ result.results.forEach((ruleValidationResult)->{
+ if ( ruleHaveOneOfCodes(ruleValidationResult.vnfreqName,
+ "r01123", "r09467")
+ ) {
+ assertThat(ruleValidationResult.errors)
+ .hasSize(2);
+ } else if ( ruleHaveOneOfCodes(ruleValidationResult.vnfreqName,
+ "r21322","r26885","r43958" ,"r66070","r130206")
+ ) {
+ assertThat(ruleValidationResult.errors)
+ .hasSize(1);
+ } else {
+ assertThat(ruleValidationResult.errors).hasSize(0);
+ }
+ });
+
+ verifyThatOperationFinishedWithoutAnyError(cli);
+ }
+
+ private String[] createVnfValidationRequestInfo(String csarPath) throws URISyntaxException {
+ return new String[]{
+ "--product", "onap-dublin",
+ "csar-validate",
+ "--format", "json",
+ "--csar", absoluteFilePath(csarPath)
+ };
+ }
+
+}
diff --git a/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java b/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java
new file mode 100644
index 0000000..d011a6e
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliValidationResponseWrapper.java
@@ -0,0 +1,84 @@
+/**
+ * Copyright 2020 Nokia
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+package org.onap.functional.cli;
+
+
+import java.util.List;
+import java.util.Objects;
+
+public class OnapCliValidationResponseWrapper {
+
+ public final VnfDataWrapper vnf;
+ public final String data;
+ public final String criteria;
+ public final List<ValidationResultWrapper> results;
+ public final String contact;
+ public final String platform;
+
+ public OnapCliValidationResponseWrapper(VnfDataWrapper vnf, String data, String criteria, List<ValidationResultWrapper> results, String contact, String platform) {
+ this.vnf = vnf;
+ this.data = data;
+ this.criteria = criteria;
+ this.results = results;
+ this.contact = contact;
+ this.platform = platform;
+ }
+
+ public static class VnfDataWrapper {
+ public String name;
+ public String vendor;
+ public String version;
+ public String type;
+ public String mode;
+ }
+
+ public static class ValidationResultWrapper {
+ public Boolean passed;
+ public String vnfreqName;
+ public String description;
+ public List<ValidationErrorWrapper> errors;
+ public List<ValidationErrorWrapper> warnings;
+
+ public static class ValidationErrorWrapper {
+ public String vnfreqNo;
+ public String code;
+ public String message;
+ public String file;
+ public String lineNumber;
+
+ public ValidationErrorWrapper(String vnfreqNo, String code, String message, String file, String lineNumber) {
+ this.vnfreqNo = vnfreqNo;
+ this.code = code;
+ this.message = message;
+ this.file = file;
+ this.lineNumber = lineNumber;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ return o.hashCode() == this.hashCode();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vnfreqNo, code, message, file, lineNumber);
+ }
+ }
+ }
+}
diff --git a/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliWrapper.java b/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliWrapper.java
new file mode 100644
index 0000000..b5cf589
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/functional/cli/OnapCliWrapper.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2020 Nokia
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+package org.onap.functional.cli;
+
+
+import org.onap.cli.fw.cmd.OnapCommand;
+import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.output.OnapCommandResult;
+import org.onap.cli.main.OnapCli;
+
+public class OnapCliWrapper extends OnapCli {
+
+ private OnapCommandResult commandResult;
+
+ public OnapCliWrapper(String[] args) {
+ super(args);
+ }
+
+ @Override
+ public void handleTracking(OnapCommand cmd) throws OnapCommandException {
+ super.handleTracking(cmd);
+ this.commandResult = cmd.getResult();
+ }
+
+ public OnapCommandResult getCommandResult() {
+ return this.commandResult;
+ }
+}