diff options
29 files changed, 525 insertions, 103 deletions
diff --git a/bootstrap/vagrant-onap/.gitignore b/bootstrap/vagrant-onap/.gitignore index 446d1fb41..3c502a0af 100644 --- a/bootstrap/vagrant-onap/.gitignore +++ b/bootstrap/vagrant-onap/.gitignore @@ -7,3 +7,4 @@ lib/files/proxyrc lib/files/sources.list openrc doc/build/ +etc/settings.yaml diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile index 014f2fda0..c10cb0bc8 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", @@ -217,7 +213,6 @@ nodes = [ }, ] - run_path = 'vagrant_utils/postinstall.sh' sdc_volume = 'vol1-sdc-data.vdi' @@ -234,7 +229,7 @@ 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 @@ -243,7 +238,7 @@ 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') @@ -253,14 +248,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| @@ -368,6 +363,7 @@ 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, :adapter => 2, @@ -381,7 +377,7 @@ Vagrant.configure("2") do |config| # 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) @@ -402,9 +398,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..e2da33681 --- /dev/null +++ b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst @@ -0,0 +1,74 @@ +======================= +Modify execution values +======================= + +In order to provide a flexible plataform 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/features.rst b/bootstrap/vagrant-onap/doc/source/features/features.rst index 949969828..d35c595df 100644 --- a/bootstrap/vagrant-onap/doc/source/features/features.rst +++ b/bootstrap/vagrant-onap/doc/source/features/features.rst @@ -9,6 +9,7 @@ Advanced features openstack.rst consuming_scripts.rst + configure_execution.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/aai b/bootstrap/vagrant-onap/lib/aai index 7d87870a0..bd72ae0f3 100755 --- a/bootstrap/vagrant-onap/lib/aai +++ b/bootstrap/vagrant-onap/lib/aai @@ -199,5 +199,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..5e3858f16 100755 --- a/bootstrap/vagrant-onap/lib/appc +++ b/bootstrap/vagrant-onap/lib/appc @@ -52,6 +52,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..85cdf4da2 100755 --- a/bootstrap/vagrant-onap/lib/ccsdk +++ b/bootstrap/vagrant-onap/lib/ccsdk @@ -44,12 +44,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 +54,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..3e702d989 100755 --- a/bootstrap/vagrant-onap/lib/dcae +++ b/bootstrap/vagrant-onap/lib/dcae @@ -128,6 +128,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/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..6ff4bbe3e 100755 --- a/bootstrap/vagrant-onap/lib/mso +++ b/bootstrap/vagrant-onap/lib/mso @@ -25,8 +25,8 @@ function compile_all_mso_repos { 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 +34,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 +108,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..f43087b1d 100755 --- a/bootstrap/vagrant-onap/lib/policy +++ b/bootstrap/vagrant-onap/lib/policy @@ -65,6 +65,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..4dc5ef9b8 100755 --- a/bootstrap/vagrant-onap/lib/portal +++ b/bootstrap/vagrant-onap/lib/portal @@ -67,6 +67,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 +89,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 058048960..c7f79d64d 100644..100755 --- a/bootstrap/vagrant-onap/lib/sdc +++ b/bootstrap/vagrant-onap/lib/sdc @@ -66,16 +66,11 @@ function compile_all_sdc_repos { # 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 - if [["$pull_docker_image" == True]]; then - for image in backend frontend elasticsearch kibana cassandra sanity; do - pull_openecomp_image openecomp/sdc-$image - done - fi + for image in backend frontend elasticsearch kibana cassandra sanity; do + pull_openecomp_image openecomp/sdc-$image + done fi } @@ -85,28 +80,23 @@ function install_sdc { local MR_IP_ADDR='10.0.11.1' _init_data_folders - 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 - + 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 sed -i "s/\"ueb_url_list\":.*/\"ueb_url_list\": \""$MR_IP_ADDR","$MR_IP_ADDR"\",/g" /data/environments/$ENV_NAME.json 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 - bash /data/scripts/docker_run.sh -e $ENV_NAME -l - fi + bash /data/scripts/docker_run.sh -e $ENV_NAME -l } # init_sdc() - Function that initialize SDC services @@ -118,7 +108,12 @@ function init_sdc { compile_all_sdc_repos fi fi - get_sdc_images - install_sdc + + if [[ "$skip_get_images" == "False" ]]; then + get_sdc_images + if [[ "$skip_install" == "False" ]]; then + install_sdc + fi + fi _setup_docker_aliases } diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc index c6d013b79..22066fdd4 100755 --- a/bootstrap/vagrant-onap/lib/sdnc +++ b/bootstrap/vagrant-onap/lib/sdnc @@ -71,6 +71,11 @@ function init_sdnc { 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 + install_sdnc + fi + fi } diff --git a/bootstrap/vagrant-onap/lib/vfc b/bootstrap/vagrant-onap/lib/vfc index a87944879..5cf0ed13b 100755 --- a/bootstrap/vagrant-onap/lib/vfc +++ b/bootstrap/vagrant-onap/lib/vfc @@ -106,6 +106,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..83b530995 100755 --- a/bootstrap/vagrant-onap/lib/vid +++ b/bootstrap/vagrant-onap/lib/vid @@ -56,6 +56,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/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/tools/Run.ps1 b/bootstrap/vagrant-onap/tools/Run.ps1 index 8e6c94fa7..71e595bd8 100644 --- a/bootstrap/vagrant-onap/tools/Run.ps1 +++ b/bootstrap/vagrant-onap/tools/Run.ps1 @@ -20,6 +20,12 @@ 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 #> @@ -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,6 +79,9 @@ 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" } diff --git a/bootstrap/vagrant-onap/tools/run.sh b/bootstrap/vagrant-onap/tools/run.sh index 08eae01e3..9e03384f7 100755 --- a/bootstrap/vagrant-onap/tools/run.sh +++ b/bootstrap/vagrant-onap/tools/run.sh @@ -6,6 +6,10 @@ 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> @@ -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." diff --git a/test/csit/plans/aai/resources/docker-compose.yml b/test/csit/plans/aai/resources/docker-compose.yml index 923f24dea..09d2a8127 100644 --- a/test/csit/plans/aai/resources/docker-compose.yml +++ b/test/csit/plans/aai/resources/docker-compose.yml @@ -9,6 +9,7 @@ services: - CHEF_BRANCH=master - CHEF_GIT_URL=http://gerrit.onap.org/r/aai - AAI_CORE_VERSION=1.1.0-SNAPSHOT + - LOCAL_USER_ID=${USER_ID} ports: - 8447:8447 logging: @@ -25,6 +26,8 @@ services: - CHEF_BRANCH=master - CHEF_GIT_URL=http://gerrit.onap.org/r/aai - AAI_CORE_VERSION=1.1.0-SNAPSHOT + - LOCAL_USER_ID=${USER_ID} + - DISABLE_UPDATE_QUERY=true ports: - 8446:8446 logging: diff --git a/test/csit/plans/aai/resources/setup.sh b/test/csit/plans/aai/resources/setup.sh index 915536be2..19beb6365 100644 --- a/test/csit/plans/aai/resources/setup.sh +++ b/test/csit/plans/aai/resources/setup.sh @@ -31,7 +31,7 @@ function wait_for_container() { CONTAINER_NAME="$1"; START_TEXT="$2"; - TIMEOUT=240 + TIMEOUT=360 # wait for the real startup AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l) @@ -59,6 +59,7 @@ export HBASE_VERSION="${HBASE_VERSION:-1.2.0}"; docker pull ${HBASE_IMAGE}:${HBASE_VERSION}; +docker pull ${HBASE_IMAGE}:${HBASE_VERSION}; docker pull ${DOCKER_REGISTRY}/openecomp/aai-resources:${DOCKER_IMAGE_VERSION}; docker tag ${DOCKER_REGISTRY}/openecomp/aai-resources:${DOCKER_IMAGE_VERSION} ${DOCKER_REGISTRY}/openecomp/aai-resources:latest; @@ -74,25 +75,36 @@ wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0. wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:8080'; wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:9095'; -# Start the resources microservice -RESOURCES_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai-resources.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); -wait_for_container ${RESOURCES_CONTAINER_NAME} '0.0.0.0:8447'; -docker logs ${CONTAINER_NAME}; - -# Start the traversal microservice -GRAPH_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai-traversal.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | awk '{ print $2; }' | head -1); -wait_for_container ${GRAPH_CONTAINER_NAME} '0.0.0.0:8446'; +USER_EXISTS=$(check_if_user_exists aaiadmin); -# Start the haproxy to route requests between resources and traversal -HAPROXY_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai.api.simpledemo.openecomp.org 2>&1 |grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); +function check_if_user_exists(){ + local user_id=$1; -echo "A&AI Microservices, resources and traversal, are up and running along with HAProxy"; + if [ -z "$user_id" ]; then + echo "Needs to provide at least one argument for check_if_user_exists func"; + exit 1; + fi; -docker exec $GRAPH_CONTAINER_NAME "/opt/app/aai-traversal/scripts/install/updateQueryData.sh" && { - echo "Successfully loaded the widget related data into db"; -} || { - echo "Unable to load widget related data into db"; + id -u ${user_id} > /dev/null 2>&1 && { + echo "1"; + } || { + echo "0"; + } } + +if [ "${USER_EXISTS}" -eq 0 ]; then + export USER_ID=9000; +else + export USER_ID=$(id -u aaiadmin); +fi; + +RESOURCES_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai-resources.api.simpledemo.openecomp.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); +wait_for_container ${RESOURCES_CONTAINER_NAME} '0.0.0.0:8447'; + +docker logs ${RESOURCES_CONTAINER_NAME}; + +${DOCKER_COMPOSE_CMD} up -d aai-traversal.api.simpledemo.openecomp.org aai.api.simpledemo.openecomp.org +echo "A&AI Microservices, resources and traversal, are up and running along with HAProxy"; # Set the host ip for robot from the haproxy ROBOT_VARIABLES="-v HOST_IP:`ip addr show docker0 | head -3 | tail -1 | cut -d' ' -f6 | cut -d'/' -f1`" diff --git a/test/csit/plans/aai/traversal/setup.sh b/test/csit/plans/aai/traversal/setup.sh index 80eace0dd..010b0352e 100644 --- a/test/csit/plans/aai/traversal/setup.sh +++ b/test/csit/plans/aai/traversal/setup.sh @@ -58,6 +58,7 @@ export HBASE_IMAGE="${HBASE_IMAGE:-aaionap/hbase}"; export HBASE_VERSION="${HBASE_VERSION:-1.2.0}"; docker pull ${HBASE_IMAGE}:${HBASE_VERSION}; + docker pull ${DOCKER_REGISTRY}/openecomp/aai-resources:${DOCKER_IMAGE_VERSION}; docker tag ${DOCKER_REGISTRY}/openecomp/aai-resources:${DOCKER_IMAGE_VERSION} ${DOCKER_REGISTRY}/openecomp/aai-resources:latest; diff --git a/test/csit/tests/aai/resources/db_edge_rule/prevent_delete.robot b/test/csit/tests/aai/resources/db_edge_rule/prevent_delete.robot new file mode 100644 index 000000000..beae2da51 --- /dev/null +++ b/test/csit/tests/aai/resources/db_edge_rule/prevent_delete.robot @@ -0,0 +1,131 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${CRKEYVALUE7} cr-integration-test7 +${CRKEYVALUE8} cr-integration-test8 +${TENANTKEYVALUE} tenant-integration-test7 +${VSERVERKEYVALUE} vserver-integration-test7 + +${CRURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/${CRKEYVALUE7}/${CRKEYVALUE8} +${TENANTURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/${CRKEYVALUE7}/${CRKEYVALUE8}/tenants/tenant/${TENANTKEYVALUE} +${VSERVERURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/${CRKEYVALUE7}/${CRKEYVALUE8}/tenants/tenant/${TENANTKEYVALUE}/vservers/vserver/${VSERVERKEYVALUE} +${CRDATA} {"cloud-owner":"${CRKEYVALUE7}","cloud-region-id":"${CRKEYVALUE8}","owner-defined-type":"example-owner-defined-type-98787654321-09","cloud-region-version":"example-cloud-region-version-98765784321-09","identity-url":"example-identity-url-98765437821-09","cloud-zone":"example-cloud-zone-98765784321-09","complex-name":"example-complex-name-98765874321-09"} +${TENANTDATA} {"tenant-id":"${TENANTKEYVALUE}","tenant-name":"example-tenant-name-val-143742","vservers":{"vserver":[{"vserver-id":"${VSERVERKEYVALUE}","vserver-name":"example-vserver-name-val-357201","vserver-name2":"example-vserver-name2-val-672821","prov-status":"example-prov-status-val-137711","vserver-selflink":"example-vserver-selflink-val-58731","in-maint":true,"is-closed-loop-disabled":true}]}} + + +*** Test Cases *** +Run AAI Put cloud-region + [Documentation] Create an cloud-region object + ${resp}= PutWithCert ${CRURL} ${CRDATA} + log ${CRURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Put tenant + [Documentation] Create an tenant object + ${resp}= PutWithCert ${TENANTURL} ${TENANTDATA} + log ${TENANTURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Get tenant to delete + [Documentation] Get tenant object to delete + ${resp} GetWithCert ${TENANTURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${resource_version}= Evaluate $resp.json().get('resource-version') + Set Global Variable ${resource_version} + +Run AAI Delete tenant + [Documentation] Delete the tenant + ${resp}= DeleteWithCert ${TENANTURL}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 400 + +Run AAI Get vserver to delete + [Documentation] Get vserver object to delete + ${resp} GetWithCert ${VSERVERURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${resource_version}= Evaluate $resp.json().get('resource-version') + Set Global Variable ${resource_version} + +Run AAI Delete vserver + [Documentation] Delete the vserver + ${resp}= DeleteWithCert ${VSERVERURL}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +Run AAI Get tenant to delete + [Documentation] Get tenant object to delete + ${resp} GetWithCert ${TENANTURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${resource_version}= Evaluate $resp.json().get('resource-version') + Set Global Variable ${resource_version} + +Run AAI Delete tenant + [Documentation] Delete the tenant + ${resp}= DeleteWithCert ${TENANTURL}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +Run AAI Get cr to delete + [Documentation] Get cr object to delete + ${resp} GetWithCert ${CRURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${resource_version}= Evaluate $resp.json().get('resource-version') + Set Global Variable ${resource_version} + +Run AAI Delete cr + [Documentation] Delete the cr + ${resp}= DeleteWithCert ${CRURL}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +*** Keywords *** +PutWithCert + [Arguments] ${url} ${data} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +PatchWithCert + [Arguments] ${url} ${data} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/merge-patch+json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.patch('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +PostWithCert + [Arguments] ${url} ${data} + ${auth}= Create List AAI AAI + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +GetWithCert + [Arguments] ${url} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.get('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +DeleteWithCert + [Arguments] ${url} + ${auth}= Create List AAI AAI + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.delete('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp}
\ No newline at end of file diff --git a/test/csit/tests/aai/resources/relationship_suite/relationship_using_related_link.robot b/test/csit/tests/aai/resources/relationship_suite/relationship_using_related_link.robot new file mode 100644 index 000000000..5820d4ac6 --- /dev/null +++ b/test/csit/tests/aai/resources/relationship_suite/relationship_using_related_link.robot @@ -0,0 +1,110 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${COMPLEXKEYVALUE} complex-integration-test8 +${L3NETWORKKEYVALUE} l3-network-integration-test8 +${COMPLEXURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE} +${L3NETWORKURL} https://${HOST_IP}:8443/aai/v11/network/l3-networks/l3-network/${L3NETWORKKEYVALUE} +${COMPLEXDATA} {"physical-location-id":"${COMPLEXKEYVALUE}","data-center-code":"example-data-center-code-val-77883","complex-name":"example-complex-name-val-12992","identity-url":"example-identity-url-val-74366","physical-location-type":"example-physical-location-type-val-32854","street1":"example-street1-val-26496","street2":"example-street2-val-6629","city":"example-city-val-30262","state":"example-state-val-9058","postal-code":"example-postal-code-val-44893","country":"example-country-val-98673","region":"example-region-val-10014","latitude":"example-latitude-val-47555","longitude":"example-longitude-val-76903","elevation":"example-elevation-val-63385","lata":"example-lata-val-90935"} +${L3NETWORKDATA} {"network-id":"${L3NETWORKKEYVALUE}","network-name":"example-network-name-val-54688","network-type":"example-network-type-val-57468","network-role":"example-network-role-val-54868","network-technology":"example-network-technology-val-5468","neutron-network-id":"example-neutron-network-id-val-54678","is-bound-to-vpn":"true","service-id":"example-service-id-val-5468","orchestration-status":"example-orchestration-status-val-5468","heat-stack-id":"example-heat-stack-id-val-5468","mso-catalog-key":"example-mso-catalog-key-val-5468","relationship-list":{"relationship":[{"related-to":"complex","related-link":"/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE}"}]}} + +*** Test Cases *** +Run AAI Put complex + [Documentation] Create an complex object + ${resp}= PutWithCert ${COMPLEXURL} ${COMPLEXDATA} + log ${COMPLEXURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Get complex + [Documentation] Get the complex object just created + ${resp} GetWithCert ${COMPLEXURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Put l3-network relationship with complex + [Documentation] Create l3-network relationship with complex + ${resp}= PutWithCert ${L3NETWORKURL} ${L3NETWORKDATA} + log ${L3NETWORKURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Get l3-network + [Documentation] Get the l3-network object just created with relationship with complex + ${resp} GetWithCert ${L3NETWORKURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Get l3-network to delete + [Documentation] Get l3-network object to delete + ${resp} GetWithCert ${L3NETWORKURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${resource_version}= Evaluate $resp.json().get('resource-version') + Set Global Variable ${resource_version} + +Run AAI Delete l3-network + [Documentation] Delete the l3-network just created + ${resp}= DeleteWithCert ${L3NETWORKURL}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +Run AAI Get complex to delete + [Documentation] Get complex object to delete + ${resp} GetWithCert ${COMPLEXURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${resource_version}= Evaluate $resp.json().get('resource-version') + Set Global Variable ${resource_version} + +Run AAI Delete complex + [Documentation] Delete the complex just created + ${resp}= DeleteWithCert ${COMPLEXURL}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +*** Keywords *** +PutWithCert + [Arguments] ${url} ${data} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +PatchWithCert + [Arguments] ${url} ${data} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/merge-patch+json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.patch('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +PostWithCert + [Arguments] ${url} ${data} + ${auth}= Create List AAI AAI + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +GetWithCert + [Arguments] ${url} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.get('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp} + +DeleteWithCert + [Arguments] ${url} + ${auth}= Create List AAI AAI + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== + ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') + ${resp}= Evaluate requests.delete('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests + [return] ${resp}
\ No newline at end of file |