diff options
Diffstat (limited to 'bootstrap/vagrant-onap')
43 files changed, 1068 insertions, 229 deletions
diff --git a/bootstrap/vagrant-onap/.gitignore b/bootstrap/vagrant-onap/.gitignore index 446d1fb41..873bd8b4d 100644 --- a/bootstrap/vagrant-onap/.gitignore +++ b/bootstrap/vagrant-onap/.gitignore @@ -7,3 +7,6 @@ lib/files/proxyrc 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..7a3641e4f 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,6 +55,8 @@ current options include: | vfc | Virtual Function Controller | | multicloud | Multi Cloud | | ccsdk | Common Controller SDK | +| vnfsdk | VNF SDK | +| vpp | VNF Validation Program | | all_in_one | All ONAP services in a VM | | testing | Unit Test VM | diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile index 800ed992e..d70cf8f8a 100644 --- a/bootstrap/vagrant-onap/Vagrantfile +++ b/bootstrap/vagrant-onap/Vagrantfile @@ -1,46 +1,42 @@ # -*- mode: ruby -*- # vi: set ft=ruby : - configuration = { # Generic parameters used across all ONAP components - 'public_net_id' => '00000000-0000-0000-0000-000000000000', 'key_name' => 'ecomp_key', 'pub_key' => '', 'nexus_repo' => 'https://nexus.onap.org/content/sites/raw', + 'nexus_repo_root' => 'https://nexus.onap.org', + 'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots', 'nexus_docker_repo' => 'nexus3.onap.org:10001', 'nexus_username' => 'docker', 'nexus_password' => 'docker', 'dmaap_topic' => 'AUTO', 'artifacts_version' => '1.0.0', 'docker_version' => '1.0-STAGING-latest', - 'gerrit_branch' => 'master', -# Parameters for DCAE instantiation + # Parameters for DCAE instantiation 'dcae_zone' => 'iad4', 'dcae_state' => 'vi', 'openstack_tenant_id' => '', 'openstack_username' => '', 'openstack_api_key' => '', 'openstack_password' => '', - 'nexus_repo_root' => 'https://nexus.onap.org', - 'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots', - 'gitlab_branch' => 'master', - 'build_image' => 'True', - 'pull_docker_image' => 'True', 'odl_version' => '0.5.3-Boron-SR3', + # Parameters for enabling features + 'build_image' => 'True', 'clone_repo' => 'True', 'compile_repo' => 'False', - 'enable_oparent' => 'True' + 'enable_oparent' => 'True', + 'skip_get_images' => 'False', + 'skip_install' => 'True' } - box = { :virtualbox => 'ubuntu/trusty64', :libvirt => 'sputnik13/trusty64', :openstack => nil } - nodes = [ { :name => "aai", @@ -215,9 +211,18 @@ nodes = [ :groups => ["individual"], :args => ['vid'], }, + { + :name => "vvp", + :ips => ['10.252.0.17', "192.168.50.17"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ['vvp'], + }, ] - run_path = 'vagrant_utils/postinstall.sh' sdc_volume = 'vol1-sdc-data.vdi' @@ -234,17 +239,16 @@ if File.exist?(vd_conf) configuration.update(user_conf) end -#Set network interface +# Set network interface +net_interface = 'vboxnet0' is_windows = Gem.win_platform? if is_windows net_interface = 'VirtualBox Host-Only Ethernet Adapter #2' -else - net_interface = 'vboxnet0' end puts "[INFO] Net interface: #{net_interface}" -#If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default +# If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default requested_machine = ARGV[1] deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual') @@ -254,14 +258,14 @@ if requested_machine != nil end end -#Catch the status of all machines +# Catch the status of all machines if ARGV[0] == 'status' || ARGV[0] == 'destroy' deploy_mode = 'NA' end puts "[INFO] Deploy Mode: #{deploy_mode}" -#In case of all-in-one or testing clean the nodes list +# In case of all-in-one or testing clean the nodes list case deploy_mode when 'all-in-one' nodes.select! do |node| @@ -296,6 +300,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') @@ -309,6 +314,7 @@ Vagrant.configure("2") do |config| raise 'vagrant-libvirt was installed but it requires to execute again' end end + if provider == :openstack config.ssh.username = 'ubuntu' if not Vagrant.has_plugin?('vagrant-openstack-provider') @@ -368,12 +374,21 @@ Vagrant.configure("2") do |config| if !is_windows nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true end + # Set Network - nodeconfig.vm.network :private_network, ip: node[:ips][1] + nodeconfig.vm.network :private_network, + :adapter => 2, + :name => net_interface, + :ip => node[:ips][0] + + nodeconfig.vm.network :private_network, + :adapter => 3, + :ip => node[:ips][1], + :type => :static # Specific settings: - #Set Storage (For SDC or All-in-one) + # Set Storage (For SDC or All-in-one) if node[:name].include?("all-in-one") || node[:name].include?("sdc") nodeconfig.vm.provider "virtualbox" do |v| unless File.exist?(sdc_volume) @@ -386,8 +401,7 @@ Vagrant.configure("2") do |config| v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G' end end - - + if node[:name].include? "testing" nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true test_suite = ENV.fetch('TEST_SUITE', '*') @@ -395,9 +409,11 @@ Vagrant.configure("2") do |config| # Override variables run_path = 'vagrant_utils/unit_testing.sh' node[:args] = [test_suite, test_case] + else + configuration['skip_get_images'] = ENV.fetch('SKIP_GET_IMAGES', configuration['skip_get_images']) + configuration['skip_install'] = ENV.fetch('SKIP_INSTALL', configuration['skip_install']) end - if node[:name].include? "vfc" nodeconfig.vm.provision 'docker' end diff --git a/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst new file mode 100644 index 000000000..713c0e0fd --- /dev/null +++ b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst @@ -0,0 +1,73 @@ +======================= +Modify execution values +======================= + +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. + +Settings configuration file +--------------------------- + +The first mechanism refers to the process to replace default configuration +values through a settings configuration file. This file needs to be placed into +the *./etc* folder and named *settings.yaml*. It must contain the key/pair +configuration values that will be overriden. + +.. note:: + + There are sample files (e. g. settings.yaml.development and + settings.yaml.testing) placed into the *./etc* folder. Their purpose is to + provide a reference of different configurations. + +.. end + +Configuration values: + ++------------------+-------------------+---------------------------------------+ +| Key | Values | Description | ++==================+===================+=======================================+ +| build_image | "True" or "False" | Determines if the Docker image is | +| | | retrieved from public hub or built | +| | | from source code. | ++------------------+-------------------+---------------------------------------+ +| clone_repo | "True" or "False" | Determines if all the source code | +| | | repositories of a given component are | +| | | cloned locally. | ++------------------+-------------------+---------------------------------------+ +| compile_repo | "True" or "False" | Determines if all the source code | +| | | repositories of a given component are | +| | | going to be compiled. | ++------------------+-------------------+---------------------------------------+ +| enable_oparent | "True" or "False" | Determines if the OParent project | +| | | will be used during the maven | +| | | compilation. | ++------------------+-------------------+---------------------------------------+ +| skip_get_images | "True" or "False" | Determines if the process to build or | +| | | retrieve docker images of a given | +| | | component are going to skipped. | ++------------------+-------------------+---------------------------------------+ +| skip_install | "True" or "False" | Determines if the process to start | +| | | the services of a given component | +| | | will be started. | ++------------------+-------------------+---------------------------------------+ + +Parameters +---------- + +The **skip_get_images** and **skip_install** are the only two configuration +values that can be overriden using *-g* and *-i* respectively by the run scripts +(*./tools/run.sh* and *.\\tools\\Run.ps1*). + +.. note:: + + The script parameters take precendence of the configuration file. + +.. end + +.. code-block:: console + + $ ./tools/run.sh sdc -g + +.. end + diff --git a/bootstrap/vagrant-onap/doc/source/features/example_usage.rst b/bootstrap/vagrant-onap/doc/source/features/example_usage.rst new file mode 100644 index 000000000..293c543fa --- /dev/null +++ b/bootstrap/vagrant-onap/doc/source/features/example_usage.rst @@ -0,0 +1,151 @@ +================================================= +Example usage to bring up a developer environment +================================================= + +In the example, we will bring up a single ONAP component using the Vagrant ONAP +tool. + +There are multiple scenarios in which this tool can be made use of by a +developer, they usually fall in the following use cases. + +Use case 1: Use Vagrant ONAP to just clone project related source code +---------------------------------------------------------------------- + +In this use case, the developer needs just the source code of the project to work on. + +Since the Vagrant ONAP project supports building docker containers and compiling +source files, we need to first edit the settings.yaml file to add key value pairs +indicating we need to only clone repo and not build docker image or compile then. +By default, Vagrant ONAP clones repo, but to not run the build process and cloning +docker images, the following are required to be added in the settings file. + +.. code-block:: console + + skip_get_images: "True" + +.. end + +The reason this is done is because as mentioned in the +`configure execution docs. <https://git.onap.org/integration/tree/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst>`, +the default values taken are: + +.. code-block:: console + + 'build_image' => 'True', + 'clone_repo' => 'True', + 'compile_repo' => 'False', + 'enable_oparent' => 'True', + 'skip_get_images' => 'False', + 'skip_install' => 'True' + +.. end + +We override them and skip_get_images is given precedence over build_image. + +Use case 2: Use Vagrant ONAP to clone project related source code and clone Docker Images +----------------------------------------------------------------------------------------- + +In this use case, the developer needs to clone docker images of the project to work on. + +For this case, we will edit the settings.yaml file to add key value pairs indicating we +need to clone repo and clone docker image from Nexus. + +.. code-block:: console + + build_images: "False" + compile_repo: "True" + skip_get_images: "False" + skip_install: "True" + +.. end + +Use case 3: Use Vagrant ONAP to clone project related source code and build Docker Images locally +------------------------------------------------------------------------------------------------- + +In this use case, the developer needs to build docker images of the project to work on. + +For this case, we will edit the settings.yaml file to add key value pairs indicating we need to +clone repo and build docker image locally and not fetch them from Nexus. + +.. code-block:: console + + build_images: "True" + compile_repo: "True" + skip_get_images: "False" + skip_install: "True" + +.. end + +Use case 4: Use Vagrant ONAP to clone project related source code and build Docker Images and start services +------------------------------------------------------------------------------------------------------------ + +In this use case, the developer needs to build docker images of the project he or +she wanted to work on and start the services running inside them. + +For this case, we will edit the settings.yaml file to add key value pairs indicating +we need to clone repo, compile repo, build docker image and run the image. + +.. code-block:: console + + build_images: "True" + compile_repo: "True" + skip_get_images: "False" + skip_install: "False" + +.. end + +Once the required changes to the settings file is added, we can use the run.sh +script in tools directory to setup the development environment. + +Example steps for setting up a development environment for VFC project. +----------------------------------------------------------------------- + +In this example we will be using vagrant ONAP to get all the source code of VFC +project and the developer can point the IDE to the cloned repo in the ./opt directory +and start the development process. + +.. code-block:: console + + $ ./tools/run.sh vfc + +.. end + +At the end of the setup process, all the VFC related source code will be present +in the vagrant-onap/opt/ directory. The developer can point an IDE to this directory +and start contributing. When the changes are done, the developer can SSH into the VM +running VFC and tests can be executed by running Maven for Java and Tox for Python +from the ~/opt/vfc directory. + +.. code-block:: console + + $ vagrant ssh vfc + $ cd ~/opt/vfc/<vfc-subrepo> + $ tox -e py27 + +.. end + +This way the tool helps the developer to clone repos of a particular project, +without having to manually search for repos and setup an environment. + +Also, if something gets messed up in the VM, the developer can tear down the VM +and spin a fresh one without having to lose the changes made to the source code since +the ./opt files are in sync from the host to the VM. + +.. code-block:: console + + $ 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/doc/source/features/features.rst b/bootstrap/vagrant-onap/doc/source/features/features.rst index 949969828..2f88c52e7 100644 --- a/bootstrap/vagrant-onap/doc/source/features/features.rst +++ b/bootstrap/vagrant-onap/doc/source/features/features.rst @@ -9,6 +9,8 @@ Advanced features openstack.rst consuming_scripts.rst + configure_execution.rst + example_usage.rst This chapter explains how to use ONAP on Vagrant Advanced features like different providers. diff --git a/bootstrap/vagrant-onap/etc/settings.yaml.development b/bootstrap/vagrant-onap/etc/settings.yaml.development new file mode 100644 index 000000000..594273b0d --- /dev/null +++ b/bootstrap/vagrant-onap/etc/settings.yaml.development @@ -0,0 +1,6 @@ +build_images: "True" +clone_repo: "True" +compile_repo: "False" +enable_oparent: "True" +skip_get_images: "False" +skip_install: "True" diff --git a/bootstrap/vagrant-onap/etc/settings.yaml.testing b/bootstrap/vagrant-onap/etc/settings.yaml.testing new file mode 100644 index 000000000..8beb4767d --- /dev/null +++ b/bootstrap/vagrant-onap/etc/settings.yaml.testing @@ -0,0 +1,6 @@ +build_images: "False" +clone_repo: "False" +compile_repo: "False" +enable_oparent: "False" +skip_get_images: "False" +skip_install: "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 7d87870a0..d267e020d 100755 --- a/bootstrap/vagrant-onap/lib/aai +++ b/bootstrap/vagrant-onap/lib/aai @@ -6,7 +6,11 @@ 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" "data-router" "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 { @@ -51,20 +55,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 } @@ -199,5 +203,7 @@ function init_aai { install_ajsc_aai _wait_for_sdc - install_model_loader + if [[ "$skip_install" == "False" ]]; then + install_model_loader + fi } diff --git a/bootstrap/vagrant-onap/lib/appc b/bootstrap/vagrant-onap/lib/appc index 33980aeea..4d93f54e5 100755 --- a/bootstrap/vagrant-onap/lib/appc +++ b/bootstrap/vagrant-onap/lib/appc @@ -6,17 +6,20 @@ 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. @@ -52,6 +55,10 @@ function init_appc { fi fi - get_appc_images - install_appc + if [[ "$skip_get_images" == "False" ]]; then + get_appc_images + if [[ "$skip_install" == "False" ]]; then + install_appc + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/ccsdk b/bootstrap/vagrant-onap/lib/ccsdk index 6ea829fb5..03987ea7e 100755 --- a/bootstrap/vagrant-onap/lib/ccsdk +++ b/bootstrap/vagrant-onap/lib/ccsdk @@ -5,23 +5,24 @@ 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 } @@ -44,12 +45,6 @@ function get_ccsdk_images { pull_onap_image ccsdk-$image-image done fi - -} - -# install_ccsdk() - -function install_ccsdk { - echo "pass" } # init_ccsdk() - Function that initialize Multi Cloud services @@ -60,5 +55,4 @@ function init_ccsdk { compile_ccsdk_repos fi fi - install_ccsdk } diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae index 43da9f59b..78ca8de06 100755 --- a/bootstrap/vagrant-onap/lib/dcae +++ b/bootstrap/vagrant-onap/lib/dcae @@ -5,8 +5,12 @@ 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 +48,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 +63,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 } @@ -128,6 +131,10 @@ function init_dcae { fi _create_config_file - get_dcae_images - install_dcae + if [[ "$skip_get_images" == "False" ]]; then + get_dcae_images + if [[ "$skip_install" == "False" ]]; then + install_dcae + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions index 8fff0c2c4..02111fa2c 100755 --- a/bootstrap/vagrant-onap/lib/functions +++ b/bootstrap/vagrant-onap/lib/functions @@ -100,23 +100,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 + echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock\"" >> $docker_conf usermod -a -G docker vagrant } diff --git a/bootstrap/vagrant-onap/lib/mr b/bootstrap/vagrant-onap/lib/mr index a137f73bb..f221817fa 100755 --- a/bootstrap/vagrant-onap/lib/mr +++ b/bootstrap/vagrant-onap/lib/mr @@ -31,6 +31,10 @@ function init_mr { if [[ "$clone_repo" == "True" ]]; then clone_mr_repos fi - get_mr_images - install_message_router + if [[ "$skip_get_images" == "False" ]]; then + get_mr_images + if [[ "$skip_install" == "False" ]]; then + install_message_router + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/mso b/bootstrap/vagrant-onap/lib/mso index 4b209062d..5439d991b 100755 --- a/bootstrap/vagrant-onap/lib/mso +++ b/bootstrap/vagrant-onap/lib/mso @@ -5,28 +5,25 @@ 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 } -# install_mso() - Installation of mso images -function install_mso { +# get_mso_images() - Function that retrieves or create MSO Docker images +function get_mso_images { if [[ "$build_image" == "True" ]]; then export GIT_NO_PROJECT=/opt/ compile_src $src_folder @@ -34,8 +31,8 @@ function install_mso { fi } -# install_mso_docker_config() - Download and install MSO Docker configuration project -function install_mso_docker_config { +# install_mso() - Install MSO Docker configuration project +function install_mso { MSO_ENCRYPTION_KEY=$(cat /opt/mso/docker-config/encryption.key) echo -n "$openstack_api_key" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt @@ -108,6 +105,10 @@ function init_mso { fi fi - install_mso - install_mso_docker_config + if [[ "$skip_get_images" == "False" ]]; then + get_mso_images + if [[ "$skip_install" == "False" ]]; then + install_mso + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/multicloud b/bootstrap/vagrant-onap/lib/multicloud index 1126d6146..1c781fed2 100755 --- a/bootstrap/vagrant-onap/lib/multicloud +++ b/bootstrap/vagrant-onap/lib/multicloud @@ -25,6 +25,11 @@ function compile_multicloud_repos { done } +# get_multicloud_images() - +function get_multicloud_images { + echo "pass" +} + # install_multicloud() - function install_multicloud { echo "pass" @@ -38,5 +43,10 @@ function init_multicloud { compile_multicloud_repos fi fi - install_multicloud + if [[ "$skip_get_images" == "False" ]]; then + get_multicloud_images + if [[ "$skip_install" == "False" ]]; then + install_multicloud + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/policy b/bootstrap/vagrant-onap/lib/policy index ce3405614..be4cb2c18 100755 --- a/bootstrap/vagrant-onap/lib/policy +++ b/bootstrap/vagrant-onap/lib/policy @@ -5,19 +5,21 @@ 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 } @@ -65,6 +67,10 @@ function init_policy { fi fi - get_policy_images - install_policy + if [[ "$skip_get_images" == "False" ]]; then + get_policy_images + if [[ "$skip_install" == "False" ]]; then + install_policy + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal index 998d6c075..b5e768b2c 100755 --- a/bootstrap/vagrant-onap/lib/portal +++ b/bootstrap/vagrant-onap/lib/portal @@ -5,25 +5,29 @@ 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 } @@ -67,6 +71,7 @@ function install_portal { install_package unzip unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/ + _install_mariadb install_docker_compose bash portal_vm_init.sh @@ -88,7 +93,11 @@ function init_portal { compile_all_portal_repos fi fi - get_portal_images - _install_mariadb - install_portal + + if [[ "$skip_get_images" == "False" ]]; then + get_portal_images + if [[ "$skip_install" == "False" ]]; then + install_portal + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/robot b/bootstrap/vagrant-onap/lib/robot index 34b431a54..ebcca6e6b 100755 --- a/bootstrap/vagrant-onap/lib/robot +++ b/bootstrap/vagrant-onap/lib/robot @@ -59,6 +59,11 @@ function init_robot { compile_robot_repos fi fi - get_robot_images - install_robot + + if [[ "$skip_get_images" == "False" ]]; then + get_robot_images + if [[ "$skip_install" == "False" ]]; then + install_robot + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/sdc b/bootstrap/vagrant-onap/lib/sdc index 9ec04b21b..a21e2a418 100644..100755 --- a/bootstrap/vagrant-onap/lib/sdc +++ b/bootstrap/vagrant-onap/lib/sdc @@ -5,7 +5,9 @@ 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 { @@ -40,39 +42,32 @@ function _setup_docker_aliases { cat <<EOL > /root/.bash_aliases alias dcls='/data/scripts/docker_clean.sh \$1' alias dlog='/data/scripts/docker_login.sh \$1' -alias rund='/data/scripts/docker_run.sh' +alias drun='/data/scripts/docker_run.sh' alias health='/data/scripts/docker_health.sh' 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 } # get_sdc_images() - Function that retrieves the SDC docker images function get_sdc_images { if [[ "$build_image" == "True" ]]; then - if [[ "$compile_repo" != "True" ]]; then - compile_src $sdc_src_folder - fi build_docker_image $sdc_src_folder/sdc-docker-base else for image in backend frontend elasticsearch kibana cassandra sanity; do - pull_openecomp_image openecomp/sdc-$image + pull_openecomp_image openecomp/sdc-$image done fi } @@ -86,8 +81,12 @@ function install_sdc { cp $sdc_src_folder/sdc-os-chef/environments/Template.json /data/environments cp $sdc_src_folder/sdc-os-chef/scripts/docker_run.sh /data/scripts cp $sdc_src_folder/sdc-os-chef/scripts/docker_health.sh /data/scripts + cp $sdc_src_folder/sdc-os-chef/scripts/docker_login.sh /data/scripts + cp $sdc_src_folder/sdc-os-chef/scripts/docker_clean.sh /data/scripts chmod +x /data/scripts/docker_run.sh chmod +x /data/scripts/docker_health.sh + chmod +x /data/scripts/docker_login.sh + chmod +x /data/scripts/docker_clean.sh cat /data/environments/Template.json | sed "s/yyy/"$IP_ADDRESS"/g" > /data/environments/$ENV_NAME.json sed -i "s/xxx/"$ENV_NAME"/g" /data/environments/$ENV_NAME.json @@ -95,11 +94,10 @@ function install_sdc { sed -i "s/\"fqdn\":.*/\"fqdn\": [\""$MR_IP_ADDR"\", \""$MR_IP_ADDR"\"]/g" /data/environments/$ENV_NAME.json install_docker - if [[ "$pull_docker_image" == "True" ]]; then - docker_openecomp_login - bash /data/scripts/docker_run.sh -e $ENV_NAME -r $docker_version -p $(echo $nexus_docker_repo | cut -d':' -f2) - else + if [[ "$skip_get_images" == "False" ]]; then bash /data/scripts/docker_run.sh -e $ENV_NAME -l + else + bash /data/scripts/docker_run.sh -e $ENV_NAME -r $docker_version -p $(echo $nexus_docker_repo | cut -d':' -f2) fi } @@ -112,7 +110,12 @@ function init_sdc { compile_all_sdc_repos fi fi - get_sdc_images - install_sdc + + if [[ "$skip_get_images" == "False" ]]; then + get_sdc_images + fi + if [[ "$skip_install" == "False" ]]; then + install_sdc + fi _setup_docker_aliases } diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc index c6d013b79..5faca942e 100755 --- a/bootstrap/vagrant-onap/lib/sdnc +++ b/bootstrap/vagrant-onap/lib/sdnc @@ -6,22 +6,23 @@ 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,13 +65,18 @@ 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 compile_all_sdnc_repos fi fi - get_sdnc_images - install_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 a87944879..fc26af282 100755 --- a/bootstrap/vagrant-onap/lib/vfc +++ b/bootstrap/vagrant-onap/lib/vfc @@ -5,17 +5,16 @@ 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 } @@ -106,6 +105,10 @@ function init_vfc { fi fi - get_vfc_images - install_vfc + if [[ "$skip_get_images" == "False" ]]; then + get_vfc_images + if [[ "$skip_install" == "False" ]]; then + install_vfc + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/vid b/bootstrap/vagrant-onap/lib/vid index 55f399ab0..f99fd6042 100755 --- a/bootstrap/vagrant-onap/lib/vid +++ b/bootstrap/vagrant-onap/lib/vid @@ -5,17 +5,20 @@ 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 @@ -56,6 +59,10 @@ function init_vid { fi fi - get_vid_images - install_vid + if [[ "$skip_get_images" == "False" ]]; then + get_vid_images + if [[ "$skip_install" == "False" ]]; then + install_vid + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/vnfsdk b/bootstrap/vagrant-onap/lib/vnfsdk new file mode 100644 index 000000000..c23ed8581 --- /dev/null +++ b/bootstrap/vagrant-onap/lib/vnfsdk @@ -0,0 +1,66 @@ +#!/bin/bash + +set -o xtrace + +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..588f32b87 --- /dev/null +++ b/bootstrap/vagrant-onap/lib/vvp @@ -0,0 +1,59 @@ +#!/bin/bash + +set -o xtrace + +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..7d0415a44 100644 --- a/bootstrap/vagrant-onap/tests/_test_base +++ b/bootstrap/vagrant-onap/tests/_test_base @@ -15,6 +15,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/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 5ff62c156..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 @@ -39,7 +34,12 @@ function test_clone_all_aai_repos { asserts_file_exist $aai_src_folder/aai-config/cookbooks/aai-resources/runlist-aai-resources.json asserts_file_exist $aai_src_folder/aai-data/environments/solo.json asserts_file_exist $aai_src_folder/aai-service/pom.xml + asserts_file_exist $aai_src_folder/babel/README.md + asserts_file_exist $aai_src_folder/champ/pom.xml asserts_file_exist $aai_src_folder/data-router/pom.xml + asserts_file_exist $aai_src_folder/esr-gui/pom.xml + asserts_file_exist $aai_src_folder/esr-server/pom.xml + asserts_file_exist $aai_src_folder/gizmo/pom.xml asserts_file_exist $aai_src_folder/logging-service/pom.xml asserts_file_exist $aai_src_folder/model-loader/pom.xml asserts_file_exist $aai_src_folder/resources/pom.xml @@ -57,14 +57,13 @@ function test_compile_aai_repos { clone_all_aai_repos compile_aai_repos - asserts_file_exist $aai_src_folder/aai-common/aai-annotations/target/aai-annotations-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/aai-common/aai-auth/target/aai-auth-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/aai-common/aai-core/target/aai-core-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/aai-common/aai-schema/target/aai-schema-1.1.0-SNAPSHOT.jar + for common in annotations auth core schema utils; do + asserts_file_exist $aai_src_folder/aai-common/aai-$common/target/aai-$common-1.1.0-SNAPSHOT.jar + done - asserts_file_exist $aai_src_folder/logging-service/common-logging/target/common-logging-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/logging-service/eelf-logging/target/eelf-logging-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/logging-service/logging-api/target/logging-api-1.1.0-SNAPSHOT.jar + for service in common-logging eelf-logging logging-api; do + asserts_file_exist $aai_src_folder/logging-service/$service/target/$service-1.1.0-SNAPSHOT.jar + done asserts_file_exist $aai_src_folder/resources/aai-resources/target/aai-resources.jar asserts_file_exist $aai_src_folder/traversal/aai-traversal/target/traversal.jar 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..3ab5828cb 100644 --- a/bootstrap/vagrant-onap/tests/test_functions +++ b/bootstrap/vagrant-onap/tests/test_functions @@ -7,14 +7,10 @@ covered_functions=( "create_configuration_files" "clone_repo" "install_dev_tools" "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 +} - docker rmi -f ep:1610-1 +# 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 + + asserts_image $nexus_docker_repo/onap/$image_name } # test_clone_repo() - Verify cloning and pulling source code from repositories @@ -117,8 +121,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 +163,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_mso b/bootstrap/vagrant-onap/tests/test_mso index cb7b014dc..deea7bbf8 100644 --- a/bootstrap/vagrant-onap/tests/test_mso +++ b/bootstrap/vagrant-onap/tests/test_mso @@ -4,7 +4,7 @@ source /var/onap_tests/_test_base source /var/onap/mso covered_functions=( -"clone_all_mso_repos" "compile_all_mso_repos" "install_mso" "install_mso_docker_config" +"clone_all_mso_repos" "compile_all_mso_repos" "get_mso_images" "install_mso" ) # test_clone_all_mso_repos() - Verify the source code retrieve of MSO project @@ -40,8 +40,8 @@ function test_compile_all_mso_repos { asserts_file_exist $src_folder/libs/swift-model/target/swift-model-1.1.0-SNAPSHOT.jar } -# test_install_mso() - Verify the creation of MSO Docker images -function test_install_mso { +# test_get_mso_images() - Verify the creation of MSO Docker images +function test_get_mso_images { clone_all_mso_repos install_mso @@ -50,8 +50,8 @@ function test_install_mso { done } -# test_install_mso_docker_config - Verify the execution of MSO Docker images -function test_install_mso_docker_config { +# test_install_mso - Verify the execution of MSO Docker images +function test_install_mso { clone_all_mso_repos install_mso install_mso_docker_config diff --git a/bootstrap/vagrant-onap/tests/test_multicloud b/bootstrap/vagrant-onap/tests/test_multicloud index 3d60533f7..374272c1c 100644 --- a/bootstrap/vagrant-onap/tests/test_multicloud +++ b/bootstrap/vagrant-onap/tests/test_multicloud @@ -4,7 +4,7 @@ source /var/onap_tests/_test_base source /var/onap/multicloud covered_functions=( -"clone_multicloud_repos" "compile_multicloud_repos" "install_multicloud" +"clone_multicloud_repos" "compile_multicloud_repos" "get_multicloud_images" "install_multicloud" ) # test_clone_multicloud_repos() - Verify that Multi Cloud repositories are cloned properly @@ -24,9 +24,16 @@ function test_compile_multicloud_repos { asserts_file_exist $multicloud_src_folder/openstack/newton/target/multicloud-openstack-newton-1.0.0-SNAPSHOT.zip } +# test_get_multicloud_images() - +function test_get_multicloud_images { + clone_multicloud_repos + get_multicloud_images +} + # test_install_multicloud() - Verify the built and start of Multi Cloud services function test_install_multicloud { clone_multicloud_repos + get_multicloud_images install_multicloud } 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_vfc b/bootstrap/vagrant-onap/tests/test_vfc index 16e517a5e..53d9c0d5e 100644 --- a/bootstrap/vagrant-onap/tests/test_vfc +++ b/bootstrap/vagrant-onap/tests/test_vfc @@ -4,10 +4,7 @@ source /var/onap_tests/_test_base source /var/onap/vfc covered_functions=( -"clone_all_vfc_repos" "compile_all_vfc_repos" "install_vfc" -"get_vfc_images" "run_vfc_images" "build_nfvo_lcm_image" -"build_gvnfm_lcm_image" "build_gvnfm_vnfmgr_image" "build_gvnfm_vnfres_image" -"build_nfvo_lcm_image" "build_nfvo_vnfm_gvnfmadapter_image" +"clone_all_vfc_repos" "compile_all_vfc_repos" "install_vfc" "get_vfc_images" ) # test_clone_all_vfc_repos() - Verify cloning and pulling source code from repositories 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 8e6c94fa7..a74dcb72d 100644 --- a/bootstrap/vagrant-onap/tools/Run.ps1 +++ b/bootstrap/vagrant-onap/tools/Run.ps1 @@ -20,12 +20,18 @@ Test case to use in testing mode. .PARAMETER y Skips warning prompt. +.PARAMETER g +Skips creation or retrieve image process. + +.PARAMETER i +Skips installation service process. + .LINK 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", "testing")] [Parameter(Mandatory=$True,Position=0)] [ValidateNotNullOrEmpty()] [String] @@ -44,7 +50,17 @@ Param( [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")] [AllowNull()] [Switch] - $y = $false + $y = $True +, + [Parameter(Mandatory=$False,HelpMessage="Skips creation or retrieve image process.")] + [AllowNull()] + [Switch] + $skip_get_images = $True +, + [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")] + [AllowNull()] + [Switch] + $skip_install = $True ) if ( -Not "testing".Equals($Command) ) @@ -63,10 +79,13 @@ if ( -Not "testing".Equals($Command) ) } } +$env:SKIP_GET_IMAGES=$skip_get_images +$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") -contains $_ } { $env:DEPLOY_MODE="individual" } "testing" { $env:DEPLOY_MODE="testing" @@ -91,7 +110,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 08eae01e3..eaa49431e 100755 --- a/bootstrap/vagrant-onap/tools/run.sh +++ b/bootstrap/vagrant-onap/tools/run.sh @@ -6,13 +6,17 @@ Usage: run.sh Command [-y] [-?] Optional arguments: -y Skips warning prompt. + -g + Skips creation or retrieve image process. + -i + Skips installation service process. -s <suite> Test suite to use in testing mode. -c <case> 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 Deploy chosen service. testing Deploy in testing mode. EOF } @@ -23,11 +27,17 @@ test_case="*" COMMAND=$1 -while getopts "ys:c:" OPTION "${@:2}"; do +while getopts "ygis:c:" OPTION "${@:2}"; do case "$OPTION" in y) run=true ;; + g) + export SKIP_GET_IMAGES="True" + ;; + i) + export SKIP_INSTALL="True" + ;; s) if [ "$COMMAND" != "testing" ] ; then echo "Test suite should only be specified in testing mode." @@ -55,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" ) 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 |