Create a upstream repos validator

This Unit Test helps to validate the usage of the official
repositrories and fails in case that a minimum are not used.

Change-Id: Id5a922163a8a0d16de5460aee92e5cced3f285a3
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-Id: INT-289
diff --git a/bootstrap/vagrant-onap/tests/projects.txt b/bootstrap/vagrant-onap/tests/projects.txt
new file mode 100644
index 0000000..0aba508
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/projects.txt
@@ -0,0 +1,209 @@
+aaf/authz
+aaf/cadi
+aaf/inno
+aaf/luaplugin
+aai/aai-common
+aai/aai-config
+aai/aai-data
+aai/aai-service
+aai/babel
+aai/champ
+aai/data-router
+aai/esr-gui
+aai/esr-server
+aai/gizmo
+aai/logging-service
+aai/model-loader
+aai/resources
+aai/rest-client
+aai/router-core
+aai/search-data-service
+aai/sparky-be
+aai/sparky-fe
+aai/test-config
+aai/traversal
+appc
+appc/deployment
+ccsdk/dashboard
+ccsdk/distribution
+ccsdk/parent
+ccsdk/platform/blueprints
+ccsdk/platform/nbapi
+ccsdk/platform/plugins
+ccsdk/sli/adaptors
+ccsdk/sli/core
+ccsdk/sli/northbound
+ccsdk/sli/plugins
+ccsdk/storage/esaas
+ccsdk/storage/pgaas
+ccsdk/utils
+ci-management
+clamp
+cli
+dcae
+dcae/apod
+dcae/apod/analytics
+dcae/apod/buildtools
+dcae/apod/cdap
+dcae/collectors
+dcae/collectors/ves
+dcae/controller
+dcae/controller/analytics
+dcae/dcae-inventory
+dcae/demo
+dcae/demo/startup
+dcae/demo/startup/aaf
+dcae/demo/startup/controller
+dcae/demo/startup/message-router
+dcae/dmaapbc
+dcae/operation
+dcae/operation/utils
+dcae/orch-dispatcher
+dcae/pgaas
+dcae/utils
+dcae/utils/buildtools
+dcaegen2
+dcaegen2/analytics
+dcaegen2/analytics/tca
+dcaegen2/collectors
+dcaegen2/collectors/snmptrap
+dcaegen2/collectors/ves
+dcaegen2/deployments
+dcaegen2/platform
+dcaegen2/platform/blueprints
+dcaegen2/platform/cdapbroker
+dcaegen2/platform/cli
+dcaegen2/platform/configbinding
+dcaegen2/platform/deployment-handler
+dcaegen2/platform/inventory-api
+dcaegen2/platform/plugins
+dcaegen2/platform/policy-handler
+dcaegen2/platform/registrator
+dcaegen2/platform/servicechange-handler
+dcaegen2/utils
+demo
+dmaap/buscontroller
+dmaap/datarouter
+dmaap/dbcapi
+dmaap/messagerouter/dmaapclient
+dmaap/messagerouter/messageservice
+dmaap/messagerouter/mirroragent
+dmaap/messagerouter/msgrtr
+doc
+doc/tools
+ecompsdkos
+externalapi/nbi
+holmes/common
+holmes/dsa
+holmes/engine-management
+holmes/rule-management
+integration
+logging-analytics
+modeling/modelspec
+modeling/toscaparsers
+msb/apigateway
+msb/discovery
+msb/java-sdk
+msb/swagger-sdk
+mso
+mso/chef-repo
+mso/docker-config
+mso/libs
+mso/mso-config
+multicloud/azure
+multicloud/framework
+multicloud/openstack
+multicloud/openstack/vmware
+multicloud/openstack/windriver
+ncomp
+ncomp/cdap
+ncomp/core
+ncomp/docker
+ncomp/maven
+ncomp/openstack
+ncomp/sirius
+ncomp/sirius/manager
+ncomp/utils
+oom
+oom/registrator
+oparent
+optf/cmso
+optf/has
+optf/osdf
+policy/api
+policy/common
+policy/docker
+policy/drools-applications
+policy/drools-pdp
+policy/engine
+policy/gui
+policy/pap
+policy/pdp
+portal
+portal/sdk
+sdc
+sdc/jtosca
+sdc/sdc-distribution-client
+sdc/sdc-docker-base
+sdc/sdc-titan-cassandra
+sdc/sdc-tosca
+sdc/sdc-workflow-designer
+sdnc/adaptors
+sdnc/architecture
+sdnc/core
+sdnc/features
+sdnc/northbound
+sdnc/oam
+sdnc/parent
+sdnc/plugins
+so
+so/chef-repo
+so/docker-config
+so/libs
+so/so-config
+testsuite
+testsuite/heatbridge
+testsuite/properties
+testsuite/python-testing-utils
+ui
+ui/dmaapbc
+university
+usecase-ui
+usecase-ui/server
+vfc/gvnfm/vnflcm
+vfc/gvnfm/vnfmgr
+vfc/gvnfm/vnfres
+vfc/nfvo/catalog
+vfc/nfvo/driver/ems
+vfc/nfvo/driver/sfc
+vfc/nfvo/driver/vnfm/gvnfm
+vfc/nfvo/driver/vnfm/svnfm
+vfc/nfvo/lcm
+vfc/nfvo/resmanagement
+vfc/nfvo/wfengine
+vid
+vid/asdcclient
+vnfrqts/epics
+vnfrqts/guidelines
+vnfrqts/requirements
+vnfrqts/testcases
+vnfrqts/usecases
+vnfsdk/compliance
+vnfsdk/functest
+vnfsdk/lctest
+vnfsdk/model
+vnfsdk/pkgtools
+vnfsdk/refrepo
+vnfsdk/validation
+vvp/ansible-ice-bootstrap
+vvp/cms
+vvp/devkit
+vvp/documentation
+vvp/engagementmgr
+vvp/gitlab
+vvp/image-scanner
+vvp/jenkins
+vvp/portal
+vvp/postgresql
+vvp/test-engine
+vvp/validation-scripts
diff --git a/bootstrap/vagrant-onap/tests/test_ccsdk b/bootstrap/vagrant-onap/tests/test_ccsdk
index 2d2b87a..81bdd48 100644
--- a/bootstrap/vagrant-onap/tests/test_ccsdk
+++ b/bootstrap/vagrant-onap/tests/test_ccsdk
@@ -27,13 +27,13 @@
 }
 
 # test_compile_ccsdk_repos() - Verify the compilation of CCSDK repositories
