summaryrefslogtreecommitdiffstats
path: root/csarvalidation/README.md
blob: d940d1d942bc32062a056d8602b1ee7ced84631a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
CSAR Validation
===============
Validates CSAR based on
* ETSI SOL004 & SOL001 specification
* ONAP VNFREQS & PNFREQS

Every validation aspect is modeled as one test cases using Open Command Specification (OCS) 1.o
and by using Open CLI Platform (OCLIP), those test cases are executed similar to running commands

SOL004 specification is implemented in org.onap.cvc.csar.CSARArchive class by supporting both the
options one with TOSCA-meta and another one without TOSCA-meta. This class could be used as SDK for
parsing the given CSAR.

Every VNFREQS & PNFREQS is implemented as independent test case and following guidelines provide
required steps to add test cases.

How to add new test cases?
--------------------------
Assume that we want to address the VNFREQS  R02454 as one test case.

1. Create new OCS yaml vtp-validate-csar-r02454.yaml under src/main/resources/open-cli-schema folder

NOTE:
Name of the file should be always in the form of vtp-validate-csar-<VNFREWQS-Number>.yaml
Inside this YAML, add name as csar-validate-<VNFREWQS-Number>.
Remaining section would be same as other existing OCS YAML.

2. Add corresponding implementation class under src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARR02454.java

NOTE:
Add @OnapCommandSchema(schema = "vtp-validate-csar-r02454.yaml") annotation to the class, where the schema will
have OCS YAML file name

3. Add required CSARError inside this class and set unique error code using CSARError::setCode() method

4. Implement the run() method in this class by using the below code snippet

    protected void run() throws OnapCommandException {
        //Read the input arguments
        String path = (String) getParametersMap().get("csar").getValue();
        List<CSARError> errors = new ArrayList<>();
        //execute
        try {
            CSARArchive csar = new CSARArchive();
            csar.init(path);
            csar.parse();

           // *********** ADD REQUIRED VALIDATION ************

            csar.cleanup();
        } catch (Exception e) {
            LOG.error("R-40293: ", e);
            throw new OnapCommandExecutionFailed(e.getMessage());
        }

        this.getResult().setOutput(errors);

        //set the result
        for (CSARError e: errors) {
            this.getResult().getRecordsMap().get("code").getValues().add(e.getCode());
            this.getResult().getRecordsMap().get("message").getValues().add(e.getMessage());
            this.getResult().getRecordsMap().get("file").getValues().add(e.getFile());
            this.getResult().getRecordsMap().get("line-no").getValues().add(Integer.toString(e.getLineNumber()));
        }
   }

5. Add the new class into src/main/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand file

6. Run the test cases at src/test/java/org/onap/cvc/csar/CsarValidatorTest and verify that it picked up the new test cases.

How to configure vnfreqs.properties
-----------------------------------

1. To enable the given vnfreqs, edit vnfreqs.enabled with required VNFREQS number

2. To ignore certian errors, use errors.ignored.

How to run CSAR validation
--------------------------
Follow the setups given below to run as csar-validate command

1. Install OCLIP (`wget -O - https://raw.githubusercontent.com/onap/cli/master/deployment/zip/installer/install-latest.sh | sh`)

2. Run `mvn clean install` on this project, and copy the target/validation-csar-x.y.z.jar in to $OPEN_CLI_HOME/lib

3. Run `oclip --product onap-vtp csar-validate --csar <CSAR path>`

