diff options
Diffstat (limited to 'bootstrap')
51 files changed, 973 insertions, 278 deletions
diff --git a/bootstrap/jenkins/vagrant/Vagrantfile b/bootstrap/jenkins/vagrant/Vagrantfile index 02b3ec18c..7dcb48eff 100644 --- a/bootstrap/jenkins/vagrant/Vagrantfile +++ b/bootstrap/jenkins/vagrant/Vagrantfile @@ -49,6 +49,7 @@ Vagrant.configure(2) do |config| # # # Customize the amount of memory on the VM: vb.memory = "8192" + vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] end # # View the documentation for the provider you are using for more diff --git a/bootstrap/jenkins/vagrant/bootstrap.sh b/bootstrap/jenkins/vagrant/bootstrap.sh index fd0caf5c6..25c6a45f6 100755 --- a/bootstrap/jenkins/vagrant/bootstrap.sh +++ b/bootstrap/jenkins/vagrant/bootstrap.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # # Copyright 2017 Huawei Technologies Co., Ltd. # @@ -39,16 +39,16 @@ apt-get update apt-get -y install git git config --global user.email "jenkins@localhost" git config --global user.name "jenkins" -apt-get -y install curl openjdk-8-jdk maven unzip +apt-get -y install curl openjdk-8-jdk-headless maven unzip python-pip # install Jenkins wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' apt-get update -apt-get -y install jenkins jenkins-job-builder python-pip +apt-get -y install jenkins +# install docker apt-get -y install docker.io -sudo usermod -aG docker ubuntu sudo usermod -aG docker jenkins su -l jenkins -c "/vagrant/jenkins-init-1.sh" diff --git a/bootstrap/jenkins/vagrant/jenkins-init-1.sh b/bootstrap/jenkins/vagrant/jenkins-init-1.sh index 1f0a80859..3e83fa118 100755 --- a/bootstrap/jenkins/vagrant/jenkins-init-1.sh +++ b/bootstrap/jenkins/vagrant/jenkins-init-1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # # Copyright 2017 Huawei Technologies Co., Ltd. # diff --git a/bootstrap/jenkins/vagrant/jenkins-init-2.sh b/bootstrap/jenkins/vagrant/jenkins-init-2.sh index a6cddbb10..f255a10ad 100755 --- a/bootstrap/jenkins/vagrant/jenkins-init-2.sh +++ b/bootstrap/jenkins/vagrant/jenkins-init-2.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # # Copyright 2017 Huawei Technologies Co., Ltd. # diff --git a/bootstrap/jenkins/vagrant/jjb-init.sh b/bootstrap/jenkins/vagrant/jjb-init.sh index e9adeb63b..10b96b4fa 100755 --- a/bootstrap/jenkins/vagrant/jjb-init.sh +++ b/bootstrap/jenkins/vagrant/jjb-init.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # # Copyright 2017 Huawei Technologies Co., Ltd. # @@ -17,9 +17,10 @@ git commit -m 'Installed plugins, restarted Jenkins' > /dev/null mkdir -p ~/.config/jenkins_jobs cp /vagrant/jenkins_jobs.ini ~/.config/jenkins_jobs -pip install --user jenkins-job-builder +pip -v install --user jenkins-job-builder +pip list -jenkins-job-builder update -r /vagrant/jjb +jenkins-jobs update -r /vagrant/jjb cat > .gitignore <<EOF jobs/*/builds diff --git a/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml b/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml index 9662e83d3..73d320e4a 100644 --- a/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml +++ b/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml @@ -21,6 +21,9 @@ - 'aai_aai-service': repo: 'aai/aai-service' pom: 'pom.xml' + - 'aai_babel': + repo: 'aai/babel' + pom: 'pom.xml' - 'aai_champ': repo: 'aai/champ' pom: 'pom.xml' @@ -237,9 +240,12 @@ - 'holmes_rule-management': repo: 'holmes/rule-management' pom: 'pom.xml' - - 'integration': + - 'integration_test_mocks_sniroemulator': repo: 'integration' - pom: 'pom.xml' + pom: 'test/mocks/sniroemulator/pom.xml' + - 'integration_version-manifest': + repo: 'integration' + pom: 'version-manifest/pom.xml' - 'modeling_toscaparsers_javatoscachecker': repo: 'modeling/toscaparsers' pom: 'javatoscachecker/pom.xml' @@ -273,6 +279,9 @@ - 'multicloud_openstack_vmware': repo: 'multicloud/openstack/vmware' pom: 'pom.xml' + - 'multicloud_openstack_windriver': + repo: 'multicloud/openstack/windriver' + pom: 'pom.xml' - 'ncomp_cdap': repo: 'ncomp/cdap' pom: 'pom.xml' @@ -295,9 +304,6 @@ repo: 'ncomp/utils' pom: 'pom.xml' - 'oom_registrator': - repo: 'oom' - pom: 'registrator/pom.xml' - - 'oom_registrator': repo: 'oom/registrator' pom: 'pom.xml' - 'oparent': @@ -357,9 +363,6 @@ - 'sdc_sdc-workflow-designer': repo: 'sdc/sdc-workflow-designer' pom: 'pom.xml' - - 'sdc_sdc_common': - repo: 'sdc/sdc_common' - pom: 'pom.xml' - 'sdnc_adaptors': repo: 'sdnc/adaptors' pom: 'pom.xml' @@ -382,9 +385,6 @@ repo: 'so/libs' pom: 'pom.xml' - 'testsuite_heatbridge': - repo: 'testsuite' - pom: 'heatbridge/pom.xml' - - 'testsuite_heatbridge': repo: 'testsuite/heatbridge' pom: 'pom.xml' - 'ui_dmaapbc': @@ -393,6 +393,9 @@ - 'usecase-ui': repo: 'usecase-ui' pom: 'pom.xml' + - 'usecase-ui_server': + repo: 'usecase-ui/server' + pom: 'pom.xml' - 'vfc_gvnfm_vnflcm': repo: 'vfc/gvnfm/vnflcm' pom: 'pom.xml' @@ -423,21 +426,24 @@ - 'vfc_nfvo_resmanagement': repo: 'vfc/nfvo/resmanagement' pom: 'pom.xml' - - 'vfc_nfvo_wfengine_activiti-extension': - repo: 'vfc/nfvo/wfengine' - pom: 'activiti-extension/pom.xml' - - 'vfc_nfvo_wfengine_wfenginemgrservice': - repo: 'vfc/nfvo/wfengine' - pom: 'wfenginemgrservice/pom.xml' - - 'vfc_nfvo_wfengine_wso2': + - 'vfc_nfvo_wfengine': repo: 'vfc/nfvo/wfengine' - pom: 'wso2/pom.xml' + pom: 'pom.xml' - 'vid': repo: 'vid' pom: 'pom.xml' - 'vid_asdcclient': repo: 'vid/asdcclient' pom: 'pom.xml' + - 'vnfsdk_compliance_veslibrary_ves_clibrary_VESreporting_vFW': + repo: 'vnfsdk/compliance' + pom: 'veslibrary/ves_clibrary/VESreporting_vFW/pom.xml' + - 'vnfsdk_compliance_veslibrary_ves_clibrary_VESreporting_vLB': + repo: 'vnfsdk/compliance' + pom: 'veslibrary/ves_clibrary/VESreporting_vLB/pom.xml' + - 'vnfsdk_compliance_veslibrary_ves_javalibrary_evel_javalib2': + repo: 'vnfsdk/compliance' + pom: 'veslibrary/ves_javalibrary/evel_javalib2/pom.xml' - 'vnfsdk_functest': repo: 'vnfsdk/functest' pom: 'pom.xml' @@ -453,3 +459,27 @@ - 'vnfsdk_validation': repo: 'vnfsdk/validation' pom: 'pom.xml' + - 'vvp_cms': + repo: 'vvp/cms' + pom: 'pom.xml' + - 'vvp_engagementmgr': + repo: 'vvp/engagementmgr' + pom: 'pom.xml' + - 'vvp_gitlab': + repo: 'vvp/gitlab' + pom: 'pom.xml' + - 'vvp_image-scanner': + repo: 'vvp/image-scanner' + pom: 'pom.xml' + - 'vvp_jenkins': + repo: 'vvp/jenkins' + pom: 'pom.xml' + - 'vvp_portal': + repo: 'vvp/portal' + pom: 'pom.xml' + - 'vvp_postgresql': + repo: 'vvp/postgresql' + pom: 'pom.xml' + - 'vvp_test-engine': + repo: 'vvp/test-engine' + pom: 'pom.xml' diff --git a/bootstrap/vagrant-onap/.gitignore b/bootstrap/vagrant-onap/.gitignore index 3c502a0af..873bd8b4d 100644 --- a/bootstrap/vagrant-onap/.gitignore +++ b/bootstrap/vagrant-onap/.gitignore @@ -8,3 +8,5 @@ lib/files/sources.list openrc doc/build/ etc/settings.yaml +tests/remaining_projects.txt +tests/installed-software* diff --git a/bootstrap/vagrant-onap/README.md b/bootstrap/vagrant-onap/README.md index c48190ad1..3e1fa1223 100644 --- a/bootstrap/vagrant-onap/README.md +++ b/bootstrap/vagrant-onap/README.md @@ -1,7 +1,5 @@ # ONAP on Vagrant -[![Build Status](https://api.travis-ci.org/electrocucaracha/vagrant-onap.svg?branch=master)](https://api.travis-ci.org/electrocucaracha/vagrant-onap) - This vagrant project pretends to collect information about a way to deploy and build [ONAP project](https://www.onap.org/) into a development environment. @@ -57,8 +55,13 @@ current options include: | vfc | Virtual Function Controller | | multicloud | Multi Cloud | | ccsdk | Common Controller SDK | +| vnfsdk | VNF SDK | +| vvp | VNF Validation Program | +|:----------:|-------------------------------------| | all_in_one | All ONAP services in a VM | | testing | Unit Test VM | +|:----------:|-------------------------------------| +| openstack | OpenStack Deployment | #### Generating documentation diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile index c10cb0bc8..a0f3a1926 100644 --- a/bootstrap/vagrant-onap/Vagrantfile +++ b/bootstrap/vagrant-onap/Vagrantfile @@ -23,6 +23,7 @@ configuration = { 'openstack_password' => '', 'odl_version' => '0.5.3-Boron-SR3', # Parameters for enabling features + 'debug' => 'True', 'build_image' => 'True', 'clone_repo' => 'True', 'compile_repo' => 'False', @@ -50,7 +51,7 @@ nodes = [ }, { :name => "all-in-one", - :ips => ['10.252.0.3', "192.168.50.3"], + :ips => ['10.252.1.3', "192.168.51.3"], :macs => [], :cpus => 2, :cpu => "50", @@ -182,7 +183,7 @@ nodes = [ }, { :name => "testing", - :ips => ['10.252.0.3', "192.168.50.3"], + :ips => ['10.252.2.3', "192.168.52.3"], :macs => [], :cpus => 2, :cpu => "50", @@ -211,6 +212,36 @@ nodes = [ :groups => ["individual"], :args => ['vid'], }, + { + :name => "vnfsdk", + :ips => ['10.252.0.18', "192.168.50.18"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ['vnfsdk'], + }, + { + :name => "vvp", + :ips => ['10.252.0.17', "192.168.50.17"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ['vvp'], + }, + { + :name => "openstack", + :ips => ['10.252.3.3', "192.168.53.3"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 8 * 1024, + :groups => ["individual"], + :args => ['openstack'], + } ] run_path = 'vagrant_utils/postinstall.sh' @@ -290,6 +321,7 @@ Vagrant.configure("2") do |config| config.proxy.http = ENV['http_proxy'] config.proxy.https = ENV['https_proxy'] config.proxy.no_proxy = ENV['no_proxy'] + configuration['socks_proxy'] = ENV['socks_proxy'] end if Vagrant.has_plugin?('vagrant-vbguest') @@ -352,6 +384,9 @@ Vagrant.configure("2") do |config| # Set Box type nodeconfig.vm.box = box[provider] + if "openstack" == node[:name] + nodeconfig.vm.box = "ubuntu/xenial64" + end # Set Node name nodeconfig.vm.hostname = node[:name] diff --git a/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst index e2da33681..713c0e0fd 100644 --- a/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst +++ b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst @@ -2,7 +2,7 @@ Modify execution values ======================= -In order to provide a flexible plataform that adjusts to different developer +In order to provide a flexible platform that adjusts to different developer needs, it has been implemented two mechanism to configure the execution of this project. @@ -71,4 +71,3 @@ values that can be overriden using *-g* and *-i* respectively by the run scripts .. end - diff --git a/bootstrap/vagrant-onap/doc/source/features/example_usage.rst b/bootstrap/vagrant-onap/doc/source/features/example_usage.rst index fc5f8b39d..293c543fa 100644 --- a/bootstrap/vagrant-onap/doc/source/features/example_usage.rst +++ b/bootstrap/vagrant-onap/doc/source/features/example_usage.rst @@ -135,4 +135,17 @@ the ./opt files are in sync from the host to the VM. $ vagrant destroy vfc +.. end + +Testing +------- + +Use the run.sh script to test if the provisioning scripts run without errors. + +And example test to check the number of covered repositories with this tool. + +.. code-block:: console + + $ ./tools/run.sh testing -y -c coverity_repos -s functions + .. end
\ No newline at end of file diff --git a/bootstrap/vagrant-onap/etc/settings.yaml.development b/bootstrap/vagrant-onap/etc/settings.yaml.development index 594273b0d..7e1a1ec0b 100644 --- a/bootstrap/vagrant-onap/etc/settings.yaml.development +++ b/bootstrap/vagrant-onap/etc/settings.yaml.development @@ -1,4 +1,4 @@ -build_images: "True" +build_image: "True" clone_repo: "True" compile_repo: "False" enable_oparent: "True" diff --git a/bootstrap/vagrant-onap/etc/settings.yaml.testing b/bootstrap/vagrant-onap/etc/settings.yaml.testing index 8beb4767d..0a81e2d0c 100644 --- a/bootstrap/vagrant-onap/etc/settings.yaml.testing +++ b/bootstrap/vagrant-onap/etc/settings.yaml.testing @@ -1,4 +1,4 @@ -build_images: "False" +build_image: "False" clone_repo: "False" compile_repo: "False" enable_oparent: "False" diff --git a/bootstrap/vagrant-onap/lib/_onap_functions b/bootstrap/vagrant-onap/lib/_onap_functions index 18a465948..cedd6f0a3 100755 --- a/bootstrap/vagrant-onap/lib/_onap_functions +++ b/bootstrap/vagrant-onap/lib/_onap_functions @@ -12,7 +12,6 @@ function create_configuration_files { echo $docker_version > /opt/config/docker_version.txt } -# TODO(electrocucaracha): Determine how to use this behind a proxy # docker_openecomp_login() - Login to OpenECOMP Docker Hub function docker_openecomp_login { install_docker @@ -24,7 +23,7 @@ function pull_openecomp_image { local image=$1 local tag=$2 docker_openecomp_login - pull_docker_image $nexus_docker_repo/openecomp/${image}:$docker_version $tag + pull_docker_image $nexus_docker_repo/openecomp/${image}:${docker_version-latest} $tag docker logout } @@ -33,7 +32,7 @@ function pull_onap_image { local image=$1 local tag=$2 docker_openecomp_login - pull_docker_image $nexus_docker_repo/onap/${image}:$docker_version $tag + pull_docker_image $nexus_docker_repo/onap/${image}:${docker_version-latest} $tag docker logout } diff --git a/bootstrap/vagrant-onap/lib/aai b/bootstrap/vagrant-onap/lib/aai index 4da5763ca..538ad2c02 100755 --- a/bootstrap/vagrant-onap/lib/aai +++ b/bootstrap/vagrant-onap/lib/aai @@ -1,15 +1,14 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions hbase_version=1.2.3 aai_src_folder=$git_src_folder/aai -aai_repos=("aai-common" "aai-config" "aai-data" "aai-service" "babel" "champ" \ -"data-router" "esr-gui" "esr-server" "gizmo" "logging-service" "model-loader" \ -"resources" "rest-client" "router-core" "search-data-service" "test-config" \ -"traversal" "sparky-fe" "sparky-be") +aai_repos=("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/test-config" "aai/traversal" "aai/sparky-fe" "aai/sparky-be") # install_hadoop() - Function that installs Hadoop function install_hadoop { @@ -54,20 +53,20 @@ function install_haproxy { # clone_all_aai_repos() - Function that clones AAI source repo. function clone_all_aai_repos { - for dirc in ${aai_repos[@]}; do - clone_repo aai/$dirc $aai_src_folder/$dirc + for repo in ${aai_repos[@]}; do + clone_repo $repo $aai_src_folder${repo#*aai} done } # compile_aai_repos() - Function that compiles AAI source repo. function compile_aai_repos { - local repos=("aai-common" "resources" "logging-service" "traversal") + local repos=("aai/aai-common" "aai/resources" "aai/logging-service" "aai/traversal") if [[ "$compile_repo" == "True" ]]; then repos=("${aai_repos[@]}") fi - for dirc in ${repos[@]}; do - compile_src $aai_src_folder/$dirc + for repo in ${repos[@]}; do + compile_src $aai_src_folder${repo#*aai} done } diff --git a/bootstrap/vagrant-onap/lib/appc b/bootstrap/vagrant-onap/lib/appc index 5e3858f16..181c73f1f 100755 --- a/bootstrap/vagrant-onap/lib/appc +++ b/bootstrap/vagrant-onap/lib/appc @@ -1,22 +1,23 @@ #!/bin/bash -set -o xtrace - source /var/onap/sdnc source /var/onap/functions appc_src_folder=$git_src_folder/appc +appc_repos=("appc" "appc/deployment") # clone_all_appc_repos() - Function that clones APPC source repo. function clone_all_appc_repos { - clone_repo appc $appc_src_folder - clone_repo appc/deployment $appc_src_folder/deployment + for repo in ${appc_repos[@]}; do + clone_repo $repo $appc_src_folder${repo#*appc} + done } # compile_all_appc_repos() - Function that compiles APPC source repo. function compile_all_appc_repos { - compile_src $appc_src_folder - compile_src $appc_src_folder/deployment + for repo in ${appc_repos[@]}; do + compile_src $appc_src_folder${repo#*appc} + done } # _build_appc_images() - Function that creates APPC images from source code. diff --git a/bootstrap/vagrant-onap/lib/ccsdk b/bootstrap/vagrant-onap/lib/ccsdk index 85cdf4da2..3502e01e8 100755 --- a/bootstrap/vagrant-onap/lib/ccsdk +++ b/bootstrap/vagrant-onap/lib/ccsdk @@ -1,27 +1,26 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions ccsdk_src_folder=$git_src_folder/ccsdk -ccsdk_repos=("dashboard" "distribution" "parent" "platform/blueprints" "platform/nbapi" "platform/plugins" "sli" "sli/adaptors" "sli/core" "sli/northbound" "sli/plugins" "storage" "storage/esaas" "storage/pgaas" "utils") +ccsdk_repos=("ccsdk" "ccsdk/dashboard" "ccsdk/distribution" "ccsdk/parent" +"ccsdk/platform/blueprints" "ccsdk/platform/nbapi" "ccsdk/platform/plugins" +"ccsdk/sli" "ccsdk/sli/adaptors" "ccsdk/sli/core" "ccsdk/sli/northbound" +"ccsdk/sli/plugins" "ccsdk/storage" "ccsdk/storage/esaas" "ccsdk/storage/pgaas" +"ccsdk/utils") # clone_ccsdk_repos() - Function that clones the CCSDK repositories function clone_ccsdk_repos { - clone_repo ccsdk $ccsdk_src_folder - - for dirc in ${ccsdk_repos[@]}; do - clone_repo ccsdk/$dirc $ccsdk_src_folder/$dirc + for repo in ${ccsdk_repos[@]}; do + clone_repo $repo $ccsdk_src_folder${repo#ccsdk} done } # compile_ccsdk_repos() - function compile_ccsdk_repos { - compile_src ccsdk $ccsdk_src_folder - - for dirc in ${ccsdk_repos[@]}; do - compile_src $ccsdk_src_folder/$dirc + install_package unzip + for repo in ${ccsdk_repos[@]}; do + compile_src $ccsdk_src_folder${repo#ccsdk} done } diff --git a/bootstrap/vagrant-onap/lib/commons b/bootstrap/vagrant-onap/lib/commons index 26e2cc26a..5d0c69108 100755 --- a/bootstrap/vagrant-onap/lib/commons +++ b/bootstrap/vagrant-onap/lib/commons @@ -1,26 +1,27 @@ #!/bin/bash -set -o xtrace - # update_repos() - Function that updates linux repositories function update_repos { + echo "Updating repositories list..." if [ -f /var/onap/files/sources.list ]; then cp /var/onap/files/sources.list /etc/apt/sources.list fi - if [ -f /var/onap/files/proxyrc ]; then - source /var/onap/files/proxyrc - cp /var/onap/files/proxyrc /etc/profile.d/proxy.sh - - if [ -f /etc/apt/apt.conf ]; then - echo "Acquire::http::Proxy \"${http_proxy}\";" >> /etc/apt/apt.conf - echo "Acquire::https::Proxy \"${https_proxy}\";" >> /etc/apt/apt.conf - fi - if [ -d /etc/apt/apt.conf.d ] & [ ! -f /etc/apt/apt.conf.d/70proxy.conf ]; then - echo "Acquire::http::Proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/70proxy.conf - echo "Acquire::https::Proxy \"${https_proxy}\";" >> /etc/apt/apt.conf.d/70proxy.conf - fi - fi - apt-get update -qq -y + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + zypper -n ref + ;; + ubuntu|debian) + if [[ "$debug" == "False" ]]; then + apt-get update > /dev/null + else + apt-get update + fi + ;; + rhel|centos|fedora) + yum updateinfo + ;; + esac } # is_package_installed() - Function to tell if a package is installed @@ -28,35 +29,88 @@ function is_package_installed { if [[ -z "$@" ]]; then return 1 fi - dpkg -s "$@" > /dev/null 2> /dev/null + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + dpkg -s "$@" > /dev/null + ;; + rhel|centos|fedora) + ;; + esac } # install_packages() - Install a list of packages function install_packages { local package=$@ - update_repos - apt-get install -y -qq $package + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + apt-get install -y -qq $package + ;; + rhel|centos|fedora) + ;; + esac } # install_package() - Install specific package if doesn't exist function install_package { local package=$1 + if ! is_package_installed $package; then - update_repos - apt-get install -y -qq $package + echo "Installing $package..." + + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + zypper install -y $package + ;; + ubuntu|debian) + if [[ "$debug" == "False" ]]; then + apt-get install -y -qq -o=Dpkg::Use-Pty=0 $package + else + apt-get install -y $package + fi + ;; + rhel|centos|fedora) + PKG_MANAGER=$(which dnf || which yum) + ${PKG_MANAGER} -y install $package + ;; + esac fi } # uninstall_packages() - Uninstall a list of packages function uninstall_packages { local packages=$@ - apt-get purge -y -qq $packages + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + apt-get purge -y -qq $packages + ;; + rhel|centos|fedora) + ;; + esac } # uninstall_package() - Uninstall specific package if exists function uninstall_package { local package=$1 if is_package_installed $package; then - apt-get purge -y -qq $package + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + apt-get purge -y -qq $package + ;; + rhel|centos|fedora) + ;; + esac fi } diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae index 3e702d989..7ab32fd24 100755 --- a/bootstrap/vagrant-onap/lib/dcae +++ b/bootstrap/vagrant-onap/lib/dcae @@ -1,12 +1,14 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions dcae_src_folder=$git_src_folder/dcae -dcae_repos=("apod" "apod/analytics" "apod/buildtools" "apod/cdap" "collectors" "collectors/ves" "controller" "controller/analytics" "dcae-inventory" -"demo" "demo/startup" "demo/startup/aaf" "demo/startup/controller" "demo/startup/message-router" "dmaapbc" "operation" "operation/utils" "pgaas" "utils" "utils/buildtools") +dcae_repos=("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") # _create_config_file() - Creates a configuration yaml file for the controller function _create_config_file { @@ -44,7 +46,7 @@ function _build_docker_image { install_docker pushd $src_folder - # TODO(electrocucaracha) Workaround for dmmapbc images + # NOTE: Workaround for dmmapbc images sed -i '/LocalKey/d' Dockerfile local docker_build="docker build -t $name -f ./Dockerfile ." if [ $http_proxy ]; then @@ -59,16 +61,15 @@ function _build_docker_image { # clone_all_dcae_repos() - Function that clones DCAE source repo. function clone_all_dcae_repos { - clone_repo dcae $dcae_src_folder - for dirc in ${dcae_repos[@]}; do - clone_repo dcae/$dirc $dcae_src_folder/$dirc + for repo in ${dcae_repos[@]}; do + clone_repo $repo $dcae_src_folder${repo#*dcae} done } # compile_all_dcae_repos() - Function that compiles DCAE source repo. function compile_all_dcae_repos { - for dirc in ${dcae_repos[@]}; do - compile_src $dcae_src_folder/$dirc + for repo in ${dcae_repos[@]}; do + compile_src $dcae_src_folder${repo#*dcae} done } diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions index 8fff0c2c4..25fbba3e9 100755 --- a/bootstrap/vagrant-onap/lib/functions +++ b/bootstrap/vagrant-onap/lib/functions @@ -1,13 +1,12 @@ #!/bin/bash -set -o xtrace - source /var/onap/commons source /var/onap/_composed_functions source /var/onap/_onap_functions export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' |sort -n | head -1) -export IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) +export NIC=$(ip route get 8.8.8.8 | awk '{ print $5; exit }') +export IP_ADDRESS=$(ifconfig $NIC | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) mvn_conf_file=/root/.m2/settings.xml git_src_folder=/opt @@ -18,6 +17,14 @@ function configure_dns { resolvconf -u } +# get_next_ip() - Function that provides the next ip +function get_next_ip { + local ip=${1:-$IP_ADDRESS} + ip_hex=$(printf '%.2X%.2X%.2X%.2X\n' `echo $ip | sed -e 's/\./ /g'`) + next_ip_hex=$(printf %.8X `echo $(( 0x$ip_hex + 1 ))`) + echo $(printf '%d.%d.%d.%d\n' `echo $next_ip_hex | sed -r 's/(..)/0x\1 /g'`) +} + # _git_timed() - git can sometimes get itself infinitely stuck with transient network # errors or other issues with the remote end. This wraps git in a # timeout/retry loop and is intended to watch over non-local git @@ -44,11 +51,15 @@ function _git_timed { # clone_repo() - Clone Git repository into specific folder function clone_repo { - local repo_url=https://git.onap.org/ + local repo_url=${3:-"https://git.onap.org/"} local repo=$1 local dest_folder=${2:-$git_src_folder/$repo} if [ ! -d $dest_folder ]; then - _git_timed clone ${repo_url}${repo} $dest_folder + if [[ "$debug" == "False" ]]; then + _git_timed clone --quiet ${repo_url}${repo} $dest_folder + else + _git_timed clone ${repo_url}${repo} $dest_folder + fi else pushd $dest_folder _git_timed pull @@ -56,11 +67,6 @@ function clone_repo { fi } -# install_dev_tools() - Install basic dependencies -function install_dev_tools { - install_packages apt-transport-https ca-certificates curl -} - # _install_bind() - Install bind utils function _install_bind { install_packages bind9 bind9utils @@ -71,8 +77,18 @@ function install_java { if is_package_installed openjdk-8-jdk; then return fi - install_package software-properties-common - add-apt-repository -y ppa:openjdk-r/ppa + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + install_package software-properties-common + add-apt-repository -y ppa:openjdk-r/ppa + ;; + rhel|centos|fedora) + ;; + esac + update_repos # Remove Java 7 uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless @@ -88,8 +104,18 @@ function install_maven { return fi install_java - install_package software-properties-common - add-apt-repository -y ppa:andrei-pozolotin/maven3 + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + install_package software-properties-common + add-apt-repository -y ppa:andrei-pozolotin/maven3 + ;; + rhel|centos|fedora) + ;; + esac + update_repos install_package maven3 # Remove Java 7 @@ -100,24 +126,31 @@ function install_maven { # _configure_docker_settings() - Configures Docker settings function _configure_docker_settings { + local docker_conf_backup=/tmp/docker.backup + local docker_conf=/etc/default/docker + local chameleonsocks_filename=chameleonsocks.sh + + cp $docker_conf $docker_conf_backup if [ $http_proxy ]; then - echo "export http_proxy=$http_proxy" >> /etc/default/docker + echo "export http_proxy=$http_proxy" >> $docker_conf fi if [ $https_proxy ]; then - echo "export https_proxy=$https_proxy" >> /etc/default/docker + echo "export https_proxy=$https_proxy" >> $docker_conf #If you have a socks proxy, then use that to connect to the nexus repo #via a redsocks container if [ $socks_proxy ]; then - wget https://raw.githubusercontent.com/crops/chameleonsocks/master/chameleonsocks.sh - chmod 755 chameleonsocks.sh + wget https://raw.githubusercontent.com/crops/chameleonsocks/master/$chameleonsocks_filename + chmod 755 $chameleonsocks_filename socks=$(echo $socks_proxy | sed -e "s/^.*\///" | sed -e "s/:.*$//") port=$(echo $socks_proxy | sed -e "s/^.*://") - PROXY=$socks PORT=$port ./chameleonsocks.sh --install + PROXY=$socks PORT=$port ./$chameleonsocks_filename --install + rm $chameleonsocks_filename + cp $docker_conf_backup $docker_conf fi fi + rm $docker_conf_backup - echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock\"" >> /etc/default/docker - usermod -a -G docker vagrant + echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock\"" >> $docker_conf } # install_nodejs() - Download and install NodeJS @@ -140,17 +173,17 @@ function install_python { # _install_pip() - Install Python Package Manager function _install_pip { install_python - if [ ! -f /usr/local/bin/pip ]; then + if ! which pip; then curl -sL https://bootstrap.pypa.io/get-pip.py | python fi } # install_python_package() - Install a python module function install_python_package { - local python_package=$1 + local python_packages=$@ _install_pip - pip install $python_package + pip install $python_packages } # install_docker() - Download and install docker-engine @@ -158,12 +191,22 @@ function install_docker { if is_package_installed docker-ce; then return fi - install_package software-properties-common - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + install_packages software-properties-common linux-image-extra-$(uname -r) linux-image-extra-virtual apt-transport-https ca-certificates curl + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" + ;; + rhel|centos|fedora) + ;; + esac + update_repos + install_package docker-ce _configure_docker_settings service docker restart @@ -217,9 +260,14 @@ function start_ODL { function compile_src { local src_folder=$1 pushd $src_folder + local mvn_build='mvn clean install -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none' + if [[ "$debug" == "False" ]]; then + mvn_build+=" -q" + fi if [ -f pom.xml ]; then install_maven - mvn clean install -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none + echo "Compiling $src_folder folder..." + eval $mvn_build fi popd } diff --git a/bootstrap/vagrant-onap/lib/mr b/bootstrap/vagrant-onap/lib/mr index f221817fa..55096cb4b 100755 --- a/bootstrap/vagrant-onap/lib/mr +++ b/bootstrap/vagrant-onap/lib/mr @@ -1,7 +1,5 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions mr_src_folder=$git_src_folder/dcae/message-router diff --git a/bootstrap/vagrant-onap/lib/mso b/bootstrap/vagrant-onap/lib/mso index 6ff4bbe3e..0f29b33c5 100755 --- a/bootstrap/vagrant-onap/lib/mso +++ b/bootstrap/vagrant-onap/lib/mso @@ -1,27 +1,22 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions src_folder=$git_src_folder/mso -mso_repos=("chef-repo" "docker-config" "libs" "mso-config") +mso_repos=("mso" "mso/chef-repo" "mso/docker-config" "mso/libs" +"mso/mso-config") # clone_all_mso_repos() - Function that clones MSO source repo. function clone_all_mso_repos { - clone_repo mso $src_folder - - for dirc in ${mso_repos[@]}; do - clone_repo mso/$dirc $src_folder/$dirc + for repo in ${mso_repos[@]}; do + clone_repo $repo $src_folder${repo#*mso} done } # compile_all_mso_repos() - Function that compiles MSO source repo. function compile_all_mso_repos { - compile_src $src_folder - - for dirc in ${mso_repos[@]}; do - compile_src $src_folder/$dirc + for repo in ${mso_repos[@]}; do + compile_src $src_folder${repo#*mso} done } diff --git a/bootstrap/vagrant-onap/lib/multicloud b/bootstrap/vagrant-onap/lib/multicloud index 1c781fed2..05195877b 100755 --- a/bootstrap/vagrant-onap/lib/multicloud +++ b/bootstrap/vagrant-onap/lib/multicloud @@ -1,27 +1,23 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions multicloud_src_folder=$git_src_folder/multicloud -multicloud_repos=("azure" "framework" "openstack" "openstack/vmware" "openstack/windriver") +multicloud_repos=("multicloud" "multicloud/framework" "multicloud/openstack" \ +"multicloud/openstack/vmware" "multicloud/openstack/windriver" \ +"multicloud/azure") # clone_multicloud_repos() - Function that clones the Multi Cloud repositories function clone_multicloud_repos { - clone_repo multicloud $multicloud_src_folder - - for dirc in ${multicloud_repos[@]}; do - clone_repo multicloud/$dirc $multicloud_src_folder/$dirc + for repo in ${multicloud_repos[@]}; do + clone_repo $repo $multicloud_src_folder${repo#*multicloud} done } # compile_multicloud_repos() - function compile_multicloud_repos { - compile_src multicloud $multicloud_src_folder - - for dirc in ${multicloud_repos[@]}; do - compile_src $multicloud_src_folder/$dirc + for repo in ${multicloud_repos[@]}; do + compile_src $multicloud_src_folder${repo#*multicloud} done } diff --git a/bootstrap/vagrant-onap/lib/openstack b/bootstrap/vagrant-onap/lib/openstack new file mode 100755 index 000000000..6fe20d94c --- /dev/null +++ b/bootstrap/vagrant-onap/lib/openstack @@ -0,0 +1,53 @@ +#!/bin/bash + +source /var/onap/functions + +# deploy_openstack() - Function that provisions an OpenStack deployment +function deploy_openstack { + local network_id=${1:-"192.168.53.0"} + nic=$(ip route get $network_id | awk '{ print $4; exit }') + ip_address=$(ip route get $network_id | awk '{ print $6; exit }') + internal_vip_address=$(get_next_ip $ip_address) + + install_docker + mkdir -p /etc/systemd/system/docker.service.d + tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF' +[Service] +MountFlags=shared +EOF + install_packages python-dev libffi-dev gcc libssl-dev python-selinux gcc + + install_python_package ansible docker kolla-ansible python-openstackclient + source /etc/os-release || source /usr/lib/os-release + case ${ID,,} in + *suse) + ;; + ubuntu|debian) + service docker restart + + cp -r /usr/local/share/kolla-ansible/etc_examples/kolla /etc/kolla/ + cp /usr/local/share/kolla-ansible/ansible/inventory/* . + sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"ubuntu\"/g" /etc/kolla/globals.yml + ;; + rhel|centos|fedora) + systemctl daemon-reload + systemctl restart docker + + cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/kolla/ + cp /usr/share/kolla-ansible/ansible/inventory/* . + sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"centos\"/g" /etc/kolla/globals.yml + ;; + esac + kolla-genpwd + sed -i "s/#openstack_release: \"\"/openstack_release: \"master\"/g" /etc/kolla/globals.yml + + sed -i "s/#network_interface: \"eth0\"/network_interface: \"$nic\"/g" /etc/kolla/globals.yml + sed -i "s/kolla_internal_vip_address: \"10.10.10.254\"/kolla_internal_vip_address: \"$internal_vip_address\"/g" /etc/kolla/globals.yml + sed -i "s/#api_interface: \"{{ network_interface }}\"/api_interface: \"{{ network_interface }}\"/g" /etc/kolla/globals.yml + echo "$ip_address $(hostname)" >> /etc/hosts + + kolla-ansible pull -i all-in-one + kolla-ansible deploy -i all-in-one + kolla-ansible post-deploy + echo "source /etc/kolla/admin-openrc.sh" >> ${HOME}/.bashrc +} diff --git a/bootstrap/vagrant-onap/lib/policy b/bootstrap/vagrant-onap/lib/policy index f43087b1d..65a65a186 100755 --- a/bootstrap/vagrant-onap/lib/policy +++ b/bootstrap/vagrant-onap/lib/policy @@ -1,23 +1,23 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions policy_src_folder=$git_src_folder/policy -policy_repos=("api" "common" "docker" "drools-applications" "drools-pdp" "engine" "gui" "pap" "pdp") +policy_repos=("policy/api" "policy/common" "policy/docker" \ +"policy/drools-applications" "policy/drools-pdp" "policy/engine" \ +"policy/gui" "policy/pap" "policy/pdp") # clone_all_policy_repos() - Function that clones Policy source repo. function clone_all_policy_repos { - for dirc in ${policy_repos[@]}; do - clone_repo policy/$dirc $policy_src_folder/$dirc + for repo in ${policy_repos[@]}; do + clone_repo $repo $policy_src_folder${repo#*policy} done } # compile_all_policy_repos() - Function that compiles Policy source repo. function compile_all_policy_repos { - for dirc in ${policy_repos[@]}; do - compile_src $policy_src_folder/$dirc + for repo in ${policy_repos[@]}; do + compile_src $policy_src_folder${repo#*policy} done } diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal index 4dc5ef9b8..915ccd59a 100755 --- a/bootstrap/vagrant-onap/lib/portal +++ b/bootstrap/vagrant-onap/lib/portal @@ -1,29 +1,31 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions portal_src_folder=$git_src_folder/portal -portal_repos=("sdk") +portal_repos=("portal" "portal/sdk" "ecompsdkos" "ui/dmaapbc") # clone_all_portal_repos() - Function that clones Portal source repo. function clone_all_portal_repos { - clone_repo portal $portal_src_folder - clone_repo ecompsdkos $portal_src_folder/ecompsdkos - clone_repo "ui/dmaapbc" $portal_src_folder/dmaapbc - - for dirc in ${portal_repos[@]}; do - clone_repo portal/$dirc $portal_src_folder/$dirc + for repo in ${portal_repos[@]}; do + if [[ "$repo" == "ui/dmaapbc" ]];then + prefix="ui" + else + prefix="portal" + fi + clone_repo $repo $portal_src_folder/${repo#*$prefix} done } # compile_all_portal_repos() - Function that compiles Portal source repo. function compile_all_portal_repos { - compile_src $portal_src_folder - - for dirc in ${portal_repos[@]}; do - compile_src $portal_src_folder/$dirc + for repo in ${portal_repos[@]}; do + if [[ "$repo" == "ui/dmaapbc" ]];then + prefix="ui" + else + prefix="portal" + fi + compile_src $portal_src_folder/${repo#*$prefix} done } diff --git a/bootstrap/vagrant-onap/lib/robot b/bootstrap/vagrant-onap/lib/robot index ebcca6e6b..6dcdf90f0 100755 --- a/bootstrap/vagrant-onap/lib/robot +++ b/bootstrap/vagrant-onap/lib/robot @@ -1,7 +1,5 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions robot_src_folder=$git_src_folder/testsuite diff --git a/bootstrap/vagrant-onap/lib/sdc b/bootstrap/vagrant-onap/lib/sdc index 1d21e138b..88d1cc0fd 100755 --- a/bootstrap/vagrant-onap/lib/sdc +++ b/bootstrap/vagrant-onap/lib/sdc @@ -1,11 +1,11 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions sdc_src_folder=$git_src_folder/sdc -sdc_repos=("jtosca" "sdc-distribution-client" "sdc-docker-base" "sdc-titan-cassandra" "sdc-tosca" "sdc-vnfdesign" "sdc-workflow-designer" "sdc_common") +sdc_repos=("sdc" "sdc/jtosca" "sdc/sdc-distribution-client" +"sdc/sdc-docker-base" "sdc/sdc-titan-cassandra" "sdc/sdc-tosca" +"sdc/sdc-vnfdesign" "sdc/sdc-workflow-designer" "sdc/sdc_common") # _mount_external_partition() - Create partition and mount the external volume function _mount_external_partition { @@ -47,19 +47,15 @@ EOL # clone_all_sdc_repos() - Function that clones SDC source repo. function clone_all_sdc_repos { - clone_repo sdc $sdc_src_folder - - for dirc in ${sdc_repos[@]}; do - clone_repo sdc/$dirc $sdc_src_folder/$dirc + for repo in ${sdc_repos[@]}; do + clone_repo $repo $sdc_src_folder${repo#*sdc} done } # compile_all_sdc_repos() - Function that compiles SDC source repo. function compile_all_sdc_repos { - compile_src sdc $sdc_src_folder - - for dirc in ${sdc_repos[@]}; do - compile_src $sdc_src_folder/$dirc + for repo in ${sdc_repos[@]}; do + compile_src $sdc_src_folder${repo#*sdc} done } diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc index 22066fdd4..a69ce18fb 100755 --- a/bootstrap/vagrant-onap/lib/sdnc +++ b/bootstrap/vagrant-onap/lib/sdnc @@ -1,27 +1,26 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions source /var/onap/ccsdk sdnc_src_folder=$git_src_folder/openecomp/sdnc -sdnc_repos=("adaptors" "architecture" "core" "features" "northbound" "oam" "parent" "plugins") +sdnc_repos=("sdnc/adaptors" "sdnc/architecture" "sdnc/core" "sdnc/features" \ +"sdnc/northbound" "sdnc/oam" "sdnc/parent" "sdnc/plugins") # clone_all_sdnc_repos() - Function that clones SDNC source repo. function clone_all_sdnc_repos { - for dirc in ${sdnc_repos[@]}; do - clone_repo sdnc/$dirc $sdnc_src_folder/$dirc + for repo in ${sdnc_repos[@]}; do + clone_repo $repo $sdnc_src_folder${repo#*sdnc} done } # compile_all_sdnc_repos() - Function that compiles SDNC source repo. function compile_all_sdnc_repos { - for dirc in ${sdnc_repos[@]}; do - if [[ "$dirc" == "core" ]]; then + for repo in ${sdnc_repos[@]}; do + if [[ "$repo" == "sdnc/core" ]]; then compile_src $sdnc_src_folder/core/rootpom fi - compile_src $sdnc_src_folder/$dirc + compile_src $sdnc_src_folder${repo#*sdnc} done } @@ -64,7 +63,6 @@ function install_sdnc { # init_sdnc() - Function that initialize SDNC services function init_sdnc { - start_ODL if [[ "$clone_repo" == "True" ]]; then clone_all_sdnc_repos if [[ "$compile_repo" == "True" ]]; then @@ -75,6 +73,7 @@ function init_sdnc { if [[ "$skip_get_images" == "False" ]]; then get_sdnc_images if [[ "$skip_install" == "False" ]]; then + start_ODL install_sdnc fi fi diff --git a/bootstrap/vagrant-onap/lib/vfc b/bootstrap/vagrant-onap/lib/vfc index 5cf0ed13b..a4517ff7c 100755 --- a/bootstrap/vagrant-onap/lib/vfc +++ b/bootstrap/vagrant-onap/lib/vfc @@ -1,21 +1,18 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions vfc_src_folder=$git_src_folder/vfc -vfc_repos=("gvnfm" "gvnfm/vnflcm" "gvnfm/vnfmgr" "gvnfm/vnfres" "nfvo" \ -"nfvo/catalog" "nfvo/driver" "nfvo/driver/ems" "nfvo/driver/sfc" \ -"nfvo/driver/vnfm" "nfvo/driver/vnfm/gvnfm" "nfvo/driver/vnfm/svnfm" \ -"nfvo/lcm" "nfvo/resmanagement" "nfvo/wfengine") +vfc_repos=("vfc/gvnfm" "vfc/gvnfm/vnflcm" "vfc/gvnfm/vnfmgr" \ +"vfc/gvnfm/vnfres" "vfc/nfvo" "vfc/nfvo/catalog" "vfc/nfvo/driver" \ +"vfc/nfvo/driver/ems" "vfc/nfvo/driver/sfc" "vfc/nfvo/driver/vnfm" \ +"vfc/nfvo/driver/vnfm/gvnfm" "vfc/nfvo/driver/vnfm/svnfm" "vfc/nfvo/lcm" \ +"vfc/nfvo/resmanagement" "vfc/nfvo/wfengine") # clone_all_vfc_repos() - Function that clones VF-C source repo. function clone_all_vfc_repos { - clone_repo vfc $vfc_src_folder - - for dirc in ${vfc_repos[@]}; do - clone_repo vfc/$dirc $vfc_src_folder/$dirc + for repo in ${vfc_repos[@]}; do + clone_repo $repo $vfc_src_folder${repo#*vfc} done } diff --git a/bootstrap/vagrant-onap/lib/vid b/bootstrap/vagrant-onap/lib/vid index 83b530995..6fc7f351f 100755 --- a/bootstrap/vagrant-onap/lib/vid +++ b/bootstrap/vagrant-onap/lib/vid @@ -1,21 +1,22 @@ #!/bin/bash -set -o xtrace - source /var/onap/functions vid_src_folder=$git_src_folder/vid +vid_repos=("vid" "vid/asdcclient") # clone_all_vid_repos() - Function that clones VID source code. function clone_all_vid_repos { - clone_repo vid $vid_src_folder - clone_repo vid/asdcclient $vid_src_folder/asdcclient + for repo in ${vid_repos[@]}; do + clone_repo $repo $vid_src_folder${repo#*vid} + done } # compile_all_vid_repos() - Function that compiles VID source repo. function compile_all_vid_repos { - compile_src $vid_src_folder/asdcclient - compile_src $vid_src_folder + for repo in ${vid_repos[@]}; do + compile_src $vid_src_folder${repo#*vid} + done } # _build_vid_images() - Function that builds VID docker images diff --git a/bootstrap/vagrant-onap/lib/vnfsdk b/bootstrap/vagrant-onap/lib/vnfsdk new file mode 100644 index 000000000..863bae0f6 --- /dev/null +++ b/bootstrap/vagrant-onap/lib/vnfsdk @@ -0,0 +1,64 @@ +#!/bin/bash + +source /var/onap/functions + +vnfsdk_src_folder=$git_src_folder/vnfsdk +vnfsdk_repos=("vnfsdk/compliance" "vnfsdk/functest" "vnfsdk/lctest" "vnfsdk/model" "vnfsdk/pkgtools" "vnfsdk/refrepo" "vnfsdk/validation") + +# clone_all_vnfsdk_repos() - Function that clones vnfsdk source repo. +function clone_all_vnfsdk_repos { + for repo in ${vnfsdk_repos[@]}; do + clone_repo $repo $vnfsdk_src_folder${repo#*vnfsdk} + done +} + +# compile_all_vnfsdk_repos - Function that builds vnfsdk source repo +function compile_all_vnfsdk_repos { + for repo in ${vnfsdk_repos[@]}; do + compile_src $vnfsdk_src_folder${repo#*vnfsdk} + done +} + +# _build_vnfsdk_images() - Builds VNFSDK images from source code +function _build_vnfsdk_images { + install_package unzip + pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/docker/docker-refrepo + build_docker_image . + popd +} + +# get_vnfsdk_images - Function that clones vnfsdk Docker images +function get_vnfsdk_images { + if [[ "$build_image" == "True" ]]; then + # TODO(sshank): Has errors building. + _build_vnfsdk_images + else + pull_docker_image refrepo:1.0-STAGING-latest + pull_docker_image refrepo:latest + fi +} + +# install_vnfsdk - Function that installs vnfsdk Docker images +function install_vnfsdk { + install_docker_compose + pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/install + /opt/docker/docker-compose up -d + popd +} + +# init_vnfsdk() - Init VNFSDK services +function init_vnfsdk { + if [[ "$clone_repo" == "True" ]]; then + clone_all_vnfsdk_repos + if [[ "$compile_repo" == "True" ]]; then + compile_all_vnfsdk_repos + fi + fi + + if [[ "$skip_get_images" == "False" ]]; then + get_vnfsdk_images + if [[ "$skip_install" == "False" ]]; then + install_vnfsdk + fi + fi +} diff --git a/bootstrap/vagrant-onap/lib/vvp b/bootstrap/vagrant-onap/lib/vvp new file mode 100644 index 000000000..24264ccc9 --- /dev/null +++ b/bootstrap/vagrant-onap/lib/vvp @@ -0,0 +1,57 @@ +#!/bin/bash + +source /var/onap/functions + +vvp_src_folder=$git_src_folder/vvp +vvp_repos=("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") + +# clone_all_vvp_repos() - Function that clones vvp source repo. +function clone_all_vvp_repos { + for repo in ${vvp_repos[@]}; do + clone_repo $repo $vvp_src_folder${repo#*vvp} + done +} + +# compile_all_vvp_repos - Function that builds vvp source repo +function compile_all_vvp_repos { + for repo in ${vvp_repos[@]}; do + compile_src $vvp_src_folder${repo#*vvp} + done +} + +# _build_vvp_images() - Builds VNFSDK images from source code +function _build_vvp_images { + echo "pass" +} + +# get_vvp_images - Function that clones vvp Docker images +function get_vvp_images { + if [[ "$build_image" == "True" ]]; then + _build_vvp_images + else + pull_docker_image refrepo:1.0-STAGING-latest + pull_docker_image refrepo:latest + fi +} + +# install_vvp - Function that installs vvp Docker images +function install_vvp { + echo "pass" +} + +# init_vvp() - Init VNFSDK services +function init_vvp { + if [[ "$clone_repo" == "True" ]]; then + clone_all_vvp_repos + if [[ "$compile_repo" == "True" ]]; then + compile_all_vvp_repos + fi + fi + + if [[ "$skip_get_images" == "False" ]]; then + get_vvp_images + if [[ "$skip_install" == "False" ]]; then + install_vvp + fi + fi +} diff --git a/bootstrap/vagrant-onap/tests/_test_base b/bootstrap/vagrant-onap/tests/_test_base index 155de98bb..78c7f8bb4 100644 --- a/bootstrap/vagrant-onap/tests/_test_base +++ b/bootstrap/vagrant-onap/tests/_test_base @@ -1,11 +1,13 @@ #!/bin/bash source /var/onap_tests/asserts +source /var/onap/commons # main() - Starting point for Unit Tests function main { local covered_functions=("$@") + update_repos len=${#covered_functions[@]} echo "1..$len" for i in ${!covered_functions[@]}; do @@ -15,6 +17,9 @@ function main { echo "ok $((i+1)) - test_${covered_functions[$i]}" # Teardown process + if ! is_package_installed docker-ce; then + docker images -q | xargs docker rmi -f + fi dpkg --get-selections > installed-software_new sort -o installed-software_new installed-software_new apt-get purge -y -qq $(comm -3 installed-software installed-software_new | awk '{print $1}') diff --git a/bootstrap/vagrant-onap/tests/asserts b/bootstrap/vagrant-onap/tests/asserts index 02c269b4c..52f0bce92 100755 --- a/bootstrap/vagrant-onap/tests/asserts +++ b/bootstrap/vagrant-onap/tests/asserts @@ -1,7 +1,5 @@ #!/bin/bash -set -o xtrace - source /var/onap/commons # asserts_process() - Function that verifies if a specific process is running diff --git a/bootstrap/vagrant-onap/tests/projects.txt b/bootstrap/vagrant-onap/tests/projects.txt new file mode 100644 index 000000000..0aba508c9 --- /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_aai b/bootstrap/vagrant-onap/tests/test_aai index 79d26c83d..10777d678 100644 --- a/bootstrap/vagrant-onap/tests/test_aai +++ b/bootstrap/vagrant-onap/tests/test_aai @@ -8,11 +8,6 @@ covered_functions=( "install_hadoop" "install_haproxy" "clone_all_aai_repos" "compile_aai_repos" "setup_titan" "install_hbase" "install_ajsc_aai" "install_model_loader" ) -# TODO(electrocucaracha): Remove/Modify functions that doesn't support proxy settings -if [ -z $http_proxy ] & [ -z $https_proxy ]; then - covered_functions=(${covered_functions[@]} "install_hbase") -fi - # test_install_hadoop() - Verify that Hadoop is downloaded and started properly function test_install_hadoop { install_hadoop diff --git a/bootstrap/vagrant-onap/tests/test_ccsdk b/bootstrap/vagrant-onap/tests/test_ccsdk index 2d2b87a54..81bdd4877 100644 --- a/bootstrap/vagrant-onap/tests/test_ccsdk +++ b/bootstrap/vagrant-onap/tests/test_ccsdk @@ -27,13 +27,13 @@ function test_clone_ccsdk_repos { } # 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 104cadd12..c6887cd78 100644 --- a/bootstrap/vagrant-onap/tests/test_dcae +++ b/bootstrap/vagrant-onap/tests/test_dcae @@ -28,6 +28,7 @@ function test_clone_all_dcae_repos { 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 17a66313a..a6d225bc6 100644 --- a/bootstrap/vagrant-onap/tests/test_functions +++ b/bootstrap/vagrant-onap/tests/test_functions @@ -4,17 +4,13 @@ source /var/onap_tests/_test_base source /var/onap/functions covered_functions=( -"create_configuration_files" "clone_repo" "install_dev_tools" +"create_configuration_files" "clone_repo" "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" +"start_ODL" "compile_src" "build_docker_image" "docker_openecomp_login" +"pull_openecomp_image" "pull_onap_image" "coverity_repos" ) -# TODO(electrocucaracha): Remove/Modify functions that doesn't support proxy settings -if [ -z $http_proxy ] & [ -z $https_proxy ]; then - covered_functions=(${covered_functions[@]} "docker_openecomp_login" "pull_openecomp_image") -fi - # test_create_configuration_files() - Verify the creation of a configuration files function test_create_configuration_files { create_configuration_files @@ -33,14 +29,22 @@ function test_docker_openecomp_login { docker_openecomp_login } -# test_pull_openecomp_image() - Verify the addition of a OpenECOMP container image +# test_pull_openecomp_image() - Verify the OpenECOMP container image pulling process function test_pull_openecomp_image { - pull_openecomp_image portalapps ep:1610-1 + local image_name=portal-apps + unset docker_version + pull_openecomp_image $image_name - asserts_installed_package docker-ce - asserts_image ep:1610-1 + asserts_image $nexus_docker_repo/openecomp/$image_name +} + +# test_pull_onap_image() - Verify the ONAP cointainer pulling process +function test_pull_onap_image { + local image_name=portal-apps + unset docker_version + pull_onap_image $image_name - docker rmi -f ep:1610-1 + asserts_image $nexus_docker_repo/onap/$image_name } # test_clone_repo() - Verify cloning and pulling source code from repositories @@ -51,15 +55,6 @@ function test_clone_repo { asserts_file_exist $git_src_folder/demo/LICENSE.TXT } -# test_install_dev_tools() - Verify the correct installation of developer tools -function test_install_dev_tools { - install_dev_tools - - asserts_installed_package apt-transport-https - asserts_installed_package ca-certificates - asserts_installed_package curl -} - # test_configure_bind() - Verify the correct installation and configuration of bind function test_configure_bind { configure_bind @@ -117,8 +112,6 @@ function test_pull_docker_image { pull_docker_image $image asserts_image $image - - docker rmi -f $image } # test_install_docker_compose() - Verify the correct installation of Docker Compose tool @@ -161,8 +154,32 @@ function test_build_docker_image { build_docker_image $git_src_folder/ccsdk/distribution/ubuntu docker asserts_image onap/ccsdk-ubuntu-image +} - docker rmi -f 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 diff --git a/bootstrap/vagrant-onap/tests/test_multicloud b/bootstrap/vagrant-onap/tests/test_multicloud index 374272c1c..b0b674894 100644 --- a/bootstrap/vagrant-onap/tests/test_multicloud +++ b/bootstrap/vagrant-onap/tests/test_multicloud @@ -11,9 +11,12 @@ covered_functions=( function test_clone_multicloud_repos { clone_multicloud_repos - asserts_file_exist $multicloud_src_folder/framework/multivimbroker/pom.xml + #asserts_file_exist $multicloud_src_folder/ + asserts_file_exist $multicloud_src_folder/framework/pom.xml asserts_file_exist $multicloud_src_folder/openstack/pom.xml asserts_file_exist $multicloud_src_folder/openstack/vmware/pom.xml + asserts_file_exist $multicloud_src_folder/openstack/windriver/pom.xml + #asserts_file_exist $multicloud_src_folder/azure/ } # test_compile_multicloud_repos() - @@ -22,6 +25,8 @@ function test_compile_multicloud_repos { compile_multicloud_repos asserts_file_exist $multicloud_src_folder/openstack/newton/target/multicloud-openstack-newton-1.0.0-SNAPSHOT.zip + asserts_file_exist $multicloud_src_folder/openstack/ocata/target/multicloud-openstack-ocata-1.0.0-SNAPSHOT.zip + asserts_file_exist $multicloud_src_folder/openstack/windriver/target/multicloud-openstack-windriver-1.0.0-SNAPSHOT.zip } # test_get_multicloud_images() - diff --git a/bootstrap/vagrant-onap/tests/test_policy b/bootstrap/vagrant-onap/tests/test_policy index 0c544cd7d..08231fc7a 100644 --- a/bootstrap/vagrant-onap/tests/test_policy +++ b/bootstrap/vagrant-onap/tests/test_policy @@ -49,8 +49,7 @@ function test_compile_all_policy_repos { done asserts_file_exist $policy_src_folder/drools-applications/controlloop/packages/basex/target/basex-1.1.0-SNAPSHOT.tar.gz asserts_file_exist $policy_src_folder/drools-applications/controlloop/templates/template.demo/target/template.demo-1.1.0-SNAPSHOT.jar - asserts_file_exist $policy_src_folder/drools-applications/controlloop/templates/template.demo.v1.0.0/archetype-cl-legacy/target/archetype-cl-legacy-1.1.0-SNAPSHOT.jar - asserts_file_exist $policy_src_folder/drools-applications/controlloop/templates/template.demo.v1.0.0/template.demo/target/demo-1.1.0-SNAPSHOT.jar + asserts_file_exist $policy_src_folder/drools-applications/controlloop/templates/template.demo/target/template.demo-1.1.0-SNAPSHOT.jar for feature in eelf healthcheck session-persistence; do asserts_file_exist $policy_src_folder/drools-pdp/feature-$feature/target/feature-$feature-1.1.0-SNAPSHOT.jar done diff --git a/bootstrap/vagrant-onap/tests/test_sdnc b/bootstrap/vagrant-onap/tests/test_sdnc index ddc1d9c6b..7b54749dd 100644 --- a/bootstrap/vagrant-onap/tests/test_sdnc +++ b/bootstrap/vagrant-onap/tests/test_sdnc @@ -12,12 +12,12 @@ function test_clone_all_sdnc_repos { clone_all_sdnc_repos asserts_file_exist $sdnc_src_folder/adaptors/pom.xml - # asserts_file_exist $sdnc_src_folder/architecture/pom.xml + asserts_file_exist $sdnc_src_folder/architecture/docs/index.rst asserts_file_exist $sdnc_src_folder/core/pom.xml - # asserts_file_exist $sdnc_src_folder/features/pom.xml + asserts_file_exist $sdnc_src_folder/features/docs/index.rst asserts_file_exist $sdnc_src_folder/northbound/pom.xml asserts_file_exist $sdnc_src_folder/oam/pom.xml - # asserts_file_exist $sdnc_src_folder/parent/pom.xml + asserts_file_exist $sdnc_src_folder/parent/docs/index.rst asserts_file_exist $sdnc_src_folder/plugins/pom.xml } @@ -27,19 +27,12 @@ function test_compile_all_sdnc_repos { compile_all_sdnc_repos for component in generic-resource-api vnfapi vnftools; do - if [[ "$component" != "generic-resource-api" ]]; then - if [[ "$component" == "vnfapi" ]]; then - asserts_file_exist $sdnc_src_folder/northbound/vnfapi/model/target/vnfapi-model-1.2.0-SNAPSHOT.jar - fi - asserts_file_exist $sdnc_src_folder/northbound/$component/installer/target/sdnc-$component-1.2.0-SNAPSHOT-installer.zip - asserts_file_exist $sdnc_src_folder/northbound/$component/features/target/$component-features-1.2.0-SNAPSHOT.jar - asserts_file_exist $sdnc_src_folder/northbound/$component/provider/target/$component-provider-1.2.0-SNAPSHOT.jar - else - asserts_file_exist $sdnc_src_folder/northbound/generic-resource-api/features/target/generic-resource-api.features-1.2.0-SNAPSHOT.jar - asserts_file_exist $sdnc_src_folder/northbound/generic-resource-api/installer/target/sdnc-generic-resources-api-1.2.0-SNAPSHOT-installer.zip - asserts_file_exist $sdnc_src_folder/northbound/generic-resource-api/model/target/generic-resource-api.model-1.2.0-SNAPSHOT.jar - asserts_file_exist $sdnc_src_folder/northbound/generic-resource-api/provider/target/generic-resource-api.provider-1.2.0-SNAPSHOT.jar + if [[ "$component" == "vnfapi" ]]; then + asserts_file_exist $sdnc_src_folder/northbound/vnfapi/model/target/vnfapi-model-1.2.0-SNAPSHOT.jar fi + asserts_file_exist $sdnc_src_folder/northbound/$component/installer/target/sdnc-$component-1.2.0-SNAPSHOT-installer.zip + asserts_file_exist $sdnc_src_folder/northbound/$component/features/target/$component-features-1.2.0-SNAPSHOT.jar + asserts_file_exist $sdnc_src_folder/northbound/$component/provider/target/$component-provider-1.2.0-SNAPSHOT.jar done asserts_file_exist $sdnc_src_folder/oam/admportal/target/admportal.*-SNAPSHOT.zip asserts_file_exist $sdnc_src_folder/oam/dgbuilder/target/dgbuilder.*-SNAPSHOT.zip diff --git a/bootstrap/vagrant-onap/tests/test_vnfsdk b/bootstrap/vagrant-onap/tests/test_vnfsdk new file mode 100644 index 000000000..250a9fcc5 --- /dev/null +++ b/bootstrap/vagrant-onap/tests/test_vnfsdk @@ -0,0 +1,57 @@ +#!/bin/bash + +source /var/onap_tests/_test_base +source /var/onap/vnfsdk + +covered_functions=( +"clone_all_vnfsdk_repos" "compile_all_vnfsdk_repos" "get_vnfsdk_images" "install_vnfsdk" +) + +# test_clone_all_vnfsdk_repos() - Verify the cloning of VNFSDK source repo. +function test_clone_all_vnfsdk_repos { + clone_all_vnfsdk_repos + + asserts_file_exist $vnfsdk_src_folder/compliance/veslibrary/README + asserts_file_exist $vnfsdk_src_folder/functest/pom.xml + asserts_file_exist $vnfsdk_src_folder/lctest/pom.xml + asserts_file_exist $vnfsdk_src_folder/model/docs/index.rst + asserts_file_exist $vnfsdk_src_folder/pkgtools/pom.xml + asserts_file_exist $vnfsdk_src_folder/refrepo/pom.xml + asserts_file_exist $vnfsdk_src_folder/validation/pom.xml +} + +# test_compile_all_vnfsdk_repos () - Verify if VNFSDK source repo compiles correctly. +function test_compile_all_vnfsdk_repos { + clone_all_vnfsdk_repos + compile_all_vnfsdk_repos + + asserts_file_exist $vnfsdk_src_folder/lctest/lifecycle-test/target/lifecycle-test-service-1.0.0-SNAPSHOT.war + asserts_file_exist $vnfsdk_src_folder/pkgtools/target/vnf-sdk-pkgtools-1.0.0-SNAPSHOT.zip + asserts_file_exist $vnfsdk_src_folder/refrepo/vnfmarket-be/vnf-sdk-marketplace/target/ROOT.war + asserts_file_exist $vnfsdk_src_folder/validation/csarvalidation/target/validation-csar-1.0.0-SNAPSHOT.jar +} + +# test_get_vnfsdk_images() - Verify that the VNFSDK images are created or retrieved +function test_get_vnfsdk_images { + clone_all_vnfsdk_repos + get_vnfsdk_images + + asserts_image refrepo:1.0-STAGING-latest + asserts_image refrepo:latest +} + +# test_install_vnfsdk() - Verify that VNFSDK docker images are running. +function test_install_vnfsdk { + clone_all_vnfsdk_repos + get_vnfsdk_images + install_vnfsdk + + asserts_image_running refrepo:1.0-STAGING-latest + asserts_image refrepo:latest +} + +if [ "$1" != '*' ]; then + unset covered_functions + covered_functions=$1 +fi +main "${covered_functions[@]}" diff --git a/bootstrap/vagrant-onap/tests/test_vvp b/bootstrap/vagrant-onap/tests/test_vvp new file mode 100644 index 000000000..f77fdf4d3 --- /dev/null +++ b/bootstrap/vagrant-onap/tests/test_vvp @@ -0,0 +1,55 @@ +#!/bin/bash + +source /var/onap_tests/_test_base +source /var/onap/vvp + +covered_functions=( +"clone_all_vvp_repos" "compile_all_vvp_repos" "get_vvp_images" "install_vvp" +) + +# test_clone_all_vvp_repos() - Verify the cloning of VNFSDK source repo. +function test_clone_all_vvp_repos { + clone_all_vvp_repos + + asserts_file_exist $vvp_src_folder/cms/pom.xml + asserts_file_exist $vvp_src_folder/devkit/LICENSE.TXT + asserts_file_exist $vvp_src_folder/engagementmgr/pom.xml + asserts_file_exist $vvp_src_folder/gitlab/pom.xml + asserts_file_exist $vvp_src_folder/image-scanner/pom.xml + asserts_file_exist $vvp_src_folder/jenkins/pom.xml + asserts_file_exist $vvp_src_folder/portal/pom.xml + asserts_file_exist $vvp_src_folder/postgresql/pom.xml + asserts_file_exist $vvp_src_folder/test-engine/pom.xml + asserts_file_exist $vvp_src_folder/validation-scripts/LICENSE.txt +} + +# test_compile_all_vvp_repos () - Verify if VNFSDK source repo compiles correctly. +function test_compile_all_vvp_repos { + clone_all_vvp_repos + compile_all_vvp_repos + + # asserts_file_exist $vvp_src_folder/ +} + +# test_get_vvp_images() - Verify that the VNFSDK images are created or retrieved +function test_get_vvp_images { + clone_all_vvp_repos + get_vvp_images + + #asserts_image refrepo:latest +} + +# test_install_vvp() - Verify that VNFSDK docker images are running. +function test_install_vvp { + clone_all_vvp_repos + get_vvp_images + install_vvp + + #asserts_image_running refrepo:1.0-STAGING-latest +} + +if [ "$1" != '*' ]; then + unset covered_functions + covered_functions=$1 +fi +main "${covered_functions[@]}" diff --git a/bootstrap/vagrant-onap/tools/Run.ps1 b/bootstrap/vagrant-onap/tools/Run.ps1 index 71e595bd8..7dfc83b37 100644 --- a/bootstrap/vagrant-onap/tools/Run.ps1 +++ b/bootstrap/vagrant-onap/tools/Run.ps1 @@ -31,7 +31,8 @@ https://wiki.onap.org/display/DW/ONAP+on+Vagrant #> Param( - [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "testing")] + [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "testing")] + [Parameter(Mandatory=$True,Position=0)] [ValidateNotNullOrEmpty()] [String] @@ -85,7 +86,7 @@ $env:SKIP_INSTALL=$skip_install switch ($Command) { "all_in_one" { $env:DEPLOY_MODE="all-in-one" } - { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc") -contains $_ } { $env:DEPLOY_MODE="individual" } + { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack") -contains $_ } { $env:DEPLOY_MODE="individual" } "testing" { $env:DEPLOY_MODE="testing" @@ -110,7 +111,7 @@ switch ($Command) } default { - Write-Output $"Usage: $0 {all_in_one|dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|testing}" + Write-Output $"Usage: $0 {all_in_one|dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|multicloud|ccsdk|vnfsdk|vvp|testing}" exit 1 } } diff --git a/bootstrap/vagrant-onap/tools/run.sh b/bootstrap/vagrant-onap/tools/run.sh index 9e03384f7..3c2134f8d 100755 --- a/bootstrap/vagrant-onap/tools/run.sh +++ b/bootstrap/vagrant-onap/tools/run.sh @@ -16,7 +16,7 @@ Optional arguments: Test case to use in testing mode. Commands: all_in_one Deploy in all-in-one mode. - dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|multicloud|ccsdk Deploy chosen service. + dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|vnfsdk|multicloud|ccsdk|vvp|openstack Deploy chosen service. testing Deploy in testing mode. EOF } @@ -65,7 +65,7 @@ case $COMMAND in "all_in_one" ) export DEPLOY_MODE='all-in-one' ;; - "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "multicloud" | "ccsdk" ) + "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "vnfsdk"| "multicloud" | "ccsdk" | "vvp" | "openstack" ) export DEPLOY_MODE='individual' ;; "testing" ) diff --git a/bootstrap/vagrant-onap/tools/update_project_list.sh b/bootstrap/vagrant-onap/tools/update_project_list.sh new file mode 100755 index 000000000..2f0ebb9a3 --- /dev/null +++ b/bootstrap/vagrant-onap/tools/update_project_list.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +ssh $1@gerrit.onap.org -p 29418 gerrit ls-projects > projects.tmp +tail -n +2 projects.tmp > tests/projects.txt +rm projects.tmp diff --git a/bootstrap/vagrant-onap/tox.ini b/bootstrap/vagrant-onap/tox.ini index 674810006..6ab309fdf 100644 --- a/bootstrap/vagrant-onap/tox.ini +++ b/bootstrap/vagrant-onap/tox.ini @@ -12,11 +12,13 @@ install_command = pip install {opts} {packages} deps = {env:BASHATE_INSTALL_PATH:bashate} whitelist_externals = bash -commands = bash -c "find {toxinidir}/{tests,lib,tools} \ - -not \( -type d -path *files* -prune \) \ - -not \( -type f -name .*.swp* -prune \) \ - -not \( -type f -name *.ps1 -prune \) \ - -type f \ +commands = bash -c "find {toxinidir}/{tests,lib,tools} \ + -not \( -type d -path *files* -prune \) \ + -not \( -type f -name .*.swp* -prune \) \ + -not \( -type f -name *.ps1 -prune \) \ + -not \( -type f -name installed-software* -prune \) \ + -not \( -type f -name *projects.txt -prune \) \ + -type f \ # E005 file does not begin with #! or have a .sh prefix # E006 check for lines longer than 79 columns # E042 local declaration hides errors diff --git a/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh index 89a69dd9a..8bf116d1d 100755 --- a/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh +++ b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh @@ -1,11 +1,19 @@ #!/bin/bash -set -o xtrace +if [[ "$debug" == "True" ]]; then + set -o xtrace +fi + +if [[ "$1" == "openstack" ]]; then + source /var/onap/openstack + deploy_openstack + exit +fi source /var/onap/functions +update_repos create_configuration_files -install_dev_tools configure_bind for serv in $@; do diff --git a/bootstrap/vagrant-onap/vagrant_utils/unit_testing.sh b/bootstrap/vagrant-onap/vagrant_utils/unit_testing.sh index a378ad0cd..3a97ad9cf 100755 --- a/bootstrap/vagrant-onap/vagrant_utils/unit_testing.sh +++ b/bootstrap/vagrant-onap/vagrant_utils/unit_testing.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [[ "$debug" == "True" ]]; then + set -o xtrace +fi + set -o errexit TEST_SUITE=${1:-*} |