-function compile_ccsdk_repos {
+function test_compile_ccsdk_repos {
     clone_ccsdk_repos
     compile_ccsdk_repos
 
-    asserts_file_exist $ccsdk_src_folder/dashboard/oom-app-common/target/oom-app-common-1.1.0-SNAPSHOT.jar
-    asserts_file_exist $ccsdk_src_folder/dashboard/oom-app-os/target/oom-app-os-1.1.0-SNAPSHOT.war
-    asserts_file_exist $ccsdk_src_folder/dashboard/oom-app-overlay/target/oom-app-overlay-1.1.0-SNAPSHOT.war
+    asserts_file_exist $ccsdk_src_folder/dashboard/ccsdk-app-common/target/ccsdk-app-common-1.1.0-SNAPSHOT.jar
+    asserts_file_exist $ccsdk_src_folder/dashboard/ccsdk-app-os/target/ccsdk-app-os-1.1.0-SNAPSHOT.war
+    asserts_file_exist $ccsdk_src_folder/dashboard/ccsdk-app-overlay/target/ccsdk-app-overlay-1.1.0-SNAPSHOT.war
     asserts_file_exist $ccsdk_src_folder/distribution/dgbuilder/target/dgbuilder.0.1.0-SNAPSHOT.zip
     asserts_file_exist $ccsdk_src_folder/distribution/platform-logic/installer/target/platform-logic-installer-0.1.0-SNAPSHOT.zip
     asserts_file_exist $ccsdk_src_folder/platform/nbapi/target/commonnbapi-0.0.3.war
diff --git a/bootstrap/vagrant-onap/tests/test_dcae b/bootstrap/vagrant-onap/tests/test_dcae
index 104cadd..c6887cd 100644
--- a/bootstrap/vagrant-onap/tests/test_dcae
+++ b/bootstrap/vagrant-onap/tests/test_dcae
@@ -28,6 +28,7 @@
     asserts_file_exist $dcae_src_folder/dmaapbc/pom.xml
     asserts_file_exist $dcae_src_folder/operation/README.md
     asserts_file_exist $dcae_src_folder/operation/utils/pom.xml
+    asserts_file_exist $dcae_src_folder/orch-dispatcher/LICENSE.txt
     asserts_file_exist $dcae_src_folder/pgaas/LICENSE.txt
     asserts_file_exist $dcae_src_folder/utils/README.md
     asserts_file_exist $dcae_src_folder/utils/buildtools/LICENSE.txt
diff --git a/bootstrap/vagrant-onap/tests/test_functions b/bootstrap/vagrant-onap/tests/test_functions
index ee7358a..8043ebb 100644
--- a/bootstrap/vagrant-onap/tests/test_functions
+++ b/bootstrap/vagrant-onap/tests/test_functions
@@ -8,7 +8,7 @@
 "configure_bind" "install_java" "install_maven" "install_nodejs" "install_python"
 "install_docker" "pull_docker_image" "install_docker_compose" "configure_service"
 "start_ODL" "compile_src" "build_docker_image" "docker_openecomp_login"
-"pull_openecomp_image" "pull_onap_image"
+"pull_openecomp_image" "pull_onap_image" "coverity_repos"
 )
 
 # test_create_configuration_files() - Verify the creation of a configuration files
@@ -165,6 +165,32 @@
     asserts_image onap/ccsdk-ubuntu-image
 }
 
+# test_coverity_repos() - Verify that all the repos are covered by scripts
+function test_coverity_repos {
+    # Get repositories list from source code files
+    repos_list=()
+    for module in $( stat -c "%F %n" /var/onap/* | grep -v "_\|functions\|commons\|files" | cut -d' ' -f 3-); do
+        source $module
+        module_repo_list=$(eval echo \${$(basename $module)_repos[@]})
+        repos_list=(${repos_list[@]} ${module_repo_list[@]})
+    done
+
+    pushd /var/onap_tests/
+    cp projects.txt remaining_projects.txt
+    for covered_repo in "${repos_list[@]}"; do
+        sed -i "/$covered_repo/d" remaining_projects.txt
+    done
+
+    threshold=75
+    num_projects=$(wc -l < projects.txt)
+    num_remaining_projects=$(wc -l < remaining_projects.txt)
+    coverage=`echo "scale=2; 100-($num_remaining_projects/$num_projects*100)" | bc | cut -d . -f 1`
+    if [ $coverage -lt $threshold ]; then
+        raise_error "There are repositories that are not covered by scripts"
+    fi
+    popd
+}
+
 if [ "$1" != '*' ]; then
     unset covered_functions
     covered_functions=$1