Contact
-------
Kanagaraj.Manickam@huawei.com
6 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
<!--
============LICENSE_START=======================================================
SDC
================================================================================
Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
================================================================================
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=========================================================
Modifications copyright (c) 2018 Nokia
================================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.openecomp.sdc</groupId>
    <artifactId>sdc-main</artifactId>
    <version>1.3.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>sdc</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- 3rd parties versions -->
        <lang3.version>3.3.2</lang3.version>
        <guava.version>18.0</guava.version>
        <titan.version>1.0.0</titan.version>
        <sdc.titan.version>1.2.0</sdc.titan.version>
        <spring.version>4.3.18.RELEASE</spring.version>
        <spring.security.version>3.2.3.RELEASE</spring.security.version>
        <spring.ldap.version>2.0.1.RELEASE</spring.ldap.version>
        <jersey-bom.version>2.27</jersey-bom.version>
        <servlet-api.version>3.1.0</servlet-api.version>
        <wire-mock.version>2.18.0</wire-mock.version>
        <ecomp.version>2.4.0</ecomp.version>
        <cassandra.unit.version>3.5.0.1</cassandra.unit.version>

        <!-- Elastic Search mapper (reference the elastic search version actually). -->
        <elastic-search.version>2.4.0</elastic-search.version>
        <catalog-artifacts.version>1.0.0-SNAPSHOT</catalog-artifacts.version>
        <catalog-builders.version>1.0.0-SNAPSHOT</catalog-builders.version>
        <jetty.version>9.4.11.v20180605</jetty.version>

        <!-- JSON and YAML Parsing -->
        <jackson.version>2.8.10</jackson.version>
        <jackson-annotations.version>2.8.0</jackson-annotations.version>

        <!-- Yaml for properties -->
        <snakeyaml.version>1.14</snakeyaml.version>
        <functionaljava.version>4.7</functionaljava.version>
        <httpclient.version>4.5.3</httpclient.version>
        <httpcore.version>4.4.1</httpcore.version>
        <json-simple.version>1.1</json-simple.version>

        <!-- Logging start -->
        <!-- logback -->
        <logback.version>1.2.3</logback.version>
        <slf4j-api.version>1.7.25</slf4j-api.version>
        <commons-codec>1.10</commons-codec>
        <commons-logging>1.2</commons-logging>
        <janino.version>3.0.6</janino.version>

        <!-- aspects -->
        <jcabi.version>0.20.1</jcabi.version>
        <aspectjrt.version>1.8.4</aspectjrt.version>
        <aspectj.version>1.7.4</aspectj.version>
        <jcabi.maven.plugin.version>0.13.2</jcabi.maven.plugin.version>

        <!-- Logging end -->
        <!-- System Metrics -->
        <sigar.version>1.6.4</sigar.version>

        <regex.version>3.0.3</regex.version>

        <!--GSON-->
        <gson.version>2.3.1</gson.version>

        <!--listen to file changes-->
        <commons-jci-core.version>1.1</commons-jci-core.version>

        <!--TESTING-->
        <mockito.version>2.18.3</mockito.version>
        <jmockit.version>1.33</jmockit.version>
        <junit.version>4.12</junit.version>
        <assertj.version>3.10.0</assertj.version>
        <testng.version>6.9.10</testng.version>
        <extentreports.version>3.0.3</extentreports.version>
        <cucumber.version>2.4.0</cucumber.version>
        <bean-matchers.version>0.11</bean-matchers.version>

        <!-- parser-->
        <sdc-tosca-parser.version>1.3.5</sdc-tosca-parser.version>

        <!-- sonar -->
        <sonar.language>java</sonar.language>
        <sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding>
        <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir>
        <sonar.branch>${project.version}</sonar.branch>

        <!--cassandra -->
        <cassandra.driver.version>3.0.0</cassandra.driver.version>
        <!-- maven central (Nexus) -->
        <nexus.id.release>nexus</nexus.id.release>
        <nexus.id.snapshot>nexus</nexus.id.snapshot>

        <!--nexus-->
        <npm.registry>https://registry.npmjs.org/</npm.registry>
        <!-- https://nexus.onap.org/content/repositories/npm/ -->
        <nexus.proxy>https://nexus.onap.org</nexus.proxy>
        <sitePath>/content/sites/site/org/openecomp/sdc/${project.version}</sitePath>
        <staging.profile.id>176c31dfe190a</staging.profile.id>
        <!--maven-->
        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
        <!--docker tags-->
        <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag>


    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.jersey.ext</groupId>
                <artifactId>jersey-bean-validation</artifactId>
                <version>${jersey-bom.version}</version>
            </dependency>

            <dependency>
                <groupId>org.glassfish.hk2.external</groupId>
                <artifactId>asm-all-repackaged</artifactId>
                <version>2.4.0</version>
            </dependency>

            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>

            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
            </dependency>
            
			<dependency>
			<groupId>org.jmockit</groupId>
				<artifactId>jmockit</artifactId>
				<version>${jmockit.version}</version>
			</dependency>
			

            <dependency>
                <groupId>com.github.tomakehurst</groupId>
                <artifactId>wiremock-standalone</artifactId>
                <version>${wire-mock.version}</version>
            </dependency>

            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-java</artifactId>
                <version>${cucumber.version}</version>
            </dependency>

            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-junit</artifactId>
                <version>${cucumber.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy</artifactId>
                <version>2.4.13</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-all</artifactId>
                <version>4.0.45.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-handler</artifactId>
                <version>4.0.45.Final</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <failOnError>false</failOnError>
                    <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                    <docletArtifact>
                        <groupId>org.umlgraph</groupId>
                        <artifactId>umlgraph</artifactId>
                        <version>5.6</version>
                    </docletArtifact>
                    <useStandardDocletOptions>true</useStandardDocletOptions>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.6.0</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.4.1.1168</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>ru.yaal.maven</groupId>
                    <artifactId>write-text-files-maven-plugin</artifactId>
                    <version>1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.gmaven</groupId>
                    <artifactId>gmaven-plugin</artifactId>
                    <version>1.5</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>0.26.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.2.2</version>
                </plugin>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                </plugin>
                <plugin>
                    <groupId>com.github.sylvainlaurent.maven</groupId>
                    <artifactId>yaml-json-validator-maven-plugin</artifactId>
                    <version>1.0.1</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>

            <!-- Staging Plugin -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <nexusUrl>${nexus.proxy}</nexusUrl>
                    <stagingProfileId>${staging.profile.id}</stagingProfileId>
                    <serverId>ecomp-staging</serverId>
                </configuration>
            </plugin>

            <!-- plugin for parsing the project version -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>parse-version</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>parse-version</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Java Code Coverage -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.wagon</groupId>
                        <artifactId>wagon-webdav-jackrabbit</artifactId>
                        <version>3.0.0</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Set the deployment repositories properties. -->
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <executions>
                    <execution>
                        <inherited>false</inherited>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                pom.properties['deploy.url'] =
                                pom.version.contains('-SNAPSHOT') ?
                                project.distributionManagement.snapshotRepository.url :
                                project.distributionManagement.repository.url;
                                pom.properties['repo.id'] = pom.version.contains('-SNAPSHOT') ?
                                project.distributionManagement.snapshotRepository.id :
                                project.distributionManagement.repository.id;
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <printSummary>false</printSummary>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>all</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>onboarding</module>
                <module>security-utils</module>
                <module>common-app-api</module>
                <module>common-be</module>
                <module>catalog-dao</module>
                <module>catalog-model</module>
                <module>catalog-be</module>
                <module>asdctool</module>
                <module>catalog-ui</module>
                <module>catalog-fe</module>
                <module>test-apis-ci</module>
                <module>ui-ci</module>
                <module>sdc-os-chef</module>
                <module>utils/webseal-simulator</module>
            </modules>

        </profile>

        <profile>
            <id>catalog</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>security-utils</module>
                <module>common-app-api</module>
                <module>common-be</module>
                <module>catalog-dao</module>
                <module>catalog-model</module>
                <module>catalog-be</module>
                <module>asdctool</module>
                <module>catalog-ui</module>
                <module>catalog-fe</module>
                <module>test-apis-ci</module>
                <module>ui-ci</module>
            </modules>

            <properties>
                <ecomp.version>1.2.7</ecomp.version>
                <sdc-tosca-parser.version>1.1.32</sdc-tosca-parser.version>
            </properties>
        </profile>

        <profile>
            <id>onboarding</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>onboarding</module>
            </modules>
        </profile>

    </profiles>

    <repositories>
        <!-- LF repositories -->
        <repository>
            <id>ecomp-releases</id>
            <name>Release Repository</name>
            <url>${nexus.proxy}/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>ecomp-snapshots</id>
            <name>Snapshots Repository</name>
            <url>${nexus.proxy}/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>ecomp-public</id>
            <name>Public Repository</name>
            <url>${nexus.proxy}/content/repositories/public/</url>
        </repository>
        <!-- LF repositories END-->
    </repositories>

    <distributionManagement>
        <repository>
            <id>ecomp-releases</id>
            <name>Release Repository</name>
            <url>${nexus.proxy}/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>ecomp-snapshots</id>
            <name>Snapshot Repository</name>
            <url>${nexus.proxy}/content/repositories/snapshots/</url>
        </snapshotRepository>
        <site>
            <id>ecomp-site</id>
            <url>dav:${nexus.proxy}${sitePath}</url>
        </site>
    </distributionManagement>
</project>