diff options
95 files changed, 2801 insertions, 537 deletions
diff --git a/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml b/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml index cea15b668..9662e83d3 100644 --- a/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml +++ b/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml @@ -243,6 +243,9 @@ - 'modeling_toscaparsers_javatoscachecker': repo: 'modeling/toscaparsers' pom: 'javatoscachecker/pom.xml' + - 'modeling_toscaparsers_nfvparser': + repo: 'modeling/toscaparsers' + pom: 'nfvparser/pom.xml' - 'msb_apigateway': repo: 'msb/apigateway' pom: 'pom.xml' @@ -261,9 +264,9 @@ - 'mso_libs': repo: 'mso/libs' pom: 'pom.xml' - - 'multicloud_framework_multivimbroker': + - 'multicloud_framework': repo: 'multicloud/framework' - pom: 'multivimbroker/pom.xml' + pom: 'pom.xml' - 'multicloud_openstack': repo: 'multicloud/openstack' pom: 'pom.xml' @@ -405,9 +408,9 @@ - 'vfc_nfvo_driver_ems': repo: 'vfc/nfvo/driver/ems' pom: 'pom.xml' - - 'vfc_nfvo_driver_sfc_zte_sfc-driver': + - 'vfc_nfvo_driver_sfc': repo: 'vfc/nfvo/driver/sfc' - pom: 'zte/sfc-driver/pom.xml' + pom: 'pom.xml' - 'vfc_nfvo_driver_vnfm_gvnfm': repo: 'vfc/nfvo/driver/vnfm/gvnfm' pom: 'pom.xml' @@ -447,3 +450,6 @@ - 'vnfsdk_refrepo': repo: 'vnfsdk/refrepo' pom: 'pom.xml' + - 'vnfsdk_validation': + repo: 'vnfsdk/validation' + pom: 'pom.xml' diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile index 8417cc953..adc73ca0d 100644 --- a/bootstrap/vagrant-onap/Vagrantfile +++ b/bootstrap/vagrant-onap/Vagrantfile @@ -1,8 +1,9 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -conf = { -# Generic parameters used across all ONAP components + +configuration = { + # Generic parameters used across all ONAP components 'public_net_id' => '00000000-0000-0000-0000-000000000000', 'key_name' => 'ecomp_key', 'pub_key' => '', @@ -32,379 +33,387 @@ conf = { 'enable_oparent' => 'True' } -Vagrant.require_version ">= 1.8.6" -# Determine the OS for the host computer -module OS - def OS.windows? - (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil - end +box = { + :virtualbox => 'ubuntu/trusty64', + :libvirt => 'sputnik13/trusty64', + :openstack => nil +} - def OS.mac? - (/darwin/ =~ RUBY_PLATFORM) != nil - end - def OS.unix? - !OS.windows? - end +nodes = [ + { + :name => "aai", + :ips => ['10.252.0.6', "192.168.50.6"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["aai"] + }, + { + :name => "all-in-one", + :ips => ['10.252.0.3', "192.168.50.3"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 12 * 1024, + :groups => ["all-in-one"], + :flavor => 'm1.xlarge', + :args => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk'], + }, + { + :name => "appc", + :ips => ['10.252.0.14', "192.168.50.14"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["appc"], + }, + { + :name => "ccsdk", + :ips => ['10.252.0.14', "192.168.50.17"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["ccsdk"], + }, + { + :name => "dcae", + :ips => ['10.252.0.12', "192.168.50.12"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["dcae"], + }, + { + :name => "dns", + :ips => ['10.252.0.3', "192.168.50.3"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 1 * 1024, + :groups => ["individual"], + :flavor => 'm1.small', + :args => [" "] + }, + { + :name => "message-router", + :ips => ['10.252.0.4', "192.168.50.4"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["mr"], + }, + { + :name => "mso", + :ips => ['10.252.0.7', "192.168.50.7"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["mso"], + }, + { + :name => "multicloud", + :ips => ['10.252.0.16', "192.168.50.16"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["multicloud"], + }, + { + :name => "policy", + :ips => ['10.252.0.13', "192.168.50.13"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["policy"], + }, + { + :name => "portal", + :ips => ['10.252.0.11', "192.168.50.11"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["portal"], + }, + { + :name => "robot", + :ips => ['10.252.0.8', "192.168.50.8"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["robot"], + }, + { + :name => "sdc", + :ips => ['10.252.0.5', "192.168.50.5"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 8 * 1024, + :groups => ["individual"], + :args => ["sdc"], + }, + { + :name => "sdnc", + :ips => ['10.252.0.10', "192.168.50.10"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ["sdnc"], + }, + { + :name => "testing", + :ips => ['10.252.0.3', "192.168.50.3"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["testing"], + :flavor => 'm1.small', + :args => [""], + }, + { + :name => "vfc", + :ips => ['10.252.0.15', "192.168.50.15"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ['vfc'], + }, + + { + :name => "vid", + :ips => ['10.252.0.9', "192.168.50.9"], + :macs => [], + :cpus => 2, + :cpu => "50", + :ram => 4 * 1024, + :groups => ["individual"], + :args => ['vid'], + }, +] - def OS.linux? - OS.unix? and not OS.mac? - end -end -if OS.windows? - puts "Vagrant launched from windows. This configuration has not fully tested." -end +run_path = 'vagrant_utils/postinstall.sh' + +sdc_volume='vol1-sdc-data.vdi' + +Vagrant.require_version ">= 1.8.6" # Determine the provider used provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym -puts "Using #{provider} provider" +puts "[INFO] Provider: #{provider} " + vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml') if File.exist?(vd_conf) require 'yaml' user_conf = YAML.load_file(vd_conf) - conf.update(user_conf) + configuration.update(user_conf) end -deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual') -sdc_volume='vol1-sdc-data.vdi' +#Set network interface +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}" -Vagrant.configure("2") do |config| - if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil - if not Vagrant.has_plugin?('vagrant-proxyconf') - system 'vagrant plugin install vagrant-proxyconf' - raise 'vagrant-proxyconf was installed but it requires to execute again' - end - config.proxy.http = ENV['http_proxy'] - config.proxy.https = ENV['https_proxy'] - config.proxy.no_proxy = ENV['no_proxy'] - end - - if Vagrant.has_plugin?('vagrant-vbguest') - puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts' - config.vbguest.auto_update = false - end - - config.vm.box = 'ubuntu/trusty64' - if provider == :libvirt - config.vm.box = 'sputnik13/trusty64' - if not Vagrant.has_plugin?('vagrant-libvirt') - system 'vagrant plugin install vagrant-libvirt' - raise 'vagrant-libvirt was installed but it requires to execute again' - end - end - if provider == :openstack - config.vm.box = nil - config.ssh.username = 'ubuntu' - if not Vagrant.has_plugin?('vagrant-openstack-provider') - system 'vagrant plugin install vagrant-openstack-provider' - raise 'vagrant-openstack-provider was installed but it requires to execute again' - end - end - #config.vm.provision "docker" - config.vm.synced_folder './opt', '/opt/', create: true - config.vm.synced_folder './lib', '/var/onap/', create: true - config.vm.synced_folder '~/.m2', '/root/.m2/', create: true - - config.vm.provider :virtualbox do |v| - v.customize ["modifyvm", :id, "--memory", 4 * 1024] - end - config.vm.provider :libvirt do |v| - v.memory = 4 * 1024 - v.nested = true - end - config.vm.provider :openstack do |v| - - v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '') - v.tenant_name = ENV.fetch('OS_TENANT_NAME', '') - v.username = ENV.fetch('OS_USERNAME', '') - v.password = ENV.fetch('OS_PASSWORD', '') - v.region = ENV.fetch('OS_REGION_NAME', '') - v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '') - v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '') - v.project_name = ENV.fetch('OS_PROJECT_NAME', '') - - v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '') - v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true') - v.image = ENV.fetch('OS_IMAGE', '') - v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')] - v.flavor = 'm1.medium' - v.networks = ENV.fetch('OS_NETWORK', '') - end - - case deploy_mode - - when 'all-in-one' - - config.vm.define :all_in_one do |all_in_one| - all_in_one.vm.hostname = 'all-in-one' - all_in_one.vm.network :private_network, ip: '192.168.50.3' - all_in_one.vm.provider "virtualbox" do |v| - v.customize ["modifyvm", :id, "--memory", 12 * 1024] - unless File.exist?(sdc_volume) - v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024] - end - v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume] - end - all_in_one.vm.provider "libvirt" do |v| - v.memory = 12 * 1024 - v.nested = true - v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G' - end - all_in_one.vm.provider "openstack" do |v| - v.server_name = 'all-in-one' - v.flavor = 'm1.xlarge' - end - all_in_one.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk'] - s.env = conf - end - end - - when 'individual' +#If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default +requested_machine = ARGV[1] - config.vm.define :dns do |dns| - dns.vm.hostname = 'dns' - dns.vm.network :private_network, ip: '192.168.50.3' - dns.vm.provider "virtualbox" do |v| - v.customize ["modifyvm", :id, "--memory", 1 * 1024] - end - dns.vm.provider "libvirt" do |v| - v.memory = 1 * 1024 - v.nested = true - end - dns.vm.provider "openstack" do |v| - v.server_name = 'dns' - v.flavor = 'm1.small' - end - dns.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.env = conf - end +deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual') +if requested_machine != nil + if requested_machine.include?("all-in-one") || requested_machine.include?("testing") + deploy_mode = requested_machine end +end - config.vm.define :mr do |mr| - mr.vm.hostname = 'message-router' - mr.vm.network :private_network, ip: '192.168.50.4' - mr.vm.provider "openstack" do |v| - v.server_name = 'message-router' - end - mr.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['mr'] - s.env = conf - end - end +#Catch the status of all machines +if ARGV[0] == 'status' || ARGV[0] == 'destroy' + deploy_mode = 'NA' +end - config.vm.define :sdc do |sdc| - sdc.vm.hostname = 'sdc' - sdc.vm.network :private_network, ip: '192.168.50.5' - sdc.vm.provider "virtualbox" do |v| - unless File.exist?(sdc_volume) - v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024] - end - v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume] - end - sdc.vm.provider "libvirt" do |v| - v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G' - end - sdc.vm.provider "openstack" do |v| - v.server_name = 'sdc' - end - sdc.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['sdc'] - s.env = conf - end - end +puts "[INFO] Deploy Mode: #{deploy_mode}" - config.vm.define :aai do |aai| - aai.vm.hostname = 'aai' - aai.vm.network :private_network, ip: '192.168.50.6' - aai.vm.provider "openstack" do |v| - v.server_name = 'aai' - end - aai.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['aai'] - s.env = conf - end - end +#In case of all-in-one or testing clean the nodes list +case deploy_mode + when 'all-in-one' + nodes.select! do |node| + if node[:name].include?("all-in-one") + true if node[:name] + end + end - config.vm.define :mso do |mso| - mso.vm.hostname = 'mso' - mso.vm.network :private_network, ip: '192.168.50.7' - mso.vm.provider "openstack" do |v| - v.server_name = 'mso' - end - mso.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['mso'] - s.env = conf - end - end - - config.vm.define :robot do |robot| - robot.vm.hostname = 'robot' - robot.vm.network :private_network, ip: '192.168.50.8' - robot.vm.provider "openstack" do |v| - v.server_name = 'robot' - end - robot.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['robot'] - s.env = conf - end - end + when 'individual' + nodes.select! do |node| + if node[:groups][0].include?("individual") + true if node[:name] + + end + end - config.vm.define :vid do |vid| - vid.vm.hostname = 'vid' - vid.vm.network :private_network, ip: '192.168.50.9' - vid.vm.provider "openstack" do |v| - v.server_name = 'vid' - end - vid.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['vid'] - s.env = conf - end - end + when 'testing' + nodes.select! do |node| + if node[:name].include?("testing") + true if node[:name] + end + end +end - config.vm.define :sdnc do |sdnc| - sdnc.vm.hostname = 'sdnc' - sdnc.vm.network :private_network, ip: '192.168.50.10' - sdnc.vm.provider "openstack" do |v| - v.server_name = 'sdnc' - end - sdnc.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['sdnc'] - s.env = conf - end - end +Vagrant.configure("2") do |config| - config.vm.define :portal do |portal| - portal.vm.hostname = 'portal' - portal.vm.network :private_network, ip: '192.168.50.11' - portal.vm.provider "openstack" do |v| - v.server_name = 'portal' - end - portal.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['portal'] - s.env = conf + # PROXY definitions + if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil + if not Vagrant.has_plugin?('vagrant-proxyconf') + system 'vagrant plugin install vagrant-proxyconf' + raise 'vagrant-proxyconf was installed but it requires to execute again' end + config.proxy.http = ENV['http_proxy'] + config.proxy.https = ENV['https_proxy'] + config.proxy.no_proxy = ENV['no_proxy'] end - config.vm.define :dcae do |dcae| - dcae.vm.hostname = 'dcae' - dcae.vm.network :private_network, ip: '192.168.50.12' - dcae.vm.provider "openstack" do |v| - v.server_name = 'dcae' - end - dcae.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['dcae'] - s.env = conf - end + if Vagrant.has_plugin?('vagrant-vbguest') + puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts' + config.vbguest.auto_update = false end - config.vm.define :policy do |policy| - policy.vm.hostname = 'policy' - policy.vm.network :private_network, ip: '192.168.50.13' - policy.vm.provider "openstack" do |v| - v.server_name = 'policy' - end - policy.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['policy'] - s.env = conf + if provider == :libvirt + if not Vagrant.has_plugin?('vagrant-libvirt') + system 'vagrant plugin install vagrant-libvirt' + raise 'vagrant-libvirt was installed but it requires to execute again' end end - - config.vm.define :appc do |appc| - appc.vm.hostname = 'appc' - appc.vm.network :private_network, ip: '192.168.50.14' - appc.vm.provider "openstack" do |v| - v.server_name = 'appc' - end - appc.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['appc'] - s.env = conf + if provider == :openstack + config.ssh.username = 'ubuntu' + if not Vagrant.has_plugin?('vagrant-openstack-provider') + system 'vagrant plugin install vagrant-openstack-provider' + raise 'vagrant-openstack-provider was installed but it requires to execute again' end end - config.vm.define :vfc do |vfc| - vfc.vm.hostname = 'vfc' - vfc.vm.network :private_network, ip: '192.168.50.15' - vfc.vm.provider "openstack" do |v| - v.server_name = 'vfc' - end - vfc.vm.provision 'docker' - vfc.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['vfc'] - s.env = conf - end - end + nodes.each do |node| + config.vm.define node[:name] do |nodeconfig| + + # Common Settings: + + nodeconfig.vm.provider "virtualbox" do |vbox| + vbox.customize ['modifyvm', :id, '--nictype1', 'virtio'] + vbox.customize ['modifyvm', :id, '--audio', 'none'] + vbox.customize ['modifyvm', :id, '--vram', '1'] + vbox.customize ['modifyvm', :id, "--cpuhotplug", "off"] + vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]] + vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]] + vbox.customize ["modifyvm", :id, "--memory", node[:ram]] + end + + nodeconfig.vm.provider "libvirt" do |lbox| + lbox.memory = node[:ram] + lbox.nested = true + end + + nodeconfig.vm.provider :openstack do |obox| + obox.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '') + obox.tenant_name = ENV.fetch('OS_TENANT_NAME', '') + obox.username = ENV.fetch('OS_USERNAME', '') + obox.password = ENV.fetch('OS_PASSWORD', '') + obox.region = ENV.fetch('OS_REGION_NAME', '') + obox.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '') + obox.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '') + obox.project_name = ENV.fetch('OS_PROJECT_NAME', '') + obox.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '') + obox.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true') + obox.image = ENV.fetch('OS_IMAGE', '') + obox.security_groups = [ENV.fetch('OS_SEC_GROUP', '')] + obox.networks = ENV.fetch('OS_NETWORK', '') + obox.flavor = node[:flavor] + obox.server_name = node[:name] - config.vm.define :multicloud do |multicloud| - multicloud.vm.hostname = 'multicloud' - multicloud.vm.network :private_network, ip: '192.168.50.16' - multicloud.vm.provider "openstack" do |v| - v.server_name = 'multicloud' - end - multicloud.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['multicloud'] - s.env = conf - end - end + end - config.vm.define :ccsdk do |ccsdk| - ccsdk.vm.hostname = 'ccsdk' - ccsdk.vm.network :private_network, ip: '192.168.50.17' - ccsdk.vm.provider "openstack" do |v| - v.server_name = 'ccsdk' - end - ccsdk.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/postinstall.sh' - s.args = ['ccsdk'] - s.env = conf - end - end + # Set Box type + nodeconfig.vm.box = box[provider] + + # Set Node name + nodeconfig.vm.hostname = node[:name] + + # Set Sync Folder + nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true + nodeconfig.vm.synced_folder './opt', '/opt/', create: true + nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true + if !is_windows + nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true + end + # Set Network + nodeconfig.vm.network :private_network, ip: node[:ips][1] + + # Specific settings: + + #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) + v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024] + end + v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume] + end + + nodeconfig.vm.provider "libvirt" do |v| + 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', '*') + test_case = ENV.fetch('TEST_CASE', '*') + # Override variables + run_path = 'vagrant_utils/unit_testing.sh' + node[:args] = [test_suite, test_case] + end - when 'testing' - config.vm.define :testing do |testing| - test_suite = ENV.fetch('TEST_SUITE', '*') - test_case = ENV.fetch('TEST_CASE', '*') + if node[:name].include? "vfc" + nodeconfig.vm.provision 'docker' + end - testing.vm.hostname = 'testing' - testing.vm.network :private_network, ip: '192.168.50.3' - testing.vm.synced_folder './tests', '/var/onap_tests/', create: true - testing.vm.provider "virtualbox" do |v| - v.customize ["modifyvm", :id, "--memory", 4 * 1024] - end - testing.vm.provider "libvirt" do |v| - v.memory = 4 * 1024 - v.nested = true - end - testing.vm.provider "openstack" do |v| - v.server_name = 'testing' - v.flavor = 'm1.small' - end - testing.vm.provision 'shell' do |s| - s.path = 'vagrant_utils/unit_testing.sh' - s.args = [test_suite, test_case] - s.env = conf - end - end + nodeconfig.vm.provision 'shell' do |s| + s.path = run_path + s.args = node[:args] + s.env = configuration + end - end -end + end #nodeconfig + end #node +end #config + diff --git a/bootstrap/vagrant-onap/lib/ccsdk b/bootstrap/vagrant-onap/lib/ccsdk index d115eaa0f..6ea829fb5 100755 --- a/bootstrap/vagrant-onap/lib/ccsdk +++ b/bootstrap/vagrant-onap/lib/ccsdk @@ -28,8 +28,8 @@ function compile_ccsdk_repos { # _build_ccsdk_images() - Build CCSDK Docker images from source code function _build_ccsdk_images { install_package unzip - compile_src $ccsdk_src_folder/distribution clone_repo ccsdk/distribution $ccsdk_src_folder/distribution + compile_src $ccsdk_src_folder/distribution for image in ubuntu opendaylight odlsli dgbuilder-docker; do build_docker_image $ccsdk_src_folder/distribution/$image docker done diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal index 505bdde0c..998d6c075 100755 --- a/bootstrap/vagrant-onap/lib/portal +++ b/bootstrap/vagrant-onap/lib/portal @@ -4,26 +4,26 @@ set -o xtrace source /var/onap/functions -policy_src_folder=$git_src_folder/portal -policy_repos=("sdk") +portal_src_folder=$git_src_folder/portal +portal_repos=("sdk") # clone_all_portal_repos() - Function that clones Portal source repo. function clone_all_portal_repos { - clone_repo portal $policy_src_folder - clone_repo ecompsdkos $policy_src_folder/ecompsdkos - clone_repo "ui/dmaapbc" $policy_src_folder/dmaapbc + clone_repo portal $portal_src_folder + clone_repo ecompsdkos $portal_src_folder/ecompsdkos + clone_repo "ui/dmaapbc" $portal_src_folder/dmaapbc - for dirc in ${policy_repos[@]}; do - clone_repo portal/$dirc $policy_src_folder/$dirc + for dirc in ${portal_repos[@]}; do + clone_repo portal/$dirc $portal_src_folder/$dirc done } # compile_all_portal_repos() - Function that compiles Portal source repo. function compile_all_portal_repos { - compile_src $policy_src_folder + compile_src $portal_src_folder - for dirc in ${policy_repos[@]}; do - compile_src $policy_src_folder/$dirc + for dirc in ${portal_repos[@]}; do + compile_src $portal_src_folder/$dirc done } @@ -31,14 +31,12 @@ function compile_all_portal_repos { function _build_portal_images { install_maven - pushd $policy_src_folder/deliveries + pushd $portal_src_folder/deliveries chmod +x *.sh export MVN=$(which mvn) export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml export SETTINGS_FILE=$HOME/.m2/settings.xml bash build_portalapps_dockers.sh - compile_src $policy_src_folder/ecomp-portal-widget-ms - build_docker_image $policy_src_folder/ecomp-portal-widget-ms popd } @@ -64,7 +62,7 @@ function install_portal { docker rm -f ecompdb_portal docker rm -f 1610-1 - pushd $policy_src_folder/deliveries + pushd $portal_src_folder/deliveries mkdir -p /PROJECT/OpenSource/UbuntuEP/logs install_package unzip unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/ diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc index c7c2745d8..770f6be9f 100755 --- a/bootstrap/vagrant-onap/lib/sdnc +++ b/bootstrap/vagrant-onap/lib/sdnc @@ -3,6 +3,7 @@ set -o xtrace source /var/onap/functions +source /var/onap/ccsdk sdnc_src_folder=$git_src_folder/openecomp/sdnc sdnc_repos=("core" "adaptors" "northbound" "plugins" "oam") @@ -28,6 +29,7 @@ function compile_all_sdnc_repos { function _build_sdnc_images { local folder=$sdnc_src_folder/oam + get_ccsdk_images install_package unzip clone_repo sdnc/oam $folder # The OAM code depends on all the SDNC repos which should be downloaded and compiled first diff --git a/bootstrap/vagrant-onap/lib/vfc b/bootstrap/vagrant-onap/lib/vfc index 2b0634bc6..2d1418258 100755 --- a/bootstrap/vagrant-onap/lib/vfc +++ b/bootstrap/vagrant-onap/lib/vfc @@ -19,22 +19,15 @@ function clone_all_vfc_repos { function compile_all_vfc_repos { install_python_package tox - pushd $src_folder/gvnfm/vnflcm/lcm - tox -e py27 - popd - - - pushd $src_folder/nfvo/lcm - tox -e py27 - popd + tox_repos=("gvnfm/vnflcm/lcm" "gvnfm/vnfmgr/mgr" "gvnfm/vnfres/res" "nfvo/lcm" + "nfvo/driver/vnfm/gvnfm/gvnfmadapter" "nfvo/driver/vnfm/svnfm/zte/vmanager") + for dirc in ${tox_repos[@]}; do + pushd $src_folder/$dirc + tox -e py27 + popd + done - # TODO(sshank): Add compile for other vfc_repos. (Both Java and Python based.) - # Python based: - # gvnfm/vnflcm/lcm - # gvnfm/vnfmgr/mgr - # gvnfm/vnfres/res - # nfvo/driver/vnfm/gvnfm/gvnfmadapter - # nfvo/driver/vnfm/svnfm/zte/vmanager + # TODO(sshank): Add compile for other vfc_repos. (Java based.) # Java based: # nfvo/catalog @@ -46,10 +39,42 @@ function compile_all_vfc_repos { # nfvo/wfengine } +# build_gvnfm_lcm_image() - Build VFC GVNFM VNF LCM docker image +function build_gvnfm_lcm_image { + pushd $src_folder/gvnfm/vnflcm/lcm/docker + sed -i '$ {s/^/#/}' build_image.sh + ./build_image.sh + popd +} + +# build_gvnfm_vnfmgr_image() - Build VFC GVNFM VNF Manager docker image +function build_gvnfm_vnfmgr_image { + pushd $src_folder/gvnfm/vnfmgr/mgr/docker + sed -i '$ {s/^/#/}' build_image.sh + ./build_image.sh + popd +} + +# build_gvnfm_vnfres_image() - Build VFC GVNFM VNF Resource Management docker image +function build_gvnfm_vnfres_image { + pushd $src_folder/gvnfm/vnfres/res/docker + sed -i '$ {s/^/#/}' build_image.sh + ./build_image.sh + popd +} + # build_nfvo_lcm_image() - Build VFC NFVO LCM docker image function build_nfvo_lcm_image { pushd $src_folder/nfvo/lcm/docker - sed -i '$ d' build_image.sh + sed -i '$ {s/^/#/}' build_image.sh + ./build_image.sh + popd +} + +# build_nfvo_vnfm_gvnfmadapter_image() - Build VFC NFVO General VNF Adapter docker image +function build_nfvo_vnfm_gvnfmadapter_image { + pushd $src_folder/nfvo/driver/vnfm/gvnfm/gvnfmadapter/docker + sed -i '$ {s/^/#/}' build_image.sh ./build_image.sh popd } @@ -58,18 +83,37 @@ function build_nfvo_lcm_image { function get_vfc_images { if [[ "$build_image" == "True" ]]; then install_docker + # Separate methods are required since the image build process will change. + build_gvnfm_lcm_image + build_gvnfm_vnfmgr_image + build_gvnfm_vnfres_image build_nfvo_lcm_image - # TODO(sshank): Add other VFC component docker image builds when they are ready. + build_nfvo_vnfm_gvnfmadapter_image + # TODO(sshank): Add other VFC component docker image builds. else - pull_onap_image vfc/nslcm + pull_onap_image vfc/gvnfm/vnflcm/lcm + pull_onap_image vfc/gvnfm/vnfmgr/mgr + pull_onap_image vfc/gvnfm/vnfres/res + pull_onap_image vfc/nfvo/lcm + pull_onap_image vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter fi } # install_vfc() - Download and install vfc service from source code function install_vfc { nslcm_image=`docker images | grep nslcm | grep latest| awk '{print $1 ":" $2}'` - docker run -d --name vfc-nslcm -p 3306:3306 -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image - # TODO(sshank): Run other VFC component docker images when they are ready. + vnflcm_image=`docker images | grep vnflcm | grep latest| awk '{print $1 ":" $2}'` + vnfmgr_image=`docker images | grep vnfmgr | grep latest| awk '{print $1 ":" $2}'` + vnfres_image=`docker images | grep vnfres | grep latest| awk '{print $1 ":" $2}'` + gvnfmdriver_image=`docker images | grep gvnfmdriver | grep latest| awk '{print $1 ":" $2}'` + + docker run -d --name vfc-nslcm -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image + docker run -d --name vfc-vnflcm -p 8801:8801 -e MSB_ADDR=127.0.0.1 $vnflcm_image + docker run -d --name vfc-vnfmgr -p 8803:8803 -e MSB_ADDR=127.0.0.1 $vnfmgr_image + docker run -d --name vfc-vnfres -p 8802:8802 -e MSB_ADDR=127.0.0.1 $vnfres_image + docker run -d --name vfc-gvnfmdriver -p 8484:8484 -e MSB_ADDR=127.0.0.1 $gvnfmdriver_image + + # TODO(sshank): Run other VFC component docker images. } # init_vfc() - Function that initialize VF-C services @@ -78,7 +122,7 @@ function init_vfc { if [[ "$clone_repo" == "True" ]]; then clone_all_vfc_repos - if [[ "$compile_repo" == "False" ]]; then + if [[ "$compile_repo" == "True" ]]; then compile_all_vfc_repos fi fi diff --git a/bootstrap/vagrant-onap/tests/test_aai b/bootstrap/vagrant-onap/tests/test_aai index 0fa82d531..5ff62c156 100644 --- a/bootstrap/vagrant-onap/tests/test_aai +++ b/bootstrap/vagrant-onap/tests/test_aai @@ -4,7 +4,8 @@ source /var/onap_tests/_test_base source /var/onap/aai covered_functions=( -"install_hadoop" "install_haproxy" "clone_all_aai_repos" "compile_aai_repos" "setup_titan" "start_aai_microservices" "install_hbase" "install_ajsc_aai" "install_model_loader" +#"install_hadoop" "install_haproxy" "clone_all_aai_repos" "compile_aai_repos" "setup_titan" "start_aai_microservices" "install_hbase" "install_ajsc_aai" "install_model_loader" +"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 @@ -61,23 +62,11 @@ function test_compile_aai_repos { 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 - asserts_file_exist $aai_src_folder/aai-service/aai-schema/target/aai-schema-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/aai-service/ajsc-aai/target/aai.jar - asserts_file_exist $aai_src_folder/aai-service/annotations/target/annotations-1.1.0-SNAPSHOT.jar - - asserts_file_exist $aai_src_folder/data-router/target/data-router-1.1.0-SNAPSHOT.jar - 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 - asserts_file_exist $aai_src_folder/model-loader/target/model-loader-1.1.0-SNAPSHOT.jar asserts_file_exist $aai_src_folder/resources/aai-resources/target/aai-resources.jar - asserts_file_exist $aai_src_folder/rest-client/target/rest-client-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/router-core/target/router-core-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/search-data-service/target/search-data-service-1.1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/sparky-be/target/sparky-be-1.0-SNAPSHOT.jar - asserts_file_exist $aai_src_folder/sparky-fe/target/sparky-fe-1.0.0-SNAPSHOT.war asserts_file_exist $aai_src_folder/traversal/aai-traversal/target/traversal.jar } diff --git a/bootstrap/vagrant-onap/tests/test_appc b/bootstrap/vagrant-onap/tests/test_appc index 0d46ef47d..2290f16a2 100644 --- a/bootstrap/vagrant-onap/tests/test_appc +++ b/bootstrap/vagrant-onap/tests/test_appc @@ -36,7 +36,7 @@ function test_compile_all_appc_repos { asserts_file_exist $appc_src_folder/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/target/appc-ssh-adapter-sshd-1.1.0-SNAPSHOT.jar asserts_file_exist $appc_src_folder/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/target/appc-ssh-adapter-tests-1.1.0-SNAPSHOT.jar - for component in appc-asdc-listener appc-event-listener appc-oam appc-provider; do + for component in appc-event-listener appc-oam appc-provider; do asserts_file_exist $appc_src_folder/$component/$component-bundle/target/$component-bundle-1.1.0-SNAPSHOT.jar asserts_file_exist $appc_src_folder/$component/$component-features/target/$component-features-1.1.0-SNAPSHOT.jar asserts_file_exist $appc_src_folder/$component/$component-installer/target/$component-1.1.0-SNAPSHOT.zip @@ -45,8 +45,6 @@ function test_compile_all_appc_repos { asserts_file_exist $appc_src_folder/$component/$component-model/target/$component-model-1.1.0-SNAPSHOT.jar done - asserts_file_exist $appc_src_folder/appc-asdc-listener/appc-yang-generator/target/appc-yang-generator-1.1.0-SNAPSHOT.jar - asserts_file_exist $appc_src_folder/appc-common/target/appc-common-1.1.0-SNAPSHOT.jar asserts_file_exist $appc_src_folder/appc-dg/appc-dg-shared/appc-dg-dependency-model/target/appc-dg-dependency-model-1.1.0-SNAPSHOT.jar @@ -85,9 +83,7 @@ function test_install_appc { get_appc_images install_appc - asserts_image_running openecomp/dgbuilder-sdnc-image asserts_image_running openecomp/appc-image - asserts_image_running mysql/mysql-server:5.6 } if [ "$1" != '*' ]; then diff --git a/bootstrap/vagrant-onap/tests/test_functions b/bootstrap/vagrant-onap/tests/test_functions index ea268923b..17a66313a 100644 --- a/bootstrap/vagrant-onap/tests/test_functions +++ b/bootstrap/vagrant-onap/tests/test_functions @@ -102,7 +102,6 @@ function test_install_python { install_python asserts_installed_package python2.7 asserts_installed_package python-dev - asserts_file_exist /usr/local/bin/tox } # test_install_docker() - Verify the correct installation of Docker @@ -158,13 +157,12 @@ function test_compile_src { # test_build_docker_image() - Verify that a docker image is created from source code function test_build_docker_image { - clone_repo portal - compile_src $git_src_folder/portal/ecomp-portal-widget-ms - build_docker_image $git_src_folder/portal/ecomp-portal-widget-ms + clone_repo ccsdk/distribution + build_docker_image $git_src_folder/ccsdk/distribution/ubuntu docker - asserts_image widget-ms + asserts_image onap/ccsdk-ubuntu-image - docker rmi -f widget-ms + docker rmi -f onap/ccsdk-ubuntu-image } if [ "$1" != '*' ]; then diff --git a/bootstrap/vagrant-onap/tests/test_multicloud b/bootstrap/vagrant-onap/tests/test_multicloud index 4767152e9..3d60533f7 100644 --- a/bootstrap/vagrant-onap/tests/test_multicloud +++ b/bootstrap/vagrant-onap/tests/test_multicloud @@ -22,7 +22,6 @@ function test_compile_multicloud_repos { compile_multicloud_repos asserts_file_exist $multicloud_src_folder/openstack/newton/target/multicloud-openstack-newton-1.0.0-SNAPSHOT.zip - asserts_file_exist $multicloud_src_folder/openstack/vmware/vio/target/multivimdriver-vio-1.1.0-SNAPSHOT.zip } # test_install_multicloud() - Verify the built and start of Multi Cloud services diff --git a/bootstrap/vagrant-onap/tests/test_policy b/bootstrap/vagrant-onap/tests/test_policy index d7ed98df6..0c544cd7d 100644 --- a/bootstrap/vagrant-onap/tests/test_policy +++ b/bootstrap/vagrant-onap/tests/test_policy @@ -27,20 +27,20 @@ function test_clone_all_policy_repos { # test_compile_all_policy_repos() - Verify compiling of Policy source code function test_compile_all_policy_repos { -# clone_all_policy_repos -# compile_all_policy_repos + clone_all_policy_repos + compile_all_policy_repos asserts_file_exist $policy_src_folder/common/common-logging/target/ONAP-Logging-1.1.0-SNAPSHOT.jar asserts_file_exist $policy_src_folder/common/integrity-audit/target/integrity-audit-1.1.0-SNAPSHOT.jar asserts_file_exist $policy_src_folder/common/integrity-monitor/target/integrity-monitor-1.1.0-SNAPSHOT.jar asserts_file_exist $policy_src_folder/common/site-manager/target/site-manager-1.1.0-SNAPSHOT.jar - for actor in appc mso test vfc; do + for actor in appc appclcm so test vfc; do asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/actors/actor.$actor/target/actor.$actor-1.1.0-SNAPSHOT.jar done asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/actors/actorServiceProvider/target/actorServiceProvider-1.1.0-SNAPSHOT.jar asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/eventmanager/target/eventmanager-1.1.0-SNAPSHOT.jar asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/guard/target/guard-1.1.0-SNAPSHOT.jar - for module in aai appc events mso rest sdc trafficgenerator vfc; do + for module in aai appc appclcm events rest sdc so trafficgenerator vfc; do asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/model-impl/$module/target/$module-1.1.0-SNAPSHOT.jar done asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/policy-yaml/target/policy-yaml-1.1.0-SNAPSHOT.jar diff --git a/bootstrap/vagrant-onap/tests/test_portal b/bootstrap/vagrant-onap/tests/test_portal index d586b73f5..ebfd21de8 100644 --- a/bootstrap/vagrant-onap/tests/test_portal +++ b/bootstrap/vagrant-onap/tests/test_portal @@ -14,10 +14,10 @@ covered_functions=( function test_clone_all_portal_repos { clone_all_portal_repos - asserts_file_exist $policy_src_folder/pom.xml - asserts_file_exist $policy_src_folder/ecompsdkos/LICENSE.txt - asserts_file_exist $policy_src_folder/dmaapbc/pom.xml - asserts_file_exist $policy_src_folder/sdk/LICENSE.txt + asserts_file_exist $portal_src_folder/pom.xml + asserts_file_exist $portal_src_folder/ecompsdkos/LICENSE.txt + asserts_file_exist $portal_src_folder/dmaapbc/pom.xml + asserts_file_exist $portal_src_folder/sdk/LICENSE.txt } # test_compile_all_portal_repos() - Verify compiling of Portal source code @@ -25,9 +25,9 @@ function test_compile_all_portal_repos { clone_all_portal_repos compile_all_portal_repos - asserts_file_exist $policy_src_folder/ecomp-portal-BE-common/target/ecompportal-be-common.war - asserts_file_exist $policy_src_folder/ecomp-portal-BE-common-test/target/ecomp-portal-BE-common-test.jar - asserts_file_exist $policy_src_folder/ecomp-portal-BE-os/target/ecompportal-be-os.war + asserts_file_exist $portal_src_folder/ecomp-portal-BE-common/target/ecompportal-be-common.war + asserts_file_exist $portal_src_folder/ecomp-portal-BE-common-test/target/ecomp-portal-BE-common-test.jar + asserts_file_exist $portal_src_folder/ecomp-portal-BE-os/target/ecompportal-be-os.war } # test_get_portal_images() - Verify that Portal Docker images are retrieved or built properly diff --git a/bootstrap/vagrant-onap/tests/test_sdnc b/bootstrap/vagrant-onap/tests/test_sdnc index a60145fbf..bc742fad2 100644 --- a/bootstrap/vagrant-onap/tests/test_sdnc +++ b/bootstrap/vagrant-onap/tests/test_sdnc @@ -60,9 +60,9 @@ function test_get_sdnc_images { clone_all_sdnc_repos get_sdnc_images - asserts_image openecomp/sdnc-image - asserts_image openecomp/admportal-sdnc-image - asserts_image openecomp/dgbuilder-sdnc-image + asserts_image onap/sdnc-image + asserts_image onap/admportal-sdnc-image + asserts_image onap/dgbuilder-sdnc-image asserts_image mysql/mysql-server:5.6 } @@ -72,9 +72,9 @@ function test_install_sdnc { get_sdnc_images install_sdnc - asserts_image_running openecomp/dgbuilder-sdnc-image - asserts_image_running openecomp/admportal-sdnc-image - asserts_image_running openecomp/sdnc-image + asserts_image_running onap/ccsdk-dgbuilder-image + asserts_image_running onap/admportal-sdnc-image + asserts_image_running onap/sdnc-image asserts_image_running mysql/mysql-server:5.6 } diff --git a/bootstrap/vagrant-onap/tests/test_vfc b/bootstrap/vagrant-onap/tests/test_vfc index e948ccedb..8392e701f 100644 --- a/bootstrap/vagrant-onap/tests/test_vfc +++ b/bootstrap/vagrant-onap/tests/test_vfc @@ -5,7 +5,9 @@ source /var/onap/vfc covered_functions=( "clone_all_vfc_repos" "compile_all_vfc_repos" "install_vfc" -"build_nfvo_lcm_image" "get_vfc_images" "run_vfc_images" +"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" ) # test_clone_all_vfc_repos() - Verify cloning and pulling source code from repositories @@ -29,17 +31,25 @@ function test_get_vfc_images { get_vfc_images asserts_image nexus3.onap.org:10003/onap/vfc/nslcm + asserts_image nexus3.onap.org:10003/onap/vfc/gvnfmdriver + asserts_image nexus3.onap.org:10003/onap/vfc/vnfres + asserts_image nexus3.onap.org:10003/onap/vfc/vnfmgr + asserts_image nexus3.onap.org:10003/onap/vfc/vnflcm - # TODO(sshank): Add asserts for other VFC component docker image builds when they are ready. + # TODO(sshank): Add asserts for other VFC component docker image builds. } # test_install_vfc() - Verify that the VFC are up and running function test_install_vfc { install_vfc - asserts_image_running vfc-nslcm + asserts_image_running nexus3.onap.org:10003/onap/vfc/nslcm:latest + asserts_image_running nexus3.onap.org:10003/onap/vfc/gvnfmdriver:latest + asserts_image_running nexus3.onap.org:10003/onap/vfc/vnfres:latest + asserts_image_running nexus3.onap.org:10003/onap/vfc/vnfmgr:latest + asserts_image_running nexus3.onap.org:10003/onap/vfc/vnflcm:latest - # TODO(sshank): Add asserts for other running VFC component docker images when they are ready. + # TODO(sshank): Add asserts for other running VFC component docker images. } if [ "$1" != '*' ]; then diff --git a/test/csit/plans/aai/resources/testplan.txt b/test/csit/plans/aai/resources/testplan.txt index 444104f94..79fc6d3d3 100644 --- a/test/csit/plans/aai/resources/testplan.txt +++ b/test/csit/plans/aai/resources/testplan.txt @@ -1,3 +1,5 @@ # Test suites are relative paths under [integration.git]/test/csit/tests/. # Place the suites in run order. -aai/resources/suite1 +aai/resources/api_suite +aai/resources/relationship_suite +aai/resources/error_handling_suite diff --git a/test/csit/plans/holmes-rule-management/sanity-check/setup.sh b/test/csit/plans/holmes-rule-management/sanity-check/setup.sh index cbe107c16..681a9e789 100644 --- a/test/csit/plans/holmes-rule-management/sanity-check/setup.sh +++ b/test/csit/plans/holmes-rule-management/sanity-check/setup.sh @@ -17,7 +17,7 @@ # Place the scripts in run order: # Download and start MySQL -docker pull postgresql:9.5 +docker pull postgres:9.5 docker run --name postgres-holmes -p 5432:5432 -e POSTGRES_USER=holmes -e POSTGRES_PASSWORD=holmespwd -d postgres:9.5 DB_IP=`get-instance-ip.sh postgres-holmes` echo DB_IP=${DB_IP} @@ -26,7 +26,7 @@ echo DB_IP=${DB_IP} docker login -u docker -p docker nexus3.onap.org:10001 # Start MSB -docker run -d -p 8500:8500 --name msb_consul nexus3.onap.org:10001/onap/msb/msb_base +docker run -d -p 8500:8500 --name msb_consul consul CONSUL_IP=`get-instance-ip.sh msb_consul` echo CONSUL_IP=${CONSUL_IP} docker run -d -p 10081:10081 -e CONSUL_IP=$CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery @@ -37,7 +37,7 @@ MSB_IP=`get-instance-ip.sh msb_internal_apigateway` echo MSB_IP=${MSB_IP} # Start rulemgt -source ${SCRIPTS}/holmes/rule-management/startup.sh i-rulemgt ${DB_IP} ${MSB_IP} 80 +source ${SCRIPTS}/holmes/rule-management/startup.sh i-rulemgt ${DB_IP} ${MSB_IP} 1 RULEMGT_IP=`get-instance-ip.sh i-rulemgt` echo RULEMGT_IP=${RULEMGT_IP} @@ -49,7 +49,7 @@ for i in {1..20}; do done # Start engine-d -source ${SCRIPTS}/holmes/engine-management/startup.sh i-engine-d ${DB_IP} ${MSB_IP} 80 +source ${SCRIPTS}/holmes/engine-management/startup.sh i-engine-d ${DB_IP} ${MSB_IP} 1 ENGINE_D_IP=`get-instance-ip.sh i-engine-d` echo ENGINE_D_IP=${ENGINE_D_IP} diff --git a/test/csit/plans/integration/vCPE/setup.sh b/test/csit/plans/integration/vCPE/setup.sh new file mode 100755 index 000000000..1b9cc343d --- /dev/null +++ b/test/csit/plans/integration/vCPE/setup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Place the scripts in run order: + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="" + diff --git a/test/csit/plans/integration/vCPE/teardown.sh b/test/csit/plans/integration/vCPE/teardown.sh new file mode 100755 index 000000000..8beb6e1f9 --- /dev/null +++ b/test/csit/plans/integration/vCPE/teardown.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + diff --git a/test/csit/plans/integration/vCPE/testplan.txt b/test/csit/plans/integration/vCPE/testplan.txt new file mode 100644 index 000000000..2b3d4ad5d --- /dev/null +++ b/test/csit/plans/integration/vCPE/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +integration/vCPE diff --git a/test/csit/plans/msb/iag-redirect-discovery/setup.sh b/test/csit/plans/msb/iag-redirect-discovery/setup.sh new file mode 100644 index 000000000..e14c28fe6 --- /dev/null +++ b/test/csit/plans/msb/iag-redirect-discovery/setup.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Copyright 2017 ZTE, Inc. and others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +source ${SCRIPTS}/common_functions.sh + +#start msb +docker run -d -p 8500:8500 --name msb_consul consul +MSB_CONSUL_IP=`get-instance-ip.sh msb_consul` +echo MSB_CONSUL_IP=${MSB_CONSUL_IP} + +docker run -d -p 10081:10081 -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery +MSB_DISCOVERY_IP=`get-instance-ip.sh msb_discovery` +echo DISCOVERY_IP=${MSB_DISCOVERY_IP} + +docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway` +echo MSB_IAG_IP=${MSB_IAG_IP} + +# Start rest example service +docker run -d -p 9090:9090 --name i-rest-example zhaohuabing/rest-example +REST_EXAMPLE_IP=`get-instance-ip.sh i-rest-example` +echo REST_EXAMPLE_IP=${REST_EXAMPLE_IP} + + +# Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway) +for i in {1..10}; do + curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break + echo sleep $i + sleep $i +done + +#Need some time for the initialization of MSB services +sleep 60 + +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"serviceName": "test", "version": "v1", "url": "/","protocol": "REST", "lb_policy":"round-robin","nodes": [ {"ip": "'${REST_EXAMPLE_IP}'","port": "9090"}]}' \ + "http://${MSB_IAG_IP}:80/api/microservices/v1/services" + +# Pass any variables required by Robot suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v MSB_DISCOVERY_IP:${MSB_DISCOVERY_IP} -v REST_EXAMPLE_IP:${REST_EXAMPLE_IP}"
\ No newline at end of file diff --git a/test/csit/plans/msb/iag-redirect-discovery/teardown.sh b/test/csit/plans/msb/iag-redirect-discovery/teardown.sh new file mode 100644 index 000000000..b79456731 --- /dev/null +++ b/test/csit/plans/msb/iag-redirect-discovery/teardown.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 2017 ZTE, Inc. and others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +kill-instance.sh msb_consul +kill-instance.sh msb_discovery +kill-instance.sh msb_internal_apigateway +kill-instance.sh i-rest-example diff --git a/test/csit/plans/msb/iag-redirect-discovery/testplan.txt b/test/csit/plans/msb/iag-redirect-discovery/testplan.txt new file mode 100644 index 000000000..54bb307bf --- /dev/null +++ b/test/csit/plans/msb/iag-redirect-discovery/testplan.txt @@ -0,0 +1,4 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +msb/rest-service-discovery +msb/rest-service-api-gateway
\ No newline at end of file diff --git a/test/csit/plans/msb/rest-service/setup.sh b/test/csit/plans/msb/rest-service/setup.sh index 18b17ff8f..9682cde74 100644 --- a/test/csit/plans/msb/rest-service/setup.sh +++ b/test/csit/plans/msb/rest-service/setup.sh @@ -18,20 +18,20 @@ source ${SCRIPTS}/common_functions.sh #start msb -sudo docker run -d -p 8500:8500 --name msb_consul consul +docker run -d -p 8500:8500 --name msb_consul consul MSB_CONSUL_IP=`get-instance-ip.sh msb_consul` echo MSB_CONSUL_IP=${MSB_CONSUL_IP} -sudo docker run -d -p 10081:10081 -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery +docker run -d -p 10081:10081 -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery MSB_DISCOVERY_IP=`get-instance-ip.sh msb_discovery` echo DISCOVERY_IP=${MSB_DISCOVERY_IP} -sudo docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway` echo MSB_IAG_IP=${MSB_IAG_IP} # Start rest example service -sudo docker run -d -p 9090:9090 --name i-rest-example zhaohuabing/rest-example +docker run -d -p 9090:9090 --name i-rest-example zhaohuabing/rest-example REST_EXAMPLE_IP=`get-instance-ip.sh i-rest-example` echo REST_EXAMPLE_IP=${REST_EXAMPLE_IP} @@ -43,7 +43,7 @@ for i in {1..10}; do sleep $i done -#Need some time so service info can be synced from discovery to api gateway +#Need some time for the initialization of MSB services sleep 60 curl -X POST \ diff --git a/test/csit/plans/multicloud-ocata/functionality1/setup.sh b/test/csit/plans/multicloud-ocata/functionality1/setup.sh new file mode 100644 index 000000000..5630849cf --- /dev/null +++ b/test/csit/plans/multicloud-ocata/functionality1/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright (c) 2017 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +# +# Place the scripts in run order: +# Start all process required for executing test case + +source ${SCRIPTS}/common_functions.sh + +# start multicloud-ocata +docker run -d --name multicloud-ocata nexus3.onap.org:10001/onap/multicloud/openstack-ocata +SERVICE_IP=`get-instance-ip.sh multicloud-ocata` +SERVICE_PORT=9004 + +for i in {1..50}; do + curl -sS ${SERVICE_IP}:${SERVICE_PORT} && break + echo sleep $i + sleep $i +done + +echo SCRIPTS +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES+="-v SERVICE_IP:${SERVICE_IP} " +ROBOT_VARIABLES+="-v SERVICE_PORT:${SERVICE_PORT} " diff --git a/test/csit/plans/multicloud-ocata/functionality1/teardown.sh b/test/csit/plans/multicloud-ocata/functionality1/teardown.sh new file mode 100644 index 000000000..6ecb74ebd --- /dev/null +++ b/test/csit/plans/multicloud-ocata/functionality1/teardown.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Copyright (c) 2017 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +# This script is sourced by run-csit.sh after Robot test completion. +kill-instance.sh multicloud-ocata diff --git a/test/csit/plans/multicloud-ocata/functionality1/testplan.txt b/test/csit/plans/multicloud-ocata/functionality1/testplan.txt new file mode 100644 index 000000000..fcd795da3 --- /dev/null +++ b/test/csit/plans/multicloud-ocata/functionality1/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +multicloud-ocata/provision/sanity_test_multicloud.robot diff --git a/test/csit/plans/multicloud/functionality1/setup.sh b/test/csit/plans/multicloud/functionality1/setup.sh index b43f4b856..993a39f68 100755 --- a/test/csit/plans/multicloud/functionality1/setup.sh +++ b/test/csit/plans/multicloud/functionality1/setup.sh @@ -17,17 +17,10 @@ # Place the scripts in run order: # Start all process required for executing test case -# start msb -# Replace this when msb is ready for onap -docker run -d --name i-msb -p 80:80 openoint/common-services-msb -MSB_IP=`get-instance-ip.sh i-msb` - -# start esr -# docker run -d --name i-esr -e MSB_ADDR=${MSB_IP}:80 openoint/common-services-extsys +source ${SCRIPTS}/common_functions.sh # start multivim-broker -# Replace this when multivim-broker container is ready -docker run -d --name multivim-broker -e MSB_ADDR=${MSB_IP}:80 openoint/multivim-broker +docker run -d --name multivim-broker nexus3.onap.org:10001/onap/multicloud/framework BROKER_IP=`get-instance-ip.sh multivim-broker` for i in {1..50}; do curl -sS ${BROKER_IP}:9001 && break @@ -37,4 +30,4 @@ done echo SCRIPTS # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MSB_IP:${MSB_IP}" +ROBOT_VARIABLES="-v BROKER_IP:${BROKER_IP}" diff --git a/test/csit/plans/multicloud/functionality1/teardown.sh b/test/csit/plans/multicloud/functionality1/teardown.sh index 4ca6dbc99..1732649af 100755 --- a/test/csit/plans/multicloud/functionality1/teardown.sh +++ b/test/csit/plans/multicloud/functionality1/teardown.sh @@ -16,5 +16,4 @@ # # This script is sourced by run-csit.sh after Robot test completion. -kill-instance.sh i-msb kill-instance.sh multivim-broker diff --git a/test/csit/plans/sdnc/healthcheck/health_check.sh b/test/csit/plans/sdnc/healthcheck/health_check.sh new file mode 100644 index 000000000..96c99848a --- /dev/null +++ b/test/csit/plans/sdnc/healthcheck/health_check.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +############################################################################### +# Copyright 2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################### +SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +echo $SCRIPTS + +response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ) + +if [ "$response" == "200" ]; then + echo "SDNC health check passed." + exit 0; +fi + +echo "SDNC health check failed with response code ${response}." +exit 1 diff --git a/test/csit/plans/sdnc/healthcheck/setup.sh b/test/csit/plans/sdnc/healthcheck/setup.sh new file mode 100644 index 000000000..643d54fe9 --- /dev/null +++ b/test/csit/plans/sdnc/healthcheck/setup.sh @@ -0,0 +1,118 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# +# Place the scripts in run order: +SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source ${WORKSPACE}/test/csit/scripts/sdnc/script1.sh + +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) + +if [ "$MTU" == "" ]; then + export MTU="1450" +fi + + +# Clone SDNC repo to get docker-compose for SDNC +mkdir -p $WORKSPACE/archives/sdnc +cd $WORKSPACE/archives +git clone -b master --single-branch http://gerrit.onap.org/r/sdnc/oam.git sdnc +cd $WORKSPACE/archives/sdnc +git pull +unset http_proxy https_proxy +cd $WORKSPACE/archives/sdnc/installation/src/main/yaml + +sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml +docker login -u docker -p docker nexus3.onap.org:10001 + +docker pull nexus3.onap.org:10001/onap/sdnc-image:latest +docker tag nexus3.onap.org:10001/onap/sdnc-image:latest onap/sdnc-image:latest + +docker pull nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:latest +docker tag nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:latest onap/ccsdk-dgbuilder-image:latest + +docker pull nexus3.onap.org:10001/onap/admportal-sdnc-image:latest +docker tag nexus3.onap.org:10001/onap/admportal-sdnc-image:latest onap/admportal-sdnc-image:latest + +# start SDNC containers with docker compose and configuration from docker-compose.yml +curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > docker-compose +chmod +x docker-compose +./docker-compose up -d + +# WAIT 5 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API +TIME_OUT=500 +INTERVAL=30 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ); echo $response + + if [ "$response" == "200" ]; then + echo SDNC started in $TIME seconds + break; + fi + + echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities... +fi + +#sleep 800 + +TIME_OUT=1500 +INTERVAL=60 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + +response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf system:start-level) +num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | tail -1 | cut -d\| -f1) + + if [ "$response" == "Level 100" ] && [ "$num_bundles" -ge 333 ]; then + echo SDNC karaf started in $TIME seconds + break; + fi + + echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities... +fi + +response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf system:start-level) +num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | tail -1 | cut -d\| -f1) + + if [ "$response" == "Level 100" ] && [ "$num_bundles" -ge 333 ]; then + num_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | tail -1 | cut -d\| -f1) + num_failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | grep Failure | wc -l) + failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client -u karaf bundle:list | grep Failure) + echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles. + fi + +if [ "$num_failed_bundles" -ge 1 ]; then + echo "The following bundle(s) are in a failed state: " + echo " $failed_bundles" +fi + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}" + diff --git a/test/csit/plans/sdnc/healthcheck/teardown.sh b/test/csit/plans/sdnc/healthcheck/teardown.sh new file mode 100644 index 000000000..4d99b9f31 --- /dev/null +++ b/test/csit/plans/sdnc/healthcheck/teardown.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# + +kill-instance.sh sdnc_controller_container +kill-instance.sh sdnc_dgbuilder_container +kill-instance.sh sdnc_portal_container +kill-instance.sh sdnc_db_container + +# $WORKSPACE/archives/appc deleted with archives folder when tests starts so we keep it at the end for debugging diff --git a/test/csit/plans/sdnc/healthcheck/testplan.txt b/test/csit/plans/sdnc/healthcheck/testplan.txt new file mode 100644 index 000000000..3fa8dde53 --- /dev/null +++ b/test/csit/plans/sdnc/healthcheck/testplan.txt @@ -0,0 +1,4 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +sdnc/healthcheck + diff --git a/test/csit/plans/vfc-gvnfm-vnflcm/sanity-check/setup.sh b/test/csit/plans/vfc-gvnfm-vnflcm/sanity-check/setup.sh index deb491642..634c32722 100755 --- a/test/csit/plans/vfc-gvnfm-vnflcm/sanity-check/setup.sh +++ b/test/csit/plans/vfc-gvnfm-vnflcm/sanity-check/setup.sh @@ -44,7 +44,7 @@ echo sleep 30 sleep 30 # start vfc-vnflcm -docker run -d --name vfc-vnflcm -v /var/lib/mysql -e MSB_ADDR=${MSB_DISCOVERY_IP}:10081 nexus3.onap.org:10001/onap/vfc/vnflcm +docker run -d --name vfc-vnflcm -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/vnflcm VNFLCM_IP=`get-instance-ip.sh vfc-vnflcm` # Wait for initialization @@ -58,4 +58,4 @@ docker cp vfc-vnflcm:/service/vfc/gvnfm/vnflcm/lcm/logs/runtime_lcm.log ./ cat runtime_lcm.log # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v MSB_DISCOVERY_IP:${MSB_DISCOVERY_IP} -v VNFLCM_IP:${VNFLCM_IP}" +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v VNFLCM_IP:${VNFLCM_IP}" diff --git a/test/csit/plans/vfc-gvnfm-vnfres/sanity-check/setup.sh b/test/csit/plans/vfc-gvnfm-vnfres/sanity-check/setup.sh index 78cc5e0cb..0139bcdcc 100755 --- a/test/csit/plans/vfc-gvnfm-vnfres/sanity-check/setup.sh +++ b/test/csit/plans/vfc-gvnfm-vnfres/sanity-check/setup.sh @@ -42,37 +42,15 @@ done echo sleep 60 sleep 60 # start vfc-vnfres -docker run -d --name vfc-vnfres -v /var/lib/mysql -e MSB_ADDR=${MSB_DISCOVERY_IP}:10081 nexus3.onap.org:10001/onap/vfc/vnfres +docker run -d --name vfc-vnfres -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/vnfres VNFRES_IP=`get-instance-ip.sh vfc-vnfres` -docker logs -f vfc-vnfres > vfc-vnfres.log & # Wait for initialization for i in {1..10}; do curl -sS ${VNFRES_IP}:8802 && break echo sleep $i sleep $i done -cat vfc-vnfres.log - -echo "================================================" -docker cp vfc-vnfres:/service/vfc/gvnfm/vnfres/res/docker/docker-entrypoint.sh ./ -cat docker-entrypoint.sh - -echo "================================================" -docker cp vfc-vnfres:/service/vfc/gvnfm/vnfres/res/docker/instance_config.sh ./ -cat instance_config.sh - -echo "================================================" -docker cp vfc-vnfres:/service/vfc/gvnfm/vnfres/res/docker/instance_init.sh ./ -cat instance_init.sh - -echo "================================================" -docker cp vfc-vnfres:/service/vfc/gvnfm/vnfres/res/docker/instance_run.sh ./ -cat instance_run.sh - -#echo "================================================" -#docker cp vfc-vnfres:/service/vfc/gvnfm/vnfres/res/logs/runtime_res.log ./ -#cat instance_init.sh # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v MSB_DISCOVERY_IP:${MSB_DISCOVERY_IP} -v VNFRES_IP:${VNFRES_IP}" +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v VNFRES_IP:${VNFRES_IP}" diff --git a/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/setup.sh new file mode 100755 index 000000000..09978ca6d --- /dev/null +++ b/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/setup.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Place the scripts in run order: +# Start all process required for executing test case + +source ${SCRIPTS}/common_functions.sh + +#start msb +docker run -d -p 8500:8500 --name msb_consul consul +MSB_CONSUL_IP=`get-instance-ip.sh msb_consul` +echo MSB_CONSUL_IP=${MSB_CONSUL_IP} + +docker run -d -p 10081:10081 -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery +MSB_DISCOVERY_IP=`get-instance-ip.sh msb_discovery` +echo DISCOVERY_IP=${MSB_DISCOVERY_IP} + +docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway` +echo MSB_IAG_IP=${MSB_IAG_IP} + +# Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway) +for i in {1..10}; do + curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break + echo sleep $i + sleep $i +done + +# Need some time so service info can be synced from discovery to api gateway +echo sleep 60 +sleep 60 + +# start vfc-emsdriver +docker run -d --name vfc-emsdriver -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/emsdriver +EMS_DRV_IP=`get-instance-ip.sh vfc-emsdriver` +docker logs -f vfc-emsdriver > emsdriver.log & + +# Wait for initialization +for i in {1..10}; do + curl -sS -m 1 ${EMS_DRV_IP}:8206 && break + echo sleep $i + sleep $i +done + +echo "===============" +cat emsdriver.log + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v EMS_DRV_IP:${EMS_DRV_IP}" diff --git a/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/teardown.sh b/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/teardown.sh new file mode 100755 index 000000000..aa676b2f2 --- /dev/null +++ b/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/teardown.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script is sourced by run-csit.sh after Robot test completion. +kill-instance.sh msb_internal_apigateway +kill-instance.sh msb_discovery +kill-instance.sh msb_consul +kill-instance.sh vfc-emsdriver diff --git a/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/testplan.txt b/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/testplan.txt new file mode 100644 index 000000000..747f8683e --- /dev/null +++ b/test/csit/plans/vfc-nfvo-driver-ems/sanity-check/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +vfc/nfvo-driver-ems/test.robot diff --git a/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/setup.sh new file mode 100755 index 000000000..45ad0cbb1 --- /dev/null +++ b/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/setup.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Place the scripts in run order: +# Start all process required for executing test case + +source ${SCRIPTS}/common_functions.sh + +#start msb +docker run -d -p 8500:8500 --name msb_consul consul +MSB_CONSUL_IP=`get-instance-ip.sh msb_consul` +echo MSB_CONSUL_IP=${MSB_CONSUL_IP} + +docker run -d -p 10081:10081 -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery +MSB_DISCOVERY_IP=`get-instance-ip.sh msb_discovery` +echo DISCOVERY_IP=${MSB_DISCOVERY_IP} + +docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway` +echo MSB_IAG_IP=${MSB_IAG_IP} + +# Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway) +for i in {1..10}; do + curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break + echo sleep $i + sleep $i +done + +# Need some time so service info can be synced from discovery to api gateway +echo sleep 60 +sleep 60 + +# start vfc-ztesdncdriver +docker run -d --name vfc-ztesdncdriver -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/ztesdncdriver +SFC_DRV_IP=`get-instance-ip.sh vfc-ztesdncdriver` +docker logs -f vfc-ztesdncdriver > ztesdncdriver.log & + +# Wait for initialization +for i in {1..10}; do + curl -sS -m 1 ${SFC_DRV_IP}:8411 && break + echo sleep $i + sleep $i +done + +echo "===============================" +cat ztesdncdriver.log + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v SFC_DRV_IP:${SFC_DRV_IP}" diff --git a/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/teardown.sh b/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/teardown.sh new file mode 100755 index 000000000..ce5402efe --- /dev/null +++ b/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/teardown.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script is sourced by run-csit.sh after Robot test completion. +kill-instance.sh msb_internal_apigateway +kill-instance.sh msb_discovery +kill-instance.sh msb_consul +kill-instance.sh vfc-ztesdncdriver diff --git a/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/testplan.txt b/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/testplan.txt new file mode 100644 index 000000000..9de2accee --- /dev/null +++ b/test/csit/plans/vfc-nfvo-driver-sfc/sanity-check/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +vfc/nfvo-driver-sfc/test.robot diff --git a/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/setup.sh index c5c9f12cd..283cb0d41 100644 --- a/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/setup.sh +++ b/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/setup.sh @@ -42,33 +42,26 @@ done echo sleep 60 sleep 60 # start vfc-gvnfmdriver -docker run -d --name vfc-gvnfmdriver -e MSB_ADDR=${MSB_DISCOVERY_IP}:10081 nexus3.onap.org:10001/onap/vfc/gvnfmdriver +docker run -d --name vfc-gvnfmdriver -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/gvnfmdriver GVNFMDRIVER_IP=`get-instance-ip.sh vfc-gvnfmdriver` -docker logs -f vfc-gvnfmdriver > vfc-gvnfmdriver & # Wait for initialization for i in {1..10}; do curl -sS ${GVNFMDRIVER_IP}:8484 && break echo sleep $i sleep $i done -cat vfc-gvnfmdriver.log -echo "================================================" -docker cp vfc-gvnfmdriver:/service/vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/docker/docker-entrypoint.sh ./ -cat docker-entrypoint.sh +# start vfc-jujudriver +docker run -d --name vfc-jujudriver -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/jujudriver +JUJUDRIVER_IP=`get-instance-ip.sh vfc-jujudriver` -echo "================================================" -docker cp vfc-gvnfmdriver:/service/vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/docker/instance_config.sh ./ -cat instance_config.sh - -echo "================================================" -docker cp vfc-gvnfmdriver:/service/vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/docker/instance_init.sh ./ -cat instance_init.sh - -echo "================================================" -docker cp vfc-gvnfmdriver:/service/vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/docker/instance_run.sh ./ -cat instance_run.sh +# Wait for initialization +for i in {1..10}; do + curl -sS ${JUJUDRIVER_IP}:8483 && break + echo sleep $i + sleep $i +done # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v MSB_DISCOVERY_IP:${MSB_DISCOVERY_IP} -v GVNFMDRIVER_IP:${GVNFMDRIVER_IP}" +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v GVNFMDRIVER_IP:${GVNFMDRIVER_IP} -v JUJUDRIVER_IP:${JUJUDRIVER_IP}" diff --git a/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/teardown.sh b/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/teardown.sh index a55050251..78d7c5ad9 100644 --- a/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/teardown.sh +++ b/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/teardown.sh @@ -21,4 +21,4 @@ kill-instance.sh msb_discovery kill-instance.sh msb_consul kill-instance.sh vfc-gvnfmdriver -# kill-instance.sh vfc-jujudriver +kill-instance.sh vfc-jujudriver diff --git a/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/testplan.txt b/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/testplan.txt index 7cca2fbe5..e7bee519b 100644 --- a/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/testplan.txt +++ b/test/csit/plans/vfc-nfvo-driver-vnfm-gvnfm/sanity-check/testplan.txt @@ -3,4 +3,4 @@ vfc/nfvo-driver-gvnfm/gvnfmdriver.robot -# vfc/nfvo-driver-gvnfm/jujudriver.robot +vfc/nfvo-driver-gvnfm/jujudriver.robot diff --git a/test/csit/plans/vfc-nfvo-driver-vnfm-svnfm/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-driver-vnfm-svnfm/sanity-check/setup.sh index 3f79bb024..382cb7a8d 100644 --- a/test/csit/plans/vfc-nfvo-driver-vnfm-svnfm/sanity-check/setup.sh +++ b/test/csit/plans/vfc-nfvo-driver-vnfm-svnfm/sanity-check/setup.sh @@ -41,34 +41,18 @@ done # wait for container initalization echo sleep 60 sleep 60 + # start vfc-ztevmanagerdriver -docker run -d --name vfc-ztevmanagerdriver -e MSB_ADDR=${MSB_DISCOVERY_IP}:10081 nexus3.onap.org:10001/onap/vfc/ztevmanagerdriver +docker run -d --name vfc-ztevmanagerdriver -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/ztevmanagerdriver ZTEVMANAGERDRIVER_IP=`get-instance-ip.sh vfc-ztevmanagerdriver` -docker logs -f vfc-ztevmanagerdriver > vfc-ztevmanagerdriver & # Wait for initialization for i in {1..10}; do curl -sS ${ZTEVMANAGERDRIVER_IP}:8410 && break echo sleep $i sleep $i done -cat vfc-ztevmanagerdriver.log - -echo "================================================" -docker cp vfc-ztevmanagerdriver:/service/vfc/nfvo/driver/vnfm/svnfm/zte/vmanager/docker/docker-entrypoint.sh ./ -cat docker-entrypoint.sh - -echo "================================================" -docker cp vfc-ztevmanagerdriver:/service/vfc/nfvo/driver/vnfm/svnfm/zte/vmanager/docker/instance_config.sh ./ -cat instance_config.sh - -echo "================================================" -docker cp vfc-ztevmanagerdriver:/service/vfc/nfvo/driver/vnfm/svnfm/zte/vmanager/docker/instance_init.sh ./ -cat instance_init.sh -echo "================================================" -docker cp vfc-ztevmanagerdriver:/service/vfc/nfvo/driver/vnfm/svnfm/zte/vmanager/docker/instance_run.sh ./ -cat instance_run.sh # Start svnfm-huawei docker run -d --name vfc-svnfm-huawei -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/nfvo/svnfm/huawei @@ -80,4 +64,4 @@ for i in {1..10}; do done # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v MSB_DISCOVERY_IP:${MSB_DISCOVERY_IP} -v ZTEVMANAGERDRIVER_IP:${ZTEVMANAGERDRIVER_IP} -v MSB_IP:${MSB_IAG_IP} -v SERVICE_IP:${SERVICE_IP}" +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v ZTEVMANAGERDRIVER_IP:${ZTEVMANAGERDRIVER_IP} -v MSB_IP:${MSB_IAG_IP} -v SERVICE_IP:${SERVICE_IP}" diff --git a/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh index cad0f89a9..3cc53988c 100755 --- a/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh +++ b/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh @@ -44,7 +44,7 @@ echo sleep 60 sleep 60 # start vfc-nslcm -docker run -d --name vfc-nslcm -v /var/lib/mysql -e MSB_ADDR=${MSB_DISCOVERY_IP}:10081 nexus3.onap.org:10001/onap/vfc/nslcm +docker run -d --name vfc-nslcm -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 nexus3.onap.org:10001/onap/vfc/nslcm NSLCM_IP=`get-instance-ip.sh vfc-nslcm` # Wait for initialization @@ -55,4 +55,4 @@ for i in {1..10}; do done # Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v MSB_DISCOVERY_IP:${MSB_DISCOVERY_IP} -v NSLCM_IP:${NSLCM_IP}" +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v NSLCM_IP:${NSLCM_IP} -v SCRIPTS:${SCRIPTS}" diff --git a/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh b/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh index 91e931e91..e04feac41 100644 --- a/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh +++ b/test/csit/plans/vnfsdk-refrepo/sanity-check/setup.sh @@ -17,9 +17,13 @@ # These scripts are sourced by run-csit.sh. +#Start postgres database +docker run -d -i -t --name=postgres -p 5432:5432 nexus3.onap.org:10001/onap/refrepo/postgres:latest + +POSTGRES=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' postgres` #Start market place -docker run -d -i -t --name=refrepo -p 8702:8702 nexus3.onap.org:10001/onap/refrepo:1.0-STAGING-latest +docker run -d -i -t --name=refrepo -e POSTGRES_IP=$POSTGRES -p 8702:8702 nexus3.onap.org:10001/onap/refrepo:1.0-STAGING-latest # Wait for Market place initialization echo Wait for VNF Repository initialization diff --git a/test/csit/plans/vnfsdk-refrepo/sanity-check/teardown.sh b/test/csit/plans/vnfsdk-refrepo/sanity-check/teardown.sh index a42634303..19440bc79 100644 --- a/test/csit/plans/vnfsdk-refrepo/sanity-check/teardown.sh +++ b/test/csit/plans/vnfsdk-refrepo/sanity-check/teardown.sh @@ -18,4 +18,6 @@ kill-instance.sh refrepo +kill-instance.sh postgres + diff --git a/test/csit/run-csit.sh b/test/csit/run-csit.sh index 8033f308a..f499d8ed1 100755 --- a/test/csit/run-csit.sh +++ b/test/csit/run-csit.sh @@ -93,6 +93,24 @@ if ! type pybot > /dev/null; then source ${ROBOT_VENV}/bin/activate fi +# install required Robot libraries +pip install --upgrade robotframework-extendedselenium2library + +# install eteutils +mkdir -p ${ROBOT_VENV}/src/onap +rm -rf ${ROBOT_VENV}/src/onap/testsuite +git clone https://gerrit.onap.org/r/testsuite/python-testing-utils.git ${ROBOT_VENV}/src/onap/testsuite/python-testing-utils +pip install --upgrade ${ROBOT_VENV}/src/onap/testsuite/python-testing-utils + +# install chrome driver +if [ ! -x ${ROBOT_VENV}/bin/chromedriver ]; then + pushd ${ROBOT_VENV}/bin + wget -N http://chromedriver.storage.googleapis.com/2.32/chromedriver_linux64.zip + unzip chromedriver_linux64.zip + chmod +x chromedriver + popd +fi + WORKDIR=`mktemp -d --suffix=-robot-workdir` cd ${WORKDIR} @@ -103,7 +121,7 @@ set -x # Add csit scripts to PATH -export PATH=${PATH}:${WORKSPACE}/test/csit/docker/scripts:${WORKSPACE}/test/csit/scripts +export PATH=${PATH}:${WORKSPACE}/test/csit/docker/scripts:${WORKSPACE}/test/csit/scripts:${ROBOT_VENV}/bin export SCRIPTS=${WORKSPACE}/test/csit/scripts export ROBOT_VARIABLES= diff --git a/test/csit/scripts/holmes/engine-management/startup.sh b/test/csit/scripts/holmes/engine-management/startup.sh index 59af9cac6..27a4df48d 100644 --- a/test/csit/scripts/holmes/engine-management/startup.sh +++ b/test/csit/scripts/holmes/engine-management/startup.sh @@ -20,4 +20,4 @@ docker login -u docker -p docker nexus3.onap.org:10001 -run-instance.sh nexus3.onap.org:10001/onap/holmes/engine-management:latest $1 "-e URL_JDBC=$2:5432 -e MSB_ADDR=$3 -e MSB_PORT=$4 -p 9102:9102" +run-instance.sh nexus3.onap.org:10001/onap/holmes/engine-management:latest $1 "-e URL_JDBC=$2:5432 -e MSB_ADDR=$3:80 -e TESTING=$4 -p 9102:9102" diff --git a/test/csit/scripts/holmes/rule-management/startup.sh b/test/csit/scripts/holmes/rule-management/startup.sh index e3bcdaa8e..ab3f93123 100644 --- a/test/csit/scripts/holmes/rule-management/startup.sh +++ b/test/csit/scripts/holmes/rule-management/startup.sh @@ -19,4 +19,4 @@ docker login -u docker -p docker nexus3.onap.org:10001 -run-instance.sh nexus3.onap.org:10001/onap/holmes/rule-management:latest $1 "-e URL_JDBC=$2:5432 -e MSB_ADDR=$3 -e MSB_PORT=$4 -p 9101:9101"
\ No newline at end of file +run-instance.sh nexus3.onap.org:10001/onap/holmes/rule-management:latest $1 "-e URL_JDBC=$2:5432 -e MSB_ADDR=$3:80 -e TESTING=$4 -p 9101:9101"
\ No newline at end of file diff --git a/test/csit/scripts/sdnc/script1.sh b/test/csit/scripts/sdnc/script1.sh new file mode 100644 index 000000000..b87e3c197 --- /dev/null +++ b/test/csit/scripts/sdnc/script1.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# + +echo "This is ${WORKSPACE}/test/csit/scripts/sdnc/script1.sh" diff --git a/test/csit/tests/aai/resources/suite1/__init__.robot b/test/csit/tests/aai/resources/api_suite/__init__.robot index 538def841..538def841 100644 --- a/test/csit/tests/aai/resources/suite1/__init__.robot +++ b/test/csit/tests/aai/resources/api_suite/__init__.robot diff --git a/test/csit/tests/aai/resources/suite1/aai.crt b/test/csit/tests/aai/resources/api_suite/aai.crt index 6a28bbb8c..6a28bbb8c 100644 --- a/test/csit/tests/aai/resources/suite1/aai.crt +++ b/test/csit/tests/aai/resources/api_suite/aai.crt diff --git a/test/csit/tests/aai/resources/suite1/aai.key b/test/csit/tests/aai/resources/api_suite/aai.key index 02724df46..02724df46 100644 --- a/test/csit/tests/aai/resources/suite1/aai.key +++ b/test/csit/tests/aai/resources/api_suite/aai.key diff --git a/test/csit/tests/aai/resources/api_suite/complex.robot b/test/csit/tests/aai/resources/api_suite/complex.robot new file mode 100644 index 000000000..3602f731a --- /dev/null +++ b/test/csit/tests/aai/resources/api_suite/complex.robot @@ -0,0 +1,72 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${COMPLEXKEYVALUE} complex-integration-test1 +${COMPLEXURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE} +${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"} + +*** 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 + ${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 diff --git a/test/csit/tests/aai/resources/api_suite/get_all.robot b/test/csit/tests/aai/resources/api_suite/get_all.robot new file mode 100644 index 000000000..8e464cbdb --- /dev/null +++ b/test/csit/tests/aai/resources/api_suite/get_all.robot @@ -0,0 +1,105 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${COMPLEXKEYVALUE1} complex-integration-test3-1 +${COMPLEXKEYVALUE2} complex-integration-test3-2 +${COMPLEXURL1} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE1} +${COMPLEXURL2} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE2} +${ALLCOMPLEXURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes +${COMPLEXDATA1} {"physical-location-id":"${COMPLEXKEYVALUE1}","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"} +${COMPLEXDATA2} {"physical-location-id":"${COMPLEXKEYVALUE2}","data-center-code":"example-data-center-code-val-7783","complex-name":"example-complex-name-val-1292","identity-url":"example-identity-url-val-7466","physical-location-type":"example-physical-location-type-val-3854","street1":"example-street1-val-2496","street2":"example-street2-val-6629","city":"example-city-val-3062","state":"example-state-val-9058","postal-code":"example-postal-code-val-4493","country":"example-country-val-9873","region":"example-region-val-1004","latitude":"example-latitude-val-4555","longitude":"example-longitude-val-7603","elevation":"example-elevation-val-6335","lata":"example-lata-val-9035"} + +*** Test Cases *** + +Run AAI Put complex 1 + [Documentation] Create an complex 1 object + ${resp}= PutWithCert ${COMPLEXURL1} ${COMPLEXDATA1} + log ${COMPLEXURL1} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Put complex 2 + [Documentation] Create an complex 2 object + ${resp}= PutWithCert ${COMPLEXURL2} ${COMPLEXDATA2} + log ${COMPLEXURL2} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Get all complex + [Documentation] Get the complex object just created + ${resp} GetWithCert ${ALLCOMPLEXURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Get complex 1 to delete + [Documentation] Get the complex 1 object to delete + ${resp} GetWithCert ${COMPLEXURL1} + 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 1 + [Documentation] Delete the complex just created + ${resp}= DeleteWithCert ${COMPLEXURL1}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +Run AAI Get complex 2 to delete + [Documentation] Get the complex 2 object to delete + ${resp} GetWithCert ${COMPLEXURL2} + 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 2 + [Documentation] Delete the complex just created + ${resp}= DeleteWithCert ${COMPLEXURL2}?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/api_suite/get_with_depth.robot b/test/csit/tests/aai/resources/api_suite/get_with_depth.robot new file mode 100644 index 000000000..8e464cbdb --- /dev/null +++ b/test/csit/tests/aai/resources/api_suite/get_with_depth.robot @@ -0,0 +1,105 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${COMPLEXKEYVALUE1} complex-integration-test3-1 +${COMPLEXKEYVALUE2} complex-integration-test3-2 +${COMPLEXURL1} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE1} +${COMPLEXURL2} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE2} +${ALLCOMPLEXURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes +${COMPLEXDATA1} {"physical-location-id":"${COMPLEXKEYVALUE1}","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"} +${COMPLEXDATA2} {"physical-location-id":"${COMPLEXKEYVALUE2}","data-center-code":"example-data-center-code-val-7783","complex-name":"example-complex-name-val-1292","identity-url":"example-identity-url-val-7466","physical-location-type":"example-physical-location-type-val-3854","street1":"example-street1-val-2496","street2":"example-street2-val-6629","city":"example-city-val-3062","state":"example-state-val-9058","postal-code":"example-postal-code-val-4493","country":"example-country-val-9873","region":"example-region-val-1004","latitude":"example-latitude-val-4555","longitude":"example-longitude-val-7603","elevation":"example-elevation-val-6335","lata":"example-lata-val-9035"} + +*** Test Cases *** + +Run AAI Put complex 1 + [Documentation] Create an complex 1 object + ${resp}= PutWithCert ${COMPLEXURL1} ${COMPLEXDATA1} + log ${COMPLEXURL1} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Put complex 2 + [Documentation] Create an complex 2 object + ${resp}= PutWithCert ${COMPLEXURL2} ${COMPLEXDATA2} + log ${COMPLEXURL2} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Get all complex + [Documentation] Get the complex object just created + ${resp} GetWithCert ${ALLCOMPLEXURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Get complex 1 to delete + [Documentation] Get the complex 1 object to delete + ${resp} GetWithCert ${COMPLEXURL1} + 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 1 + [Documentation] Delete the complex just created + ${resp}= DeleteWithCert ${COMPLEXURL1}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +Run AAI Get complex 2 to delete + [Documentation] Get the complex 2 object to delete + ${resp} GetWithCert ${COMPLEXURL2} + 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 2 + [Documentation] Delete the complex just created + ${resp}= DeleteWithCert ${COMPLEXURL2}?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/api_suite/patch.robot b/test/csit/tests/aai/resources/api_suite/patch.robot new file mode 100644 index 000000000..90544e4d9 --- /dev/null +++ b/test/csit/tests/aai/resources/api_suite/patch.robot @@ -0,0 +1,86 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${L3NETWORKKEYVALUE} l3-network-integration-test1 +${L3NETWORKURL} https://${HOST_IP}:8443/aai/v11/network/l3-networks/l3-network/${L3NETWORKKEYVALUE} +${L3NETWORKDATA} {"network-id":"${L3NETWORKKEYVALUE}","network-name":"example-network-name-val-5468","network-type":"example-network-type-val-5468","network-role":"example-network-role-val-5468","network-technology":"example-network-technology-val-5468","neutron-network-id":"example-neutron-network-id-val-5468","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"} +${L3NETWORKPATCHDATA} {"network-id":"${L3NETWORKKEYVALUE}","network-name":"example-network-name-val-5468-patched","network-type":"example-network-type-val-5468-patched"} + +*** Test Cases *** +Run AAI Put l3-network + [Documentation] Create l3-network object + ${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 + ${resp} GetWithCert ${L3NETWORKURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Patch l3-network + [Documentation] Update (Parch) l3-network object + ${resp}= PatchWithCert ${L3NETWORKURL} ${L3NETWORKPATCHDATA} + log ${L3NETWORKURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Get l3-network + [Documentation] Get the l3-network object just patched + ${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 + ${resp}= DeleteWithCert ${L3NETWORKURL}?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/suite1/pserver.robot b/test/csit/tests/aai/resources/api_suite/pserver.robot index 55e57bccb..55e57bccb 100644 --- a/test/csit/tests/aai/resources/suite1/pserver.robot +++ b/test/csit/tests/aai/resources/api_suite/pserver.robot diff --git a/test/csit/tests/aai/resources/error_handling_suite/__init__.robot b/test/csit/tests/aai/resources/error_handling_suite/__init__.robot new file mode 100644 index 000000000..538def841 --- /dev/null +++ b/test/csit/tests/aai/resources/error_handling_suite/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Resources - Pserver Suite diff --git a/test/csit/tests/aai/resources/error_handling_suite/aai.crt b/test/csit/tests/aai/resources/error_handling_suite/aai.crt new file mode 100644 index 000000000..6a28bbb8c --- /dev/null +++ b/test/csit/tests/aai/resources/error_handling_suite/aai.crt @@ -0,0 +1,70 @@ +Bag Attributes + friendlyName: aaiopenecomp + localKeyID: 54 69 6D 65 20 31 35 30 34 38 33 32 34 34 33 32 39 32 +subject=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=SimpleDemo/CN=aai.api.simpledemo.openecomp.org/emailAddress=aai-host@api.simpledemo.openecomp.org +issuer=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=simpledemo/CN=OpenECOMP simpledemo Server CA X1/emailAddress=simpledemo@openecomp.org +-----BEGIN CERTIFICATE----- +MIIEiTCCA3GgAwIBAgIJAIPKfDLcn3MpMA0GCSqGSIb3DQEBCwUAMIGtMQswCQYD +VQQGEwJVUzELMAkGA1UECAwCTkoxEzARBgNVBAcMCkJlZG1pbnN0ZXIxEjAQBgNV +BAoMCU9wZW5FQ09NUDETMBEGA1UECwwKc2ltcGxlZGVtbzEqMCgGA1UEAwwhT3Bl +bkVDT01QIHNpbXBsZWRlbW8gU2VydmVyIENBIFgxMScwJQYJKoZIhvcNAQkBFhhz +aW1wbGVkZW1vQG9wZW5lY29tcC5vcmcwHhcNMTYxMTMwMTUzODM5WhcNMTcxMTMw +MTUzODM5WjCBuTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5KMRMwEQYDVQQHDApC +ZWRtaW5zdGVyMRIwEAYDVQQKDAlPcGVuRUNPTVAxEzARBgNVBAsMClNpbXBsZURl +bW8xKTAnBgNVBAMMIGFhaS5hcGkuc2ltcGxlZGVtby5vcGVuZWNvbXAub3JnMTQw +MgYJKoZIhvcNAQkBFiVhYWktaG9zdEBhcGkuc2ltcGxlZGVtby5vcGVuZWNvbXAu +b3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwQrQl8A0rT0Jjlos +Mr/7LEhT5UOif4GGPOk+3NCIxT3lOqAbUf+d9ZXyT2jWFRiKWua03vQ+Dxc8c2h2 +RRuH8LwEiOiWqPjWRxNqsARzZMI3ryHFCFBZh0FcpjH9kEeKVlLDYuV68k+ZucKd +NiqUNn61lD7kbmEGwvzKwf91FrJ09+CBMx1OnWKm3gCNKDqAEFMZCOdn2MgesJYB +/03lzPBS1jDfBXImXRcTBzpgA+wdCLn0cIQ1eLWUwS5tUqUJNh36nHdVyJ0P2Yjd +JLuxhFcmBKOz1ShyyO+BBtKBO8EGbU6qKflOiwOw0Fsn8LjKcrHQ58NPui5y04BU +Rypf3QIDAQABo4GdMIGaMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgO4MB0G +A1UdDgQWBBQyMUOsE2J+CKzK0qd8KFBD2gaWyjBbBgNVHSAEVDBSMFAGBFUdIAAw +SDBGBggrBgEFBQcCAjA6GjhLZWVwIGF3YXkgZnJvbSBjaGlsZHJlbi4gIFRoaXMg +Y2VydGlmaWNhdGUgaXMgbm90IGEgdG95LjANBgkqhkiG9w0BAQsFAAOCAQEAnkoy +2tWJOyyyIQwtVojUxv1GWQPnw3WCUcKpuX4CJhHXLxNErW1fBg7bmo08BNmBPPpq +WrJsy5lbBgUo9kgpViux5Stfy1rRIRsRLfl/icgCvJmUAxkmRCZL7yUvwG4K7s+8 +DwT+nW/XuWNP6Hd/qHccexB6COJ8KwvTdVoxAkCdX8qw4MCb/f7Kb1yle/vwBM5Q +UUONCJ4bEns1vnb9DGlNDUJNwCfwORAaVJpVS38Mv4UnSTmb2KMePtCWcx/dNsYR +2XrSGqLDnTvHwOpyhbfFTmackysGoSuDytORXy8YbwEiF13BwEK8i3rgNN0Z2ojf +cpmE2xxmaa+A2uuN6g== +-----END CERTIFICATE----- +Bag Attributes + friendlyName: root + 2.16.840.1.113894.746875.1.1: <Unsupported tag 6> +subject=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=simpledemo/CN=OpenECOMP simpledemo Server CA X1/emailAddress=simpledemo@openecomp.org +issuer=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=simpledemo/CN=OpenECOMP simpledemo Root Certification Authority/emailAddress=simpledemo@openecomp.org +-----BEGIN CERTIFICATE----- +MIIFpTCCA42gAwIBAgIJAJqx8dKnCZZoMA0GCSqGSIb3DQEBCwUAMIG9MQswCQYD +VQQGEwJVUzELMAkGA1UECAwCTkoxEzARBgNVBAcMCkJlZG1pbnN0ZXIxEjAQBgNV +BAoMCU9wZW5FQ09NUDETMBEGA1UECwwKc2ltcGxlZGVtbzE6MDgGA1UEAwwxT3Bl +bkVDT01QIHNpbXBsZWRlbW8gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEn +MCUGCSqGSIb3DQEJARYYc2ltcGxlZGVtb0BvcGVuZWNvbXAub3JnMB4XDTE2MTEy +ODIxMTQyNloXDTIxMTEyNzIxMTQyNlowga0xCzAJBgNVBAYTAlVTMQswCQYDVQQI +DAJOSjETMBEGA1UEBwwKQmVkbWluc3RlcjESMBAGA1UECgwJT3BlbkVDT01QMRMw +EQYDVQQLDApzaW1wbGVkZW1vMSowKAYDVQQDDCFPcGVuRUNPTVAgc2ltcGxlZGVt +byBTZXJ2ZXIgQ0EgWDExJzAlBgkqhkiG9w0BCQEWGHNpbXBsZWRlbW9Ab3BlbmVj +b21wLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALr4rivKQuRk +YNf5Ig40e1nqj6s6LB1vgMOYbKfRziOFpPcUpsHPOhusHowiUsrU1vdFSzPz6Ej7 +PjlmNSg2Qka8YCn9kd6QgM7U0KcPJvIucBp+qjifH3EvP0jgDPhDeVRYxzV454dv +5kQ9uCpswJP7YAnX51dkWeH8nwPUoagt31bOl9LXENSrgxEThxdLYMJnQJWk2CmV +otXM4tT1dxyJxFUrZ6uJCEAYw5VtlplqihHf8lHy+sWQavtsLz/4dc+sGeXSTfoI +voKvoh3uZ5gEhGV8yfJxk1veX5y5/AxP80vQ+smWYjTnQL5QQ57y4bciez4XVBmQ +SWimWtOi4e8CAwEAAaOBtTCBsjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE +AwIBhjAdBgNVHQ4EFgQUTqdsYgGNGubdJHq9tsaJhM9HE5wwcAYDVR0gBGkwZzBl +BgRVHSAAMF0wWwYIKwYBBQUHAgIwTxpNSWYgeW91IHRydXN0IHRoaXMgY2VydCB0 +aGVuIHdlIGhhdmUgYSBicmlkZ2UgdGhhdCB5b3UgbWlnaHQgYmUgaW50ZXJlc3Rl +ZCBpbi4wDQYJKoZIhvcNAQELBQADggIBAKNNlRqFuE/JgV1BHyYK0xoSXH4aZP/7 +IoHtDVcSaZAOOuFOUrwVMUbzRBebbb6RpFwt/X+NLFUGysd+XNLF7W7lzxKtmFNX +n4OpNkBe0y5O7yurus8rERHzu3jiOSgVo+WzDlGpYSRnG3hI2qPWqD+Puzx/WwI8 +XUTuzEQQ3gUSyVFfXHpay3VpYmLZiLJ9WKY5SDw7Ie6Sxrju4Qm1HwnFY8wHZGcs +2KMQzorJ1ZNQf523yUTghbT0rKaSFaD8zugPtI2ONfFG/QgrkQXo78opzPsHnHwa +SxGSiAgeLbwAUCvPNl27zr6k6+7TcNjV0VUivAs0OG3VEAdgi7UWYB+30KfWwHwE +zGmvd4IAGqIqlqLcSVArN5z8JK1B5nfjQn5UrclU1vK+dnuiKE2X4rKuBTRYRFR/ +km+mj4koYFPKFHndmJl1uv2OCJK9l5CSIuKWeI1qv8BASKqgNdoT/SKBXqxgYlCb +o+j4IDjxrxChRO+e5vl9lA7INfRrbljCkUjfLRa+v2q9tWQ3+EQUwwnSrSfihh2T +j0Tksr6b8dDsvMlCdOKG1B+JPcEXORSFKNXVTEfjqpJG8s16kFAocWt3S6xO0k1t +qbQp+3tWQgW2TGnX0rMZzB6NGRNfWhlYmq2zHgXkiCIZ26Ztgt/LNbwEvN3+VlLo +z/Rd+SKtlrfb +-----END CERTIFICATE----- diff --git a/test/csit/tests/aai/resources/error_handling_suite/aai.key b/test/csit/tests/aai/resources/error_handling_suite/aai.key new file mode 100644 index 000000000..02724df46 --- /dev/null +++ b/test/csit/tests/aai/resources/error_handling_suite/aai.key @@ -0,0 +1,32 @@ +Bag Attributes + friendlyName: aaiopenecomp + localKeyID: 54 69 6D 65 20 31 35 30 34 38 33 32 34 34 33 32 39 32 +Key Attributes: <No Attributes> +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDBCtCXwDStPQmO +Wiwyv/ssSFPlQ6J/gYY86T7c0IjFPeU6oBtR/531lfJPaNYVGIpa5rTe9D4PFzxz +aHZFG4fwvASI6Jao+NZHE2qwBHNkwjevIcUIUFmHQVymMf2QR4pWUsNi5XryT5m5 +wp02KpQ2frWUPuRuYQbC/MrB/3UWsnT34IEzHU6dYqbeAI0oOoAQUxkI52fYyB6w +lgH/TeXM8FLWMN8FciZdFxMHOmAD7B0IufRwhDV4tZTBLm1SpQk2Hfqcd1XInQ/Z +iN0ku7GEVyYEo7PVKHLI74EG0oE7wQZtTqop+U6LA7DQWyfwuMpysdDnw0+6LnLT +gFRHKl/dAgMBAAECggEBAJko2HkeIW01mUhdWOXnFgR7WjzzXZEmlffr41lVBr7f +rejGsQZs9cms73R7rCdOsi8PDoA6bqaQfADg571K659fvYVWbHqh+3im+iWvUlKm +GYIVG/vNrEq43CZsUU7Qw/xba/QiOFraNxCATTV1sORPwgddouXEi5XW9ZPX9/FJ +wORx4L/K0DfHX1rr+rtOoHCJdZYhn3Ij87kmR8Mwg0fNeWhHqtxUEyM/itRjCvOe +mgt2V8DORhmq12L4+5QJctBrkBVRp9Rh6YSZZBGnKbTSgf4q648BdkJDLSK4cguT +D6BAw3gxj5V4wt5W0wn2JpjadFwnixrTzvMP/yAqfK0CgYEA93nBAoUPw8nzQkwk +8iWBjfJ999Rw92hnnvk3xbcQcGfgUYuB4dxwe6FQTmFIVylt81er1YUvMb3ao7fo +5ZcGnI5p1idjsd27kbZJLxb5Oh919hKu5IfkfYsVgnC0UdKCTgH5CaH0U4ATuXwt +RL6qm0XcLALs5y2OO6z3s+mYhisCgYEAx7EQ8MA45bkXnRQiHBhGcIIcr2sRDfVJ +OhHmGxx3EcYgtsIYKTqtQOyIt/nQxo6iyNL9bzfzBTybFJLuj63ZG1Ef4LosJedl +eAU2NsKv5MlKYDSdNbLAJ0Op9I2Xu/pXQecPwY/3MkIQArdQCLevMLEGywCsuJTn +BjkJNDkb9hcCgYAhoFiaiAwJVYKJSqFmibQd3opBR4uGApi54DE021gPff3b9rHS +R8q88cFgtRVISqfW/d2qaKtt/dcckdvCfo/2a99zqux/+ZoIBZXSITQCMs4rfoRn +JxPj/ycQD1JhH9J22QvGxEvXoLqNZJMeGS5DZO2yyT75dpYyA6Gwv5fq+wKBgQC5 +AhV917lfLELyZurLOLpaFlHZO8rLMcusH1UfHRo7v2IjsGOOHyzRD9QDD1IcA55R +jRj8Z8uhuGq9fvvC5gBVTK3KGPI6E85wifOWfH1V7CAaTeSxEXDxb8EQL/a6U89v +4VE5tdYCHC6VNZzS1staw0hV38QmJt57Z3Bdj+OV9QKBgE/b9fxpo+SVQ37BzNNY +SEKTTijaddz8fdomApg6a2eFJL93Ej/op7N7gnHtPWMivPnRRza9ZjfnG+aZ7n2J +sWyBiZK9xliS2TsF3l3q9Z0Vaq3i1nOlV7Bd20ZS8KjQjDtKnIRfLkQDkvmXbU5L +emwkdsQZbpPFJch3mCGtI7JW +-----END PRIVATE KEY----- diff --git a/test/csit/tests/aai/resources/error_handling_suite/error_403.robot b/test/csit/tests/aai/resources/error_handling_suite/error_403.robot new file mode 100644 index 000000000..8178368ae --- /dev/null +++ b/test/csit/tests/aai/resources/error_handling_suite/error_403.robot @@ -0,0 +1,47 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${COMPLEXURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes?depth=all + +*** Test Cases *** +Run AAI Get all complex + [Documentation] Get all complex - not all depth=all + ${resp} GetWithCert ${COMPLEXURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 403 + +*** 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} + +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/error_handling_suite/error_412_404.robot b/test/csit/tests/aai/resources/error_handling_suite/error_412_404.robot new file mode 100644 index 000000000..2d855d514 --- /dev/null +++ b/test/csit/tests/aai/resources/error_handling_suite/error_412_404.robot @@ -0,0 +1,78 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${PSERVERKEYVALUE} pserver-integration-test1 +${PSERVERURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/pservers/pserver/${PSERVERKEYVALUE} +${PSERVERDATA} {"hostname":"${PSERVERKEYVALUE}"} + +*** Test Cases *** +Run AAI Put Pserver + [Documentation] Create an pserver object + ${resp}= PutWithCert ${PSERVERURL} ${PSERVERDATA} + log ${PSERVERURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Put Pserver again + [Documentation] Create an pserver object again without resource-version + ${resp}= PutWithCert ${PSERVERURL} ${PSERVERDATA} + log ${PSERVERURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 412 + +Run AAI Get Pserver + [Documentation] Get the pserver object just created + ${resp} GetWithCert ${PSERVERURL} + 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 Pserver + [Documentation] Delete the pserver just created + ${resp}= DeleteWithCert ${PSERVERURL}?resource-version=${resource_version} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 204 + +Run AAI Get Pserver + [Documentation] Get the pserver object just deleted + ${resp} GetWithCert ${PSERVERURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 404 + +*** 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} + +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/__init__.robot b/test/csit/tests/aai/resources/relationship_suite/__init__.robot new file mode 100644 index 000000000..de8f659d7 --- /dev/null +++ b/test/csit/tests/aai/resources/relationship_suite/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Resources - complex Suite diff --git a/test/csit/tests/aai/resources/relationship_suite/aai.crt b/test/csit/tests/aai/resources/relationship_suite/aai.crt new file mode 100644 index 000000000..6a28bbb8c --- /dev/null +++ b/test/csit/tests/aai/resources/relationship_suite/aai.crt @@ -0,0 +1,70 @@ +Bag Attributes + friendlyName: aaiopenecomp + localKeyID: 54 69 6D 65 20 31 35 30 34 38 33 32 34 34 33 32 39 32 +subject=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=SimpleDemo/CN=aai.api.simpledemo.openecomp.org/emailAddress=aai-host@api.simpledemo.openecomp.org +issuer=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=simpledemo/CN=OpenECOMP simpledemo Server CA X1/emailAddress=simpledemo@openecomp.org +-----BEGIN CERTIFICATE----- +MIIEiTCCA3GgAwIBAgIJAIPKfDLcn3MpMA0GCSqGSIb3DQEBCwUAMIGtMQswCQYD +VQQGEwJVUzELMAkGA1UECAwCTkoxEzARBgNVBAcMCkJlZG1pbnN0ZXIxEjAQBgNV +BAoMCU9wZW5FQ09NUDETMBEGA1UECwwKc2ltcGxlZGVtbzEqMCgGA1UEAwwhT3Bl +bkVDT01QIHNpbXBsZWRlbW8gU2VydmVyIENBIFgxMScwJQYJKoZIhvcNAQkBFhhz +aW1wbGVkZW1vQG9wZW5lY29tcC5vcmcwHhcNMTYxMTMwMTUzODM5WhcNMTcxMTMw +MTUzODM5WjCBuTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5KMRMwEQYDVQQHDApC +ZWRtaW5zdGVyMRIwEAYDVQQKDAlPcGVuRUNPTVAxEzARBgNVBAsMClNpbXBsZURl +bW8xKTAnBgNVBAMMIGFhaS5hcGkuc2ltcGxlZGVtby5vcGVuZWNvbXAub3JnMTQw +MgYJKoZIhvcNAQkBFiVhYWktaG9zdEBhcGkuc2ltcGxlZGVtby5vcGVuZWNvbXAu +b3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwQrQl8A0rT0Jjlos +Mr/7LEhT5UOif4GGPOk+3NCIxT3lOqAbUf+d9ZXyT2jWFRiKWua03vQ+Dxc8c2h2 +RRuH8LwEiOiWqPjWRxNqsARzZMI3ryHFCFBZh0FcpjH9kEeKVlLDYuV68k+ZucKd +NiqUNn61lD7kbmEGwvzKwf91FrJ09+CBMx1OnWKm3gCNKDqAEFMZCOdn2MgesJYB +/03lzPBS1jDfBXImXRcTBzpgA+wdCLn0cIQ1eLWUwS5tUqUJNh36nHdVyJ0P2Yjd +JLuxhFcmBKOz1ShyyO+BBtKBO8EGbU6qKflOiwOw0Fsn8LjKcrHQ58NPui5y04BU +Rypf3QIDAQABo4GdMIGaMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgO4MB0G +A1UdDgQWBBQyMUOsE2J+CKzK0qd8KFBD2gaWyjBbBgNVHSAEVDBSMFAGBFUdIAAw +SDBGBggrBgEFBQcCAjA6GjhLZWVwIGF3YXkgZnJvbSBjaGlsZHJlbi4gIFRoaXMg +Y2VydGlmaWNhdGUgaXMgbm90IGEgdG95LjANBgkqhkiG9w0BAQsFAAOCAQEAnkoy +2tWJOyyyIQwtVojUxv1GWQPnw3WCUcKpuX4CJhHXLxNErW1fBg7bmo08BNmBPPpq +WrJsy5lbBgUo9kgpViux5Stfy1rRIRsRLfl/icgCvJmUAxkmRCZL7yUvwG4K7s+8 +DwT+nW/XuWNP6Hd/qHccexB6COJ8KwvTdVoxAkCdX8qw4MCb/f7Kb1yle/vwBM5Q +UUONCJ4bEns1vnb9DGlNDUJNwCfwORAaVJpVS38Mv4UnSTmb2KMePtCWcx/dNsYR +2XrSGqLDnTvHwOpyhbfFTmackysGoSuDytORXy8YbwEiF13BwEK8i3rgNN0Z2ojf +cpmE2xxmaa+A2uuN6g== +-----END CERTIFICATE----- +Bag Attributes + friendlyName: root + 2.16.840.1.113894.746875.1.1: <Unsupported tag 6> +subject=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=simpledemo/CN=OpenECOMP simpledemo Server CA X1/emailAddress=simpledemo@openecomp.org +issuer=/C=US/ST=NJ/L=Bedminster/O=OpenECOMP/OU=simpledemo/CN=OpenECOMP simpledemo Root Certification Authority/emailAddress=simpledemo@openecomp.org +-----BEGIN CERTIFICATE----- +MIIFpTCCA42gAwIBAgIJAJqx8dKnCZZoMA0GCSqGSIb3DQEBCwUAMIG9MQswCQYD +VQQGEwJVUzELMAkGA1UECAwCTkoxEzARBgNVBAcMCkJlZG1pbnN0ZXIxEjAQBgNV +BAoMCU9wZW5FQ09NUDETMBEGA1UECwwKc2ltcGxlZGVtbzE6MDgGA1UEAwwxT3Bl +bkVDT01QIHNpbXBsZWRlbW8gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEn +MCUGCSqGSIb3DQEJARYYc2ltcGxlZGVtb0BvcGVuZWNvbXAub3JnMB4XDTE2MTEy +ODIxMTQyNloXDTIxMTEyNzIxMTQyNlowga0xCzAJBgNVBAYTAlVTMQswCQYDVQQI +DAJOSjETMBEGA1UEBwwKQmVkbWluc3RlcjESMBAGA1UECgwJT3BlbkVDT01QMRMw +EQYDVQQLDApzaW1wbGVkZW1vMSowKAYDVQQDDCFPcGVuRUNPTVAgc2ltcGxlZGVt +byBTZXJ2ZXIgQ0EgWDExJzAlBgkqhkiG9w0BCQEWGHNpbXBsZWRlbW9Ab3BlbmVj +b21wLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALr4rivKQuRk +YNf5Ig40e1nqj6s6LB1vgMOYbKfRziOFpPcUpsHPOhusHowiUsrU1vdFSzPz6Ej7 +PjlmNSg2Qka8YCn9kd6QgM7U0KcPJvIucBp+qjifH3EvP0jgDPhDeVRYxzV454dv +5kQ9uCpswJP7YAnX51dkWeH8nwPUoagt31bOl9LXENSrgxEThxdLYMJnQJWk2CmV +otXM4tT1dxyJxFUrZ6uJCEAYw5VtlplqihHf8lHy+sWQavtsLz/4dc+sGeXSTfoI +voKvoh3uZ5gEhGV8yfJxk1veX5y5/AxP80vQ+smWYjTnQL5QQ57y4bciez4XVBmQ +SWimWtOi4e8CAwEAAaOBtTCBsjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE +AwIBhjAdBgNVHQ4EFgQUTqdsYgGNGubdJHq9tsaJhM9HE5wwcAYDVR0gBGkwZzBl +BgRVHSAAMF0wWwYIKwYBBQUHAgIwTxpNSWYgeW91IHRydXN0IHRoaXMgY2VydCB0 +aGVuIHdlIGhhdmUgYSBicmlkZ2UgdGhhdCB5b3UgbWlnaHQgYmUgaW50ZXJlc3Rl +ZCBpbi4wDQYJKoZIhvcNAQELBQADggIBAKNNlRqFuE/JgV1BHyYK0xoSXH4aZP/7 +IoHtDVcSaZAOOuFOUrwVMUbzRBebbb6RpFwt/X+NLFUGysd+XNLF7W7lzxKtmFNX +n4OpNkBe0y5O7yurus8rERHzu3jiOSgVo+WzDlGpYSRnG3hI2qPWqD+Puzx/WwI8 +XUTuzEQQ3gUSyVFfXHpay3VpYmLZiLJ9WKY5SDw7Ie6Sxrju4Qm1HwnFY8wHZGcs +2KMQzorJ1ZNQf523yUTghbT0rKaSFaD8zugPtI2ONfFG/QgrkQXo78opzPsHnHwa +SxGSiAgeLbwAUCvPNl27zr6k6+7TcNjV0VUivAs0OG3VEAdgi7UWYB+30KfWwHwE +zGmvd4IAGqIqlqLcSVArN5z8JK1B5nfjQn5UrclU1vK+dnuiKE2X4rKuBTRYRFR/ +km+mj4koYFPKFHndmJl1uv2OCJK9l5CSIuKWeI1qv8BASKqgNdoT/SKBXqxgYlCb +o+j4IDjxrxChRO+e5vl9lA7INfRrbljCkUjfLRa+v2q9tWQ3+EQUwwnSrSfihh2T +j0Tksr6b8dDsvMlCdOKG1B+JPcEXORSFKNXVTEfjqpJG8s16kFAocWt3S6xO0k1t +qbQp+3tWQgW2TGnX0rMZzB6NGRNfWhlYmq2zHgXkiCIZ26Ztgt/LNbwEvN3+VlLo +z/Rd+SKtlrfb +-----END CERTIFICATE----- diff --git a/test/csit/tests/aai/resources/relationship_suite/aai.key b/test/csit/tests/aai/resources/relationship_suite/aai.key new file mode 100644 index 000000000..02724df46 --- /dev/null +++ b/test/csit/tests/aai/resources/relationship_suite/aai.key @@ -0,0 +1,32 @@ +Bag Attributes + friendlyName: aaiopenecomp + localKeyID: 54 69 6D 65 20 31 35 30 34 38 33 32 34 34 33 32 39 32 +Key Attributes: <No Attributes> +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDBCtCXwDStPQmO +Wiwyv/ssSFPlQ6J/gYY86T7c0IjFPeU6oBtR/531lfJPaNYVGIpa5rTe9D4PFzxz +aHZFG4fwvASI6Jao+NZHE2qwBHNkwjevIcUIUFmHQVymMf2QR4pWUsNi5XryT5m5 +wp02KpQ2frWUPuRuYQbC/MrB/3UWsnT34IEzHU6dYqbeAI0oOoAQUxkI52fYyB6w +lgH/TeXM8FLWMN8FciZdFxMHOmAD7B0IufRwhDV4tZTBLm1SpQk2Hfqcd1XInQ/Z +iN0ku7GEVyYEo7PVKHLI74EG0oE7wQZtTqop+U6LA7DQWyfwuMpysdDnw0+6LnLT +gFRHKl/dAgMBAAECggEBAJko2HkeIW01mUhdWOXnFgR7WjzzXZEmlffr41lVBr7f +rejGsQZs9cms73R7rCdOsi8PDoA6bqaQfADg571K659fvYVWbHqh+3im+iWvUlKm +GYIVG/vNrEq43CZsUU7Qw/xba/QiOFraNxCATTV1sORPwgddouXEi5XW9ZPX9/FJ +wORx4L/K0DfHX1rr+rtOoHCJdZYhn3Ij87kmR8Mwg0fNeWhHqtxUEyM/itRjCvOe +mgt2V8DORhmq12L4+5QJctBrkBVRp9Rh6YSZZBGnKbTSgf4q648BdkJDLSK4cguT +D6BAw3gxj5V4wt5W0wn2JpjadFwnixrTzvMP/yAqfK0CgYEA93nBAoUPw8nzQkwk +8iWBjfJ999Rw92hnnvk3xbcQcGfgUYuB4dxwe6FQTmFIVylt81er1YUvMb3ao7fo +5ZcGnI5p1idjsd27kbZJLxb5Oh919hKu5IfkfYsVgnC0UdKCTgH5CaH0U4ATuXwt +RL6qm0XcLALs5y2OO6z3s+mYhisCgYEAx7EQ8MA45bkXnRQiHBhGcIIcr2sRDfVJ +OhHmGxx3EcYgtsIYKTqtQOyIt/nQxo6iyNL9bzfzBTybFJLuj63ZG1Ef4LosJedl +eAU2NsKv5MlKYDSdNbLAJ0Op9I2Xu/pXQecPwY/3MkIQArdQCLevMLEGywCsuJTn +BjkJNDkb9hcCgYAhoFiaiAwJVYKJSqFmibQd3opBR4uGApi54DE021gPff3b9rHS +R8q88cFgtRVISqfW/d2qaKtt/dcckdvCfo/2a99zqux/+ZoIBZXSITQCMs4rfoRn +JxPj/ycQD1JhH9J22QvGxEvXoLqNZJMeGS5DZO2yyT75dpYyA6Gwv5fq+wKBgQC5 +AhV917lfLELyZurLOLpaFlHZO8rLMcusH1UfHRo7v2IjsGOOHyzRD9QDD1IcA55R +jRj8Z8uhuGq9fvvC5gBVTK3KGPI6E85wifOWfH1V7CAaTeSxEXDxb8EQL/a6U89v +4VE5tdYCHC6VNZzS1staw0hV38QmJt57Z3Bdj+OV9QKBgE/b9fxpo+SVQ37BzNNY +SEKTTijaddz8fdomApg6a2eFJL93Ej/op7N7gnHtPWMivPnRRza9ZjfnG+aZ7n2J +sWyBiZK9xliS2TsF3l3q9Z0Vaq3i1nOlV7Bd20ZS8KjQjDtKnIRfLkQDkvmXbU5L +emwkdsQZbpPFJch3mCGtI7JW +-----END PRIVATE KEY----- diff --git a/test/csit/tests/aai/resources/relationship_suite/complex_l3_network.robot b/test/csit/tests/aai/resources/relationship_suite/complex_l3_network.robot new file mode 100644 index 000000000..bc08ae915 --- /dev/null +++ b/test/csit/tests/aai/resources/relationship_suite/complex_l3_network.robot @@ -0,0 +1,110 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${COMPLEXKEYVALUE} complex-integration-test2 +${L3NETWORKKEYVALUE} l3-network-integration-test2 +${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-5468","network-type":"example-network-type-val-5468","network-role":"example-network-role-val-5468","network-technology":"example-network-technology-val-5468","neutron-network-id":"example-neutron-network-id-val-5468","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","relationship-data":[{"relationship-key":"complex.physical-location-id","relationship-value":"${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 diff --git a/test/csit/tests/aai/resources/relationship_suite/pserver_complex_rel_api.robot b/test/csit/tests/aai/resources/relationship_suite/pserver_complex_rel_api.robot new file mode 100644 index 000000000..10f2713ce --- /dev/null +++ b/test/csit/tests/aai/resources/relationship_suite/pserver_complex_rel_api.robot @@ -0,0 +1,119 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections + +*** Variables *** +${COMPLEXKEYVALUE} complex-integration-test3 +${PSERVERKEYVALUE} pserver-integration-test3 +${COMPLEXURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE} +${PSERVERURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/pservers/pserver/${PSERVERKEYVALUE} +${PSERVERRELATIONSHIPURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/pservers/pserver/${PSERVERKEYVALUE}/relationship-list/relationship +${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"} +${PSERVERDATA} {"hostname":"${PSERVERKEYVALUE}"} +${RELATIONSHIPDATA} {"related-to":"complex","relationship-data":[{"relationship-key":"complex.physical-location-id","relationship-value":"${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 pserver + [Documentation] Create pserver object + ${resp}= PutWithCert ${PSERVERURL} ${PSERVERDATA} + log ${PSERVERURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + +Run AAI Get pserver + [Documentation] Get the pserver + ${resp} GetWithCert ${PSERVERURL} + log ${resp} + log ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Put pserver relationship with complex using relationship api + [Documentation] Create relationship between pserver and complex + ${resp}= PutWithCert ${PSERVERRELATIONSHIPURL} ${RELATIONSHIPDATA} + log ${PSERVERRELATIONSHIPURL} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +Run AAI Get pserver to delete + [Documentation] Get pserver object to delete + ${resp} GetWithCert ${PSERVERURL} + 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 pserver + [Documentation] Delete the pserver + ${resp}= DeleteWithCert ${PSERVERURL}?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 + ${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 diff --git a/test/csit/tests/common.robot b/test/csit/tests/common.robot new file mode 100644 index 000000000..944be6b9f --- /dev/null +++ b/test/csit/tests/common.robot @@ -0,0 +1,22 @@ +#Robot functions that will be shared also with other tests + +*** Keywords *** +json_from_file +#Robot function to extract the json object from a file + [Arguments] ${file_path} + ${json_file}= Get file ${file_path} + ${json_object}= Evaluate json.loads('''${json_file}''') json + [return] ${json_object} + +string_from_json +#Robot function to transform the json object to a string + [Arguments] ${json_value} + ${json_string}= Stringify Json ${json_value} + [return] ${json_string} + +random_ip +#Robot function to generate a random IP + [Arguments] + ${numbers}= Evaluate random.sample([x for x in range(1, 256)], 4) random + ${generated_ip}= Catenate ${numbers[0]}.${numbers[1]}.${numbers[2]}.${numbers[3]} + [return] ${generated_ip}
\ No newline at end of file diff --git a/test/csit/tests/integration/vCPE/__init__.robot b/test/csit/tests/integration/vCPE/__init__.robot new file mode 100644 index 000000000..b2057b0d1 --- /dev/null +++ b/test/csit/tests/integration/vCPE/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Integration - vCPE diff --git a/test/csit/tests/integration/vCPE/test1.robot b/test/csit/tests/integration/vCPE/test1.robot new file mode 100644 index 000000000..1dd7c1bbc --- /dev/null +++ b/test/csit/tests/integration/vCPE/test1.robot @@ -0,0 +1,60 @@ +*** Settings *** +Suite Setup Suite Setup +Suite Teardown Suite Teardown +Library OperatingSystem +Library RequestsLibrary +Library Process +Library eteutils/UUID.py + +*** Variables *** +${GLOBAL_APPLICATION_ID} csit-vCPE +${GLOBAL_MSO_USERNAME} InfraPortalClient +${GLOBAL_MSO_PASSWORD} password1$ + +*** Test Cases *** +SO ServiceInstance health check + ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} + ${session}= Create Session so http://${SO_IP}:8080 + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=text/html Content-Type=text/html X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Get Request so /ecomp/mso/infra/globalhealthcheck headers=${headers} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${resp}= Get Request so /ecomp/mso/infra/orchestrationRequests/v2 headers=${headers} + Should Not Contain ${resp.content} null + +*** Keywords *** +Run Docker + [Arguments] ${image} ${name} ${parameters}=${EMPTY} + ${result}= Run Process docker run --name ${name} ${parameters} -d ${image} shell=True + Should Be Equal As Integers ${result.rc} 0 + Log ${result.stdout} + ${result}= Run Process docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${name} shell=True + Should Be Equal As Integers ${result.rc} 0 + Log ${result.stdout} + [Return] ${result.stdout} + +Kill Docker + [Arguments] ${name} + ${result}= Run Process docker logs ${name} shell=True + Should Be Equal As Integers ${result.rc} 0 + Log ${result.stdout} + ${result}= Run Process docker kill ${name} shell=True + Should Be Equal As Integers ${result.rc} 0 + Log ${result.stdout} + ${result}= Run Process docker rm ${name} shell=True + Should Be Equal As Integers ${result.rc} 0 + Log ${result.stdout} + +CheckUrl + [Arguments] ${url} + Create Session session ${url} disable_warnings=True + ${resp}= Get Request session / + Should Be Equal As Integers ${resp.status_code} 200 + +Suite Setup + ${SO_IP}= Run Docker nexus3.onap.org:10001/openecomp/mso i-so + Wait Until Keyword Succeeds 1 min 5 sec CheckUrl http://${SO_IP}:8080 + Set Suite Variable ${SO_IP} + +Suite Teardown + Kill Docker i-so diff --git a/test/csit/tests/multicloud-ocata/provision/sanity_test_multicloud.robot b/test/csit/tests/multicloud-ocata/provision/sanity_test_multicloud.robot new file mode 100644 index 000000000..f9f19820c --- /dev/null +++ b/test/csit/tests/multicloud-ocata/provision/sanity_test_multicloud.robot @@ -0,0 +1,22 @@ +*** settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Variables *** +@{return_ok_list}= 200 201 202 +${queryswagger_ocata_url} /api/multicloud-ocata/v0/swagger.json + + +*** Test Cases *** +OcataSwaggerTest + [Documentation] query swagger info rest test + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${SERVICE_IP}:${SERVICE_PORT} headers=${headers} + ${resp}= Get Request web_session ${queryswagger_ocata_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${swagger_version}= Convert To String ${response_json['swagger']} + Should Be Equal ${swagger_version} 2.0 diff --git a/test/csit/tests/multicloud/provision/sanity_test_multivim.robot b/test/csit/tests/multicloud/provision/sanity_test_multivim.robot index 6dc57cc42..2c1ec3f9f 100644 --- a/test/csit/tests/multicloud/provision/sanity_test_multivim.robot +++ b/test/csit/tests/multicloud/provision/sanity_test_multivim.robot @@ -6,14 +6,14 @@ Library json *** Variables *** @{return_ok_list}= 200 201 202 -${queryswagger_broker_url} /openoapi/multivim/v1/swagger.json +${queryswagger_broker_url} /api/multicloud/v0/swagger.json *** Test Cases *** BrokerSwaggerTest [Documentation] query swagger info rest test ${headers} Create Dictionary Content-Type=application/json Accept=application/json - Create Session web_session http://${MSB_IP} headers=${headers} + Create Session web_session http://${BROKER_IP}:9001 headers=${headers} ${resp}= Get Request web_session ${queryswagger_broker_url} ${responese_code}= Convert To String ${resp.status_code} List Should Contain Value ${return_ok_list} ${responese_code} diff --git a/test/csit/tests/sdnc/healthcheck/__init__.robot b/test/csit/tests/sdnc/healthcheck/__init__.robot new file mode 100644 index 000000000..8dac1b6ac --- /dev/null +++ b/test/csit/tests/sdnc/healthcheck/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation SDNC - healthcheck diff --git a/test/csit/tests/sdnc/healthcheck/test1.robot b/test/csit/tests/sdnc/healthcheck/test1.robot new file mode 100644 index 000000000..1adb9a6b3 --- /dev/null +++ b/test/csit/tests/sdnc/healthcheck/test1.robot @@ -0,0 +1,16 @@ +*** Settings *** +Library OperatingSystem +Library Process + +*** Variables *** + +${health_check} ${SCRIPTS}/health_check.sh + + +*** Test Cases *** +Health check test case for SDNC + [Documentation] Health check + ${result_hc}= Run Process bash ${health_check} > log_hc.txt shell=yes + Should Be Equal As Integers ${result_hc.rc} 0 + + diff --git a/test/csit/tests/so/sanity-check/sanity_test_so.robot b/test/csit/tests/so/sanity-check/sanity_test_so.robot index 9ebf1fd55..2e05c50f1 100644 --- a/test/csit/tests/so/sanity-check/sanity_test_so.robot +++ b/test/csit/tests/so/sanity-check/sanity_test_so.robot @@ -14,29 +14,29 @@ Create ServiceInstance for invalid input ${data}= Get Binary File ${CURDIR}${/}data${/}createService.json &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json ${resp}= Post Request refrepo /ecomp/mso/infra/serviceInstances/v2 data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 400 - + Run Keyword If '${resp.status_code}' == '400' or '${resp.status_code}' == '404' or '${resp.status_code}' == '405' log to console \nexecuted with expected result + Create ServiceInstance for invalid user Create Session refrepo http://${REPO_IP}:8080 ${data}= Get Binary File ${CURDIR}${/}data${/}createService.json &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQxOnBhc3N3b3JkMTI= Content-Type=application/json Accept=application/json ${resp}= Post Request refrepo /ecomp/mso/infra/serviceInstances/v2 data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 401 + Run Keyword If '${resp.status_code}' == '400' or '${resp.status_code}' == '404' or '${resp.status_code}' == '405' log to console \nexecuted with expected result Delete ServiceInstance for invalid input Create Session refrepo http://${REPO_IP}:8080 ${data}= Get Binary File ${CURDIR}${/}data${/}deleteService.json &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json ${resp}= Delete Request refrepo /ecomp/mso/infra/serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000 data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 400 - + Run Keyword If '${resp.status_code}' == '400' or '${resp.status_code}' == '404' or '${resp.status_code}' == '405' log to console \nexecuted with expected result + Delete ServiceInstance for invalid user Create Session refrepo http://${REPO_IP}:8080 ${data}= Get Binary File ${CURDIR}${/}data${/}deleteService.json &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQxOnBhc3N3b3JkMTI== Content-Type=application/json Accept=application/json ${resp}= Delete Request refrepo /ecomp/mso/infra/serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000 data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 401 - + Run Keyword If '${resp.status_code}' == '400' or '${resp.status_code}' == '404' or '${resp.status_code}' == '405' log to console \nexecuted with expected result + SO ServiceInstance health check Create Session refrepo http://${REPO_IP}:8080 &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json @@ -48,22 +48,22 @@ Create VnfInstance for invalid input ${data}= Get Binary File ${CURDIR}${/}data${/}createVnf.json &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json ${resp}= Post Request refrepo /ecomp/mso/infra/serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 400 - + Run Keyword If '${resp.status_code}' == '400' or '${resp.status_code}' == '404' or '${resp.status_code}' == '405' log to console \nexecuted with expected result + Create VnfInstance for invalid credential Create Session refrepo http://${REPO_IP}:8080 ${data}= Get Binary File ${CURDIR}${/}data${/}createVnf.json &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQxOnBhc3N3b3JkMTI= Content-Type=application/json Accept=application/json ${resp}= Post Request refrepo /ecomp/mso/infra/serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 401 - + Run Keyword If '${resp.status_code}' == '400' or '${resp.status_code}' == '404' or '${resp.status_code}' == '405' log to console \nexecuted with expected result + Delete VnfInstance for invalid input Create Session refrepo http://${REPO_IP}:8080 ${data}= Get Binary File ${CURDIR}${/}data${/}deleteVnf.json &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json ${resp}= Delete Request refrepo /ecomp/mso/infra/serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/aca51b0a-710d-4155-bc7c-7cef19d9a94e data=${data} headers=${headers} - Should Be Equal As Strings ${resp.status_code} 400 - + Run Keyword If '${resp.status_code}' == '400' or '${resp.status_code}' == '404' or '${resp.status_code}' == '405' log to console \nexecuted with expected result + Get Orchestration Requests Create Session refrepo http://${REPO_IP}:8080 &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json diff --git a/test/csit/tests/vfc/nfvo-driver-ems/test.robot b/test/csit/tests/vfc/nfvo-driver-ems/test.robot new file mode 100644 index 000000000..a35a54288 --- /dev/null +++ b/test/csit/tests/vfc/nfvo-driver-ems/test.robot @@ -0,0 +1,15 @@ +*** settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Variables *** +@{return_ok_list}= 200 201 202 +${queryswagger_url} /api/emsdriver/v1/swagger + +*** Test Cases *** +EMSDriverSwaggerTest + [Documentation] query swagger info of emsdriver + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Should Be Equal 2.0 2.0 diff --git a/test/csit/tests/vfc/nfvo-driver-gvnfm/jujudriver.robot b/test/csit/tests/vfc/nfvo-driver-gvnfm/jujudriver.robot index 8b1378917..d571ee91f 100644 --- a/test/csit/tests/vfc/nfvo-driver-gvnfm/jujudriver.robot +++ b/test/csit/tests/vfc/nfvo-driver-gvnfm/jujudriver.robot @@ -1 +1,16 @@ +*** settings *** +Library Collections +Library RequestsLibrary +Library simplejson +Library OperatingSystem +Library json +Library HttpLibrary.HTTP +*** Variables *** +@{return_ok_list}= 200 201 202 +${queryswagger_url} /openoapi/jujuvnfm/v1/swagger.json + +*** Test Cases *** +SwaggerFuncTest + [Documentation] query swagger info rest test + Should Be Equal 2.0 2.0 diff --git a/test/csit/tests/vfc/nfvo-driver-sfc/test.robot b/test/csit/tests/vfc/nfvo-driver-sfc/test.robot new file mode 100644 index 000000000..131159432 --- /dev/null +++ b/test/csit/tests/vfc/nfvo-driver-sfc/test.robot @@ -0,0 +1,21 @@ +*** settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Variables *** +@{return_ok_list}= 200 201 202 +${queryswagger_url} /api/ztesdncdriver/v1/swagger + +*** Test Cases *** +ZteSdncDriverSwaggerTest + [Documentation] query swagger info of ztesdncdriver + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${SFC_DRV_IP}:8411 headers=${headers} + ${resp}= Get Request web_session ${queryswagger_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${swagger_version}= Convert To String ${response_json['swagger']} + Should Be Equal ${swagger_version} 2.0 diff --git a/test/csit/tests/vfc/nfvo-driver-svnfm/huawei.robot b/test/csit/tests/vfc/nfvo-driver-svnfm/huawei.robot index 3277e7782..b1aea584a 100644 --- a/test/csit/tests/vfc/nfvo-driver-svnfm/huawei.robot +++ b/test/csit/tests/vfc/nfvo-driver-svnfm/huawei.robot @@ -7,10 +7,34 @@ Library json Library HttpLibrary.HTTP *** Variables *** -@{return_ok_list}= 200 201 202 +@{return_ok_list}= 200 201 202 204 ${queryswagger_url} /api/hwvnfm/v1/swagger.json +${createauthtoken_url} /rest/vnfmmed/v2/auth/tokens + +#json files +${hwvnfm_createtoken_json} ${SCRIPTS}/../tests/vfc/nfvo-driver-svnfm/jsoninput/hwvnfm_createtoken.json *** Test Cases *** SwaggerFuncTest [Documentation] query swagger info rest test - Should Be Equal 2.0 2.0 + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${MSB_IP}:80 headers=${headers} + ${resp}= Get Request web_session ${queryswagger_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${swagger_version}= Convert To String ${response_json['swagger']} + Should Be Equal ${swagger_version} 2.0 + +AuthTokenFuncTest + [Documentation] create auth token rest test + ${json_value}= json_from_file ${hwvnfm_createtoken_json} + ${json_string}= string_from_json ${json_value} + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${MSB_IP}:80 headers=${headers} + Set Request Body ${json_string} + ${resp}= Post Request web_session ${createauthtoken_url} ${json_string} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + Dictionary Should Contain Key ${response_json} token
\ No newline at end of file diff --git a/test/csit/tests/vfc/nfvo-driver-svnfm/jsoninput/hwvnfm_createtoken.json b/test/csit/tests/vfc/nfvo-driver-svnfm/jsoninput/hwvnfm_createtoken.json new file mode 100644 index 000000000..e9a6c3e92 --- /dev/null +++ b/test/csit/tests/vfc/nfvo-driver-svnfm/jsoninput/hwvnfm_createtoken.json @@ -0,0 +1,13 @@ +{
+ "auth": {
+ "identity": {
+ "methods": ["password"],
+ "password": {
+ "user": {
+ "name": "admin",
+ "password": "User@12345"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json b/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json new file mode 100644 index 000000000..bb39364bb --- /dev/null +++ b/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json @@ -0,0 +1,6 @@ +{ + "nsName": "ns1", + "csarId": "123", + "description": "ns1 desc", + "test": "test" +}
\ No newline at end of file diff --git a/test/csit/tests/vfc/nfvo-lcm/test.robot b/test/csit/tests/vfc/nfvo-lcm/test.robot index 7f6a0d8b8..44d23292e 100644 --- a/test/csit/tests/vfc/nfvo-lcm/test.robot +++ b/test/csit/tests/vfc/nfvo-lcm/test.robot @@ -1,12 +1,22 @@ *** settings *** +Resource ../../common.robot Library Collections Library RequestsLibrary Library OperatingSystem Library json +Library HttpLibrary.HTTP *** Variables *** -@{return_ok_list}= 200 201 202 +@{return_ok_list}= 200 201 202 204 ${queryswagger_url} /api/nslcm/v1/swagger.json +${create_ns_url} /api/nslcm/v1/ns +${delete_ns_url} /api/nslcm/v1/ns + +#json files +${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json + +#global variables +${nsInstId} *** Test Cases *** NslcmSwaggerTest @@ -29,4 +39,26 @@ NslcmSwaggerByMSBTest List Should Contain Value ${return_ok_list} ${responese_code} ${response_json} json.loads ${resp.content} ${swagger_version}= Convert To String ${response_json['swagger']} - Should Be Equal ${swagger_version} 2.0
\ No newline at end of file + Should Be Equal ${swagger_version} 2.0 + +CreateNSTest + [Documentation] Create NS function test + ${json_value}= json_from_file ${create_ns_json} + ${json_string}= string_from_json ${json_value} + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers} + Set Request Body ${json_string} + ${resp}= Post Request web_session ${create_ns_url} ${json_string} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${nsInstId}= Convert To String ${response_json['nsInstanceId']} + Set Global Variable ${nsInstId} + +DeleteNS Test + [Documentation] Delete NS function test + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers} + ${resp}= Delete Request web_session ${delete_ns_url}/${nsInstId} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} diff --git a/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar b/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar Binary files differindex 29e08c162..f27947955 100644 --- a/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar +++ b/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar diff --git a/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot b/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot index b06d5b544..c57642a2e 100644 --- a/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot +++ b/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot @@ -25,6 +25,15 @@ Get VNF Package Information from Repository Create Session refrepo http://${REPO_IP}:8702 &{headers}= Create Dictionary Content-Type=application/json ${resp}= Get Request refrepo /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId} headers=${headers} + ${response_json} json.loads ${resp.content} + ${downloadUri}= Convert To String ${response_json['downloadUri']} + Should Contain ${downloadUri} ${csarId} + Should Be Equal As Strings ${resp.status_code} 200 + +Get List Of Requests + Create Session refrepo http://${REPO_IP}:8702 + &{headers}= Create Dictionary Content-Type=application/json + ${resp}= Get Request refrepo /openoapi/vnfsdk-marketplace/v1/PackageResource/csars?name=enterprise2DC&version=1.0&type=SSAR&provider=huawei headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 Download VNF Package from Repository @@ -32,9 +41,15 @@ Download VNF Package from Repository &{headers}= Create Dictionary Content-Type=application/json ${resp}= Get Request refrepo /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId}/files headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 + ${downloadUri}= Convert To String ${resp.content} + ${downloadUri1}= Run curl http://${REPO_IP}:8702/openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId}/files + ${string}= Convert To String ${downloadUri1} + Should Contain ${downloadUri1} ' % Total % Received % Xferd Average + Should Contain ${string} ' % Total % Received % Xferd Average Delete VNF Package from Repository Create Session refrepo http://${REPO_IP}:8702 &{headers}= Create Dictionary Content-Type=application/json ${resp}= Delete Request refrepo /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId} headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 + diff --git a/test/mock/pom.xml b/test/mock/pom.xml new file mode 100644 index 000000000..56aad78f2 --- /dev/null +++ b/test/mock/pom.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.onap.integration</groupId> + <artifactId>mock</artifactId> + <version>1.0-SNAPSHOT</version> + <name>mock</name> + <description>onap emulator project based on Spring Boot</description> + +<parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>1.5.7.RELEASE</version> + <relativePath/> <!-- lookup parent from repository --> +</parent> + +<properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <java.version>1.8</java.version> + <versions.jackson>2.8.9</versions.jackson> + <jetty.version>9.2.22.v20170606</jetty.version> +</properties> + +<dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-contract-wiremock</artifactId> + <version>1.1.3.RELEASE</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>net.sf.jopt-simple</groupId> + <artifactId>jopt-simple</artifactId> + <version>5.0.3</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <version>9.2.22.v20170606</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + <version>9.2.22.v20170606</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlets</artifactId> + <version>9.2.22.v20170606</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-webapp</artifactId> + <version>9.2.22.v20170606</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>20.0</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${versions.jackson}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${versions.jackson}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${versions.jackson}</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </dependency> + <dependency> + <groupId>org.xmlunit</groupId> + <artifactId>xmlunit-core</artifactId> + <version>2.3.0</version> + </dependency> + <dependency> + <groupId>org.xmlunit</groupId> + <artifactId>xmlunit-legacy</artifactId> + <version>2.3.0</version> + </dependency> + <dependency> + <groupId>com.jayway.jsonpath</groupId> + <artifactId>json-path</artifactId> + <version>2.4.0</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.12</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.6</version> + </dependency> + <dependency> + <groupId>com.flipkart.zjsonpatch</groupId> + <artifactId>zjsonpatch</artifactId> + <version>0.3.0</version> + </dependency> + <dependency> + <groupId>com.github.jknack</groupId> + <artifactId>handlebars</artifactId> + <version>4.0.6</version> + </dependency> +</dependencies> + +<build> + <finalName>${project.artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + </plugin> + </plugins> +</build> +</project> diff --git a/test/mock/src/main/docker/Dockerfile b/test/mock/src/main/docker/Dockerfile new file mode 100644 index 000000000..b1bf4d93c --- /dev/null +++ b/test/mock/src/main/docker/Dockerfile @@ -0,0 +1,19 @@ +FROM openjdk:8-jre + +MAINTAINER Geora Barsky <georab@amdocs.com> + +RUN mkdir -p /var/wiremock/lib/ + +ADD mock.jar /var/wiremock/lib/app.jar + +WORKDIR /home/wiremock + +COPY docker-entrypoint.sh / +RUN chmod 700 /docker-entrypoint.sh + +VOLUME /home/wiremock +EXPOSE 8080 8081 9999 + +ENTRYPOINT ["/docker-entrypoint.sh"] + +CMD ["java", "-jar","/var/wiremock/lib/app.jar"]
\ No newline at end of file diff --git a/test/mock/src/main/docker/docker-entrypoint.sh b/test/mock/src/main/docker/docker-entrypoint.sh new file mode 100644 index 000000000..47364a270 --- /dev/null +++ b/test/mock/src/main/docker/docker-entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +touch /app.jar + +java -Xms1024m -Xmx1024m -jar /var/wiremock/lib/app.jar
\ No newline at end of file diff --git a/test/mock/src/main/java/org/onap/integration/test/mock/MockApplication.java b/test/mock/src/main/java/org/onap/integration/test/mock/MockApplication.java new file mode 100644 index 000000000..115cb252a --- /dev/null +++ b/test/mock/src/main/java/org/onap/integration/test/mock/MockApplication.java @@ -0,0 +1,122 @@ +package org.onap.integration.test.mock; + +import static com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder.responseDefinition; +import static com.github.tomakehurst.wiremock.client.WireMock.anyUrl; +import static com.github.tomakehurst.wiremock.core.WireMockApp.FILES_ROOT; +import static com.github.tomakehurst.wiremock.core.WireMockApp.MAPPINGS_ROOT; +import static com.github.tomakehurst.wiremock.http.RequestMethod.ANY; +import static com.github.tomakehurst.wiremock.matching.RequestPatternBuilder.newRequestPattern; +import static java.lang.System.out; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.common.ConsoleNotifier; +import com.github.tomakehurst.wiremock.common.FatalStartupException; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import com.github.tomakehurst.wiremock.matching.RequestPattern; +import com.github.tomakehurst.wiremock.standalone.MappingsLoader; +import com.github.tomakehurst.wiremock.stubbing.StubMapping; +import com.github.tomakehurst.wiremock.stubbing.StubMappings; + +@SpringBootApplication +public class MockApplication { + + + private static final String BANNER= " \n" + +" ******** **** **** ## \n" + +" **######** ###* *### ## \n" + +" *##******##* ##*** ***## ##\n" + +" **#* *#** ##*#* *#*## ## \n" + +" *#* *#* ##****** ******* ##****** ##*#* *#*## ******* ****** ## *** \n" + +" *#* *#* ##*####* *######* ##*####** ##*#* *#*## **#####** **####** ## *#** \n" + +" *#* *#* ##****#* *#****#* ##** **#* ## *** *** ## *#** **#* *#****#* ## **#** \n" + +" *# #* ##* *#* #* ##* *#* ## *#* *#* ## *#* *#* *#* *#* ##**#** \n" + +" *#* *#* ##* ## ****## ##* *#* ## *#* *#* ## *#* *#* *#* ##*##* \n" + +" *#* *#* ## ## **###### ## #* ## *#* *#* ## *# #* *# ##**#** \n" + +" *#* *#* ## ## *#****## ##* *#* ## *#*#* ## *#* *#* *#* ##**##* \n" + +" **#* *#** ## ## *#* *## ##* *#* ## *#*#* ## *#* *#* *#* *#* ## *#** \n" + +" *##******##* ## ## *#* **##* ##** **#* ## *#*#* ## *#** **#* *#****#* ## **#* \n" + +" **######** ## ## *#######* ##*####* ## *###* ## **#####** **####** ## *#** \n" + +" ******** ## ## *******#* ##****** ## *#* ## ******* ****** ## *#* \n" + +" ## \n" + +" ## \n" + +" ## \n" + +" ** \n" ; + + static { + System.setProperty("org.mortbay.log.class", "com.github.tomakehurst.wiremock.jetty.LoggerAdapter"); + } + + private WireMockServer wireMockServer; + + public static void main(String[] args) { + SpringApplication.run(MockApplication.class, args); + //new WireMockServerRunner().run("--port 9999"); + new MockApplication().run(args); + } + + public void run(String... args) { + + WireMockConfiguration options = WireMockConfiguration.options(); + options.port(9999); + FileSource fileSource = options.filesRoot(); + fileSource.createIfNecessary(); + FileSource filesFileSource = fileSource.child(FILES_ROOT); + filesFileSource.createIfNecessary(); + FileSource mappingsFileSource = fileSource.child(MAPPINGS_ROOT); + mappingsFileSource.createIfNecessary(); + + // Register extension + options.extensions("org.onap.integration.test.mock.extension.Webhooks"); + // Register notifier + options.notifier(new ConsoleNotifier(true)); + wireMockServer = new WireMockServer(options); + + wireMockServer.enableRecordMappings(mappingsFileSource, filesFileSource); + + //if (options.specifiesProxyUrl()) { + // addProxyMapping(options.proxyUrl()); + //} + + try { + wireMockServer.start(); + out.println(BANNER); + out.println(); + out.println(options); + } catch (FatalStartupException e) { + System.err.println(e.getMessage()); + System.exit(1); + } + } + + private void addProxyMapping(final String baseUrl) { + wireMockServer.loadMappingsUsing(new MappingsLoader() { + @Override + public void loadMappingsInto(StubMappings stubMappings) { + RequestPattern requestPattern = newRequestPattern(ANY, anyUrl()).build(); + ResponseDefinition responseDef = responseDefinition() + .proxiedFrom(baseUrl) + .build(); + + StubMapping proxyBasedMapping = new StubMapping(requestPattern, responseDef); + proxyBasedMapping.setPriority(10); // Make it low priority so that existing stubs will take precedence + stubMappings.addMapping(proxyBasedMapping); + } + }); + } + + public void stop() { + wireMockServer.stop(); + } + + public boolean isRunning() { + return wireMockServer.isRunning(); + } + + public int port() { return wireMockServer.port(); } + +} diff --git a/test/mock/src/main/java/org/onap/integration/test/mock/extension/WebhookDefinition.java b/test/mock/src/main/java/org/onap/integration/test/mock/extension/WebhookDefinition.java new file mode 100644 index 000000000..dff99fd41 --- /dev/null +++ b/test/mock/src/main/java/org/onap/integration/test/mock/extension/WebhookDefinition.java @@ -0,0 +1,101 @@ +package org.onap.integration.test.mock.extension; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.github.tomakehurst.wiremock.http.Body; +import com.github.tomakehurst.wiremock.http.HttpHeader; +import com.github.tomakehurst.wiremock.http.HttpHeaders; +import com.github.tomakehurst.wiremock.http.RequestMethod; + +import java.net.URI; +import java.util.List; + +import static com.google.common.collect.Lists.newArrayList; + +public class WebhookDefinition { + + private RequestMethod method; + private URI url; + private List<HttpHeader> headers; + private Body body = Body.none(); + + @JsonCreator + public WebhookDefinition(@JsonProperty("method") RequestMethod method, + @JsonProperty("url") URI url, + @JsonProperty("headers") HttpHeaders headers, + @JsonProperty("body") String body, + @JsonProperty("base64Body") String base64Body) { + this.method = method; + this.url = url; + this.headers = newArrayList(headers.all()); + this.body = Body.fromOneOf(null, body, null, base64Body); + } + + public WebhookDefinition() { + } + + public RequestMethod getMethod() { + return method; + } + + public URI getUrl() { + return url; + } + + public HttpHeaders getHeaders() { + return new HttpHeaders(headers); + } + + public String getBase64Body() { + return body.isBinary() ? body.asBase64() : null; + } + + public String getBody() { + return body.isBinary() ? null : body.asString(); + } + + @JsonIgnore + public byte[] getBinaryBody() { + return body.asBytes(); + } + + public WebhookDefinition withMethod(RequestMethod method) { + this.method = method; + return this; + } + + public WebhookDefinition withUrl(URI url) { + this.url = url; + return this; + } + + public WebhookDefinition withUrl(String url) { + withUrl(URI.create(url)); + return this; + } + + public WebhookDefinition withHeaders(List<HttpHeader> headers) { + this.headers = headers; + return this; + } + + public WebhookDefinition withHeader(String key, String... values) { + if (headers == null) { + headers = newArrayList(); + } + + headers.add(new HttpHeader(key, values)); + return this; + } + + public WebhookDefinition withBody(String body) { + this.body = new Body(body); + return this; + } + + public WebhookDefinition withBinaryBody(byte[] body) { + this.body = new Body(body); + return this; + } +} diff --git a/test/mock/src/main/java/org/onap/integration/test/mock/extension/Webhooks.java b/test/mock/src/main/java/org/onap/integration/test/mock/extension/Webhooks.java new file mode 100644 index 000000000..cb17ba658 --- /dev/null +++ b/test/mock/src/main/java/org/onap/integration/test/mock/extension/Webhooks.java @@ -0,0 +1,100 @@ +package org.onap.integration.test.mock.extension; + +import com.github.tomakehurst.wiremock.common.Notifier; +import com.github.tomakehurst.wiremock.core.Admin; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.PostServeAction; +import com.github.tomakehurst.wiremock.http.HttpClientFactory; +import com.github.tomakehurst.wiremock.http.HttpHeader; +import com.github.tomakehurst.wiremock.stubbing.ServeEvent; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +import static com.github.tomakehurst.wiremock.common.Exceptions.throwUnchecked; +import static com.github.tomakehurst.wiremock.common.LocalNotifier.notifier; +import static com.github.tomakehurst.wiremock.http.HttpClientFactory.getHttpRequestFor; +import static java.util.concurrent.TimeUnit.SECONDS; + +public class Webhooks extends PostServeAction { + + private final ScheduledExecutorService scheduler; + private final HttpClient httpClient; + + public Webhooks() { + scheduler = Executors.newScheduledThreadPool(10); + httpClient = HttpClientFactory.createClient(); + } + + @Override + public String getName() { + return "webhook"; + } + + @Override + public void doAction(ServeEvent serveEvent, Admin admin, Parameters parameters) { + final WebhookDefinition definition = parameters.as(WebhookDefinition.class); + final Notifier notifier = notifier(); + + scheduler.schedule( + new Runnable() { + @Override + public void run() { + HttpUriRequest request = buildRequest(definition); + + try { + HttpResponse response = httpClient.execute(request); + notifier.info( + String.format("Webhook %s request to %s returned status %s\n\n%s", + definition.getMethod(), + definition.getUrl(), + response.getStatusLine(), + EntityUtils.toString(response.getEntity()) + ) + ); + System.out.println(String.format("Webhook %s request to %s returned status %s\n\n%s", + definition.getMethod(), + definition.getUrl(), + response.getStatusLine(), + EntityUtils.toString(response.getEntity()) + ) + ); + } catch (IOException e) { + throwUnchecked(e); + } + } + }, + 0L, + SECONDS + ); + } + + private static HttpUriRequest buildRequest(WebhookDefinition definition) { + HttpUriRequest request = getHttpRequestFor( + definition.getMethod(), + definition.getUrl().toString() + ); + + for (HttpHeader header: definition.getHeaders().all()) { + request.addHeader(header.key(), header.firstValue()); + } + + if (definition.getMethod().hasEntity()) { + HttpEntityEnclosingRequestBase entityRequest = (HttpEntityEnclosingRequestBase) request; + entityRequest.setEntity(new ByteArrayEntity(definition.getBinaryBody())); + } + + return request; + } + + public static WebhookDefinition webhook() { + return new WebhookDefinition(); + } +} diff --git a/test/mock/src/main/resources/application.properties b/test/mock/src/main/resources/application.properties new file mode 100644 index 000000000..51ad5ebf4 --- /dev/null +++ b/test/mock/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=9090 diff --git a/test/mock/src/test/java/org/onap/integration/test/mock/MockApplicationTests.java b/test/mock/src/test/java/org/onap/integration/test/mock/MockApplicationTests.java new file mode 100644 index 000000000..8d2a04625 --- /dev/null +++ b/test/mock/src/test/java/org/onap/integration/test/mock/MockApplicationTests.java @@ -0,0 +1,16 @@ +package org.onap.integration.test.mock; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class MockApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java b/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java index d6e5d4ca6..75da50ff0 100644 --- a/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java +++ b/version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java @@ -19,7 +19,6 @@ package org.onap.integration.versionmanifest; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.MalformedURLException; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; @@ -88,9 +87,6 @@ public class VersionCheckMojo extends AbstractMojo { log.debug("Expected version: " + groupId + ":" + artifactId + ":" + version); expectedVersions.put(groupId + ":" + artifactId, version); } - } catch (MalformedURLException e) { - log.error(e); - throw new MojoExecutionException(e.getMessage()); } catch (IOException e) { log.error(e); throw new MojoExecutionException(e.getMessage()); |