From 81dcaf9df2bb38882af7f8b315309147da597ccb Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 26 Aug 2015 14:59:04 -0400 Subject: [PATCH] Prepare Tempest and run smoke Still hacking on the patch to make it pass trusty systems. * Create 2 flavors, used by Tempest Compute tests * Create 'public' network, used by Tempest Compute tests for floating-ip * Configure Tempest to be aware about the 2 created flavors refs * Configure Tempest to be aware about the public network * Add some Puppet Exec code that prepare virtual bridging to reach floating IPs * Add scenario parameters * Run Smoke suite that includes 2 scenarios & some important API tests. * Pin python-netaddr on ubuntu so we can test floating-IP. Change-Id: Iebb83e110fbb0c072f06b3ca2ad84987e0efe3a6 --- fixtures/scenario001.pp | 99 ++++++++++++++++++++++++++++++++++------- run_tests.sh | 23 +++++++++- 2 files changed, 105 insertions(+), 17 deletions(-) diff --git a/fixtures/scenario001.pp b/fixtures/scenario001.pp index d8bc71cf1..7b6480d47 100644 --- a/fixtures/scenario001.pp +++ b/fixtures/scenario001.pp @@ -130,20 +130,6 @@ class { '::glance::registry': database_connection => 'mysql://glance:glance@127.0.0.1/glance?charset=utf8', keystone_password => 'a_big_secret', } -glance_image { 'cirros': - ensure => present, - container_format => 'bare', - disk_format => 'qcow2', - is_public => 'yes', - source => 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img', -} -glance_image { 'cirros_alt': - ensure => present, - container_format => 'bare', - disk_format => 'qcow2', - is_public => 'yes', - source => 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img', -} # Deploy Neutron class { '::neutron::db::mysql': @@ -240,6 +226,76 @@ class { '::nova::network::neutron': neutron_admin_auth_url => 'http://127.0.0.1:35357/v2.0', } +# Configure Tempest and the resources +$os_auth_options = '--os-username admin --os-password a_big_secret --os-tenant-name openstack --os-auth-url http://127.0.0.1:5000/v2.0' + +exec { 'manage_m1.nano_nova_flavor': + path => '/usr/bin:/bin:/usr/sbin:/sbin', + provider => shell, + command => "nova ${os_auth_options} flavor-create m1.nano 42 128 0 1", + unless => "nova ${os_auth_options} flavor-list | grep m1.nano", +} +Keystone_user_role['admin@openstack'] -> Exec['manage_m1.nano_nova_flavor'] + +exec { 'manage_m1.micro_nova_flavor': + path => '/usr/bin:/bin:/usr/sbin:/sbin', + provider => shell, + command => "nova ${os_auth_options} flavor-create m1.micro 84 128 0 1", + unless => "nova ${os_auth_options} flavor-list | grep m1.micro", +} +Keystone_user_role['admin@openstack'] -> Exec['manage_m1.micro_nova_flavor'] + +neutron_network { 'public': + tenant_name => 'openstack', + router_external => true, +} +Keystone_user_role['admin@openstack'] -> Neutron_network<||> + +neutron_subnet { 'public-subnet': + cidr => '172.24.5.0/24', + ip_version => '4', + allocation_pools => ['start=172.24.5.10,end=172.24.5.200'], + gateway_ip => '172.24.5.1', + enable_dhcp => false, + network_name => 'public', + tenant_name => 'openstack', +} + +include ::vswitch::ovs +vs_bridge { 'br-ex': + ensure => present, + notify => Exec['create_br-ex_vif'], +} + +# creates br-ex virtual interface to reach floating-ip network +exec { 'create_br-ex_vif': + path => '/usr/bin:/bin:/usr/sbin:/sbin', + provider => shell, + command => 'ip addr add 172.24.5.1/24 dev br-ex; ip link set br-ex up', + refreshonly => true, +} + +glance_image { 'cirros': + ensure => present, + container_format => 'bare', + disk_format => 'qcow2', + is_public => 'yes', + # TODO(emilien) optimization by 1/ using Hiera to configure Glance image source + # and 2/ if running in the gate, use /home/jenkins/cache/files/ cirros image. + # source => '/home/jenkins/cache/files/cirros-0.3.4-x86_64-disk.img', + source => 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img', +} +glance_image { 'cirros_alt': + ensure => present, + container_format => 'bare', + disk_format => 'qcow2', + is_public => 'yes', + # TODO(emilien) optimization by 1/ using Hiera to configure Glance image source + # and 2/ if running in the gate, use /home/jenkins/cache/files/ cirros image. + # source => '/home/jenkins/cache/files/cirros-0.3.4-x86_64-disk.img', + source => 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img', +} + class { '::tempest': debug => true, use_stderr => false, @@ -250,7 +306,7 @@ class { '::tempest': lock_path => '/tmp/openstack/tempest', tempest_config_file => '/tmp/openstack/tempest/etc/tempest.conf', configure_images => true, - configure_networks => false, + configure_networks => true, identity_uri => 'http://127.0.0.1:5000/v2.0', identity_uri_v3 => 'http://127.0.0.1:5000/v3', admin_username => 'admin', @@ -263,5 +319,16 @@ class { '::tempest': cinder_available => false, glance_available => true, horizon_available => false, - nova_available => false, + nova_available => true, + neutron_available => true, + public_network_name => 'public', + flavor_ref => '42', + flavor_ref_alt => '84', + image_ssh_user => 'cirros', + image_alt_ssh_user => 'cirros', + img_file => 'cirros-0.3.4-x86_64-disk.img', + # TODO(emilien) optimization by 1/ using Hiera to configure Glance image source + # and 2/ if running in the gate, use /home/jenkins/cache/files/ cirros image. + # img_dir => '/home/jenkins/cache/files', + img_dir => '/tmp/openstack/tempest', } diff --git a/run_tests.sh b/run_tests.sh index 75187ba0a..71845e03a 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -81,7 +81,28 @@ if [ $RESULT -ne 0 ]; then exit 1 fi +# TODO(emilien) later, we should use local image if present. That would be a next iteration. +wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -P /tmp/openstack/tempest + +# TODO(emilien) drop this code after b3 goes in 'liberty/proposed' +if uses_debs; then + # tl;dr; floating-ip is broken in ubuntu/liberty/proposed: http://goo.gl/Yoaqzo + # our current CI is getting packages from ubuntu liberty/proposed + # liberty/proposed provides python-netaddr > 0.7.15 but a too old version + # of neutron that does not include https://review.openstack.org/#/c/218723/ + # which is required when you run python-netaddr > 0.7.15. + # ubuntu team is about to provide liberty-3 soon in liberty/proposed but in + # the meantime, we need to pin netaddr==0.7.15 so we can create floating-IP + sudo pip install -Iv netaddr==0.7.15 + sudo service neutron-server restart + sudo service neutron-plugin-openvswitch-agent restart + sudo service neutron-dhcp-agent restart + sudo service neutron-metadata-agent restart + sudo service neutron-l3-agent restart +fi + +# run a scenario that validates Keystone, Nova, Glance and Neutron # TODO(emilien) the checkout thing is temporary, while test_list_projects_returns_only_authorized_projects is # failing for us we checkout the most recent commit without this test. # https://bugs.launchpad.net/tempest/+bug/1492419 -cd /tmp/openstack/tempest; git checkout b6369eaa58f2c9ce334863cb3ba54c5656cf64c4; tox -eall -- identity image +cd /tmp/openstack/tempest; git checkout b6369eaa58f2c9ce334863cb3ba54c5656cf64c4; tox -eall -- smoke