summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-02-27 14:47:47 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-02-28 10:12:18 +0530
commit7f29a3ad89ca8ec1ea7cd20b5b28475854ea0670 (patch)
tree16d7c267c2507d7b2aab7fa0fede5d51824c61dc /csarvalidation/src/test
parent8f8a262c48cfd4f9a1c7293d81e1f1defdb5cf70 (diff)
CVC TOSCA CSAR Validation Test cases
Add the planned test cases with incubation of test coverage. This would help to cvc. Issue-ID: VNFSDK-276 Change-Id: Id3429c606f9370bf6e373abd8b7b76067f013dd1 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'csarvalidation/src/test')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java36
-rw-r--r--csarvalidation/src/test/resources/log4j.properties31
-rw-r--r--csarvalidation/src/test/resources/sample-result.json1
3 files changed, 68 insertions, 0 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
new file mode 100644
index 0000000..6378c45
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * 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.
+ */
+
+package org.onap.cvc.csar;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.onap.cli.main.OnapCli;
+
+public class CsarValidatorTest {
+
+ @Test
+ public void testAll() throws IOException, InterruptedException {
+ OnapCli cli = new OnapCli(new String [] {"csar-validate", "--format", "json", "--csar", "./src/test/resources/VoLTE.csar"});
+ cli.setProduct("onap-vtp");
+ cli.handle();
+ assertEquals(0, cli.getExitCode());
+ }
+
+}
diff --git a/csarvalidation/src/test/resources/log4j.properties b/csarvalidation/src/test/resources/log4j.properties
new file mode 100644
index 0000000..2f44a11
--- /dev/null
+++ b/csarvalidation/src/test/resources/log4j.properties
@@ -0,0 +1,31 @@
+# Copyright 2018 Huawei Technologies Co., Ltd.
+#
+# 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.
+
+log4j.rootLogger=ERROR, file
+
+log4j.logger.org.onap=ERROR, stdout
+
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+
+# Redirect log messages to a log file, support file rolling.
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=./csar-validate.log
+log4j.appender.file.MaxFileSize=5MB
+log4j.appender.file.MaxBackupIndex=10
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
diff --git a/csarvalidation/src/test/resources/sample-result.json b/csarvalidation/src/test/resources/sample-result.json
new file mode 100644
index 0000000..5bfc69f
--- /dev/null
+++ b/csarvalidation/src/test/resources/sample-result.json
@@ -0,0 +1 @@
+{"vnf":{"name":null,"vendor":"Winery 0.1.37-SNAPSHOT","version":"1.0","type":"TOSCA","mode":"WITH_TOSCA_META_DIR"},"date":"Mon Feb 25 16:49:26 IST 2019","criteria":"FAILED","results":[{"passed":true,"vnfreqName":"SOL004","description":"V2.4.1 (2018-02)","errors":[{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":6,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":7,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":9,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":10,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":12,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":13,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":15,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":16,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":18,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":19,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":21,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":22,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":24,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":25,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":27,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":28,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":30,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":31,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":33,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":34,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":36,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":37,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":39,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":40,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":42,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":43,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":45,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":46,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":48,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":49,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Name]","file":"TOSCA.meta","lineNumber":51,"errorCode":"0x1005"},{"code":"0x1005","subCode":null,"message":"Ignored. Entry [Content-Type]","file":"TOSCA.meta","lineNumber":52,"errorCode":"0x1005"}]},{"passed":false,"vnfreqName":"r02454","description":"The VNF MUST support the existence of multiple major/minor versions of the\n VNF software and/or sub-components and interfaces that support both forward \n and backward compatibility to be transparent to the Service Provider usage.\n","errors":[{"code":"0x1002","subCode":"r02454-0x1000","message":"Missing. Entry [Software Image]. The VNF MUST support the existence of multiple major/minor versions of the VNF software and/or sub-components and interfaces that support both forward and backward compatibility to be transparent to the Service Provider usage.","file":"ns2__VoLTE.yaml","lineNumber":-1,"errorCode":"r02454-0x1000"}]},{"passed":false,"vnfreqName":"r04298","description":"VNF provider MUST provider their testing scripts to support testing","errors":[{"code":"0x1002","subCode":"r04298-0x1000","message":"Missing. Entry [Tests]. The VNF provider MUST provide their testing scripts to support testing.","file":"CSAR Archive","lineNumber":-1,"errorCode":"r04298-0x1000"}]},{"passed":true,"vnfreqName":"r07879","description":"The VNF Package MUST include all relevant playbooks to ONAP to be loaded on the Ansible Server.","errors":[{"code":"0x1002","subCode":"r07879-0x1000","message":"Missing. Entry [playbooks]. The VNF Package MUST include all relevant playbooks to ONAP to be loaded on the Ansible Server.","file":"CSAR Archive","lineNumber":-1,"errorCode":"r07879-0x1000"}]},{"passed":false,"vnfreqName":"r09467","description":"The VNF MUST utilize only NCSP standard compute flavors. [5] - compute, virtual storage.","errors":[{"code":"0x1002","subCode":"r09467-0x1000","message":"Missing. Entry [Flavor]. The VNF MUST utilize only NCSP standard compute flavors. [5] - compute, virtual storage","file":"ns2__VoLTE.yaml","lineNumber":-1,"errorCode":"r09467-0x1000"}]},{"passed":true,"vnfreqName":"r13390","description":"The VNF provider MUST provide cookbooks to be loaded on the appropriate Chef Server.","errors":[{"code":"0x1002","subCode":"r13390-0x1000","message":"Missing. Entry [cookbooks]. The VNF provider MUST provide cookbooks to be loaded on the appropriate Chef Server.","file":"CSAR Archive","lineNumber":-1,"errorCode":"r13390-0x1000"}]},{"passed":false,"vnfreqName":"r23823","description":"The VNF Package MUST include appropriate credentials so that ONAP can interact with the Chef Server","errors":[{"code":"0x1002","subCode":"r23823-0x1000","message":"Missing. Entry [Certificates]. The VNF Package MUST include appropriate credentials so that ONAP can interact with the Chef Server","file":"CSAR Archive","lineNumber":-1,"errorCode":"r23823-0x1000"}]},{"passed":false,"vnfreqName":"r26881","description":"The VNF provider MUST provide the binaries and images needed to instantiate the VNF (VNF and VNFC images).","errors":[{"code":"0x1002","subCode":"r26881-0x1000","message":"Missing. Entry [Artifacts]. The VNF provider MUST provide the binaries and images needed to instantiate the VNF (VNF and VNFC images).","file":"CSAR Archive","lineNumber":-1,"errorCode":"r26881-0x1000"}]},{"passed":true,"vnfreqName":"r27310","description":"The VNF Package MUST include all relevant Chef artifacts (roles/cookbooks/recipes) \nrequired to execute VNF actions requested by ONAP for loading on appropriate Chef Server.\n","errors":[{"code":"0x1002","subCode":"r27310-0x1000","message":"Missing. Entry [cookbooks]. The VNF Package MUST include all relevant Chef artifacts (roles/cookbooks/recipes) required to execute VNF actions requested by ONAP for loading on appropriate Chef Server.","file":"CSAR Archive","lineNumber":-1,"errorCode":"r27310-0x1000"}]},{"passed":false,"vnfreqName":"r35851","description":"The VNF Package MUST include VNF topology that describes basic network and application\n connectivity internal and external to the VNF including Link type, KPIs, Bandwidth, \n latency, jitter, QoS (if applicable) for each interface.\n","errors":[{"code":"0x1002","subCode":"r35851-0x1000","message":"Missing. Entry [Topology VL]. The VNF Package MUST include VNF topology that describes basic network and application connectivity internal and external to the VNF including Link type, KPIs, Bandwidth, latency, jitter, QoS (if applicable) for each interface","file":"ns2__VoLTE.yaml","lineNumber":-1,"errorCode":"r35851-0x1000"}]},{"passed":true,"vnfreqName":"r40293","description":"The VNF MUST make available (or load on VNF Ansible Server) playbooks that conform to the ONAP requirement.","errors":[{"code":"0x1002","subCode":"r40293-0x1000","message":"Missing. Entry [playbooks]. The VNF MUST make available (or load on VNF Ansible Server) playbooks that conform to the ONAP requirement.","file":"CSAR Archive","lineNumber":-1,"errorCode":"r40293-0x1000"}]},{"passed":false,"vnfreqName":"r43958","description":"The VNF Package MUST include documentation describing the tests that were conducted by the VNF provider and the test results.","errors":[{"code":"0x1002","subCode":"r43958-0x1000","message":"Missing. Entry [Tests/report.txt]. The VNF Package MUST include documentation describing the tests that were conducted by the VNF provider and the test results.","file":"CSAR Archive","lineNumber":-1,"errorCode":"r43958-0x1000"}]},{"passed":true,"vnfreqName":"r66070","description":"The VNF Package MUST include VNF Identification Data to uniquely identify the \nresource for a given VNF provider. The identification data must include: an identifier \nfor the VNF, the name of the VNF as was given by the VNF provider, VNF description, \nVNF provider, and version\n","errors":[]},{"passed":true,"vnfreqName":"r77707","description":"VNF provider MUST include manifest file that contains a list of all the components in VNF package","errors":[]},{"passed":true,"vnfreqName":"r77786","description":"The VNF Package MUST include all relevant cookbooks to be loaded on the ONAP Chef Server.","errors":[{"code":"0x1002","subCode":"r77786-0x1000","message":"Missing. Entry [cookbooks]. The VNF Package MUST include all relevant cookbooks to be loaded on the ONAP Chef Server.","file":"CSAR Archive","lineNumber":-1,"errorCode":"r77786-0x1000"}]}],"contact":"ONAP VTP Team onap-discuss@lists.onap.org","platform":"VNF Test Platform (VTP) 1.0"} \ No newline at end of file