Merge "Migrate dvr multinode scenario to zuulv3 syntax"
diff --git a/.zuul.yaml b/.zuul.yaml
index ff94a81..1063efa 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -107,6 +107,18 @@
NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-timestamp,standard-attr-tag,subnet_allocation,tag,tag-ext,trunk,trunk-details
- job:
+ name: neutron-tempest-plugin-api-rocky
+ parent: neutron-tempest-plugin-api
+ override-checkout: stable/rocky
+ vars:
+ branch_override: stable/rocky
+ devstack_localrc:
+ # TODO(slaweq): find a way to put this list of extensions in
+ # neutron repository and keep it different per branch,
+ # then it could be removed from here
+ NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-mac-address-regenerate,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details
+
+- job:
name: neutron-tempest-plugin-scenario
parent: neutron-tempest-plugin
abstract: true
@@ -160,6 +172,15 @@
NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-integration,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-timestamp,standard-attr-tag,subnet_allocation,tag,tag-ext,trunk,trunk-details
- job:
+ name: neutron-tempest-plugin-scenario-linuxbridge-rocky
+ parent: neutron-tempest-plugin-scenario-linuxbridge
+ override-checkout: stable/rocky
+ vars:
+ branch_override: stable/rocky
+ devstack_localrc:
+ NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-timestamp,standard-attr-tag,subnet_allocation,tag,tag-ext,trunk,trunk-details
+
+- job:
name: neutron-tempest-plugin-dvr-multinode-scenario
parent: tempest-multinode-full
description: |
@@ -290,6 +311,13 @@
branch_override: stable/queens
- job:
+ name: neutron-tempest-plugin-dvr-multinode-scenario-rocky
+ parent: neutron-tempest-plugin-dvr-multinode-scenario
+ override-checkout: stable/rocky
+ vars:
+ branch_override: stable/rocky
+
+- job:
name: neutron-tempest-plugin-designate-scenario
parent: neutron-tempest-plugin-scenario
description: Neutron designate integration scenario
@@ -317,6 +345,13 @@
vars:
branch_override: stable/queens
+- job:
+ name: neutron-tempest-plugin-designate-scenario-rocky
+ parent: neutron-tempest-plugin-designate-scenario
+ override-checkout: stable/rocky
+ vars:
+ branch_override: stable/rocky
+
- project-template:
name: neutron-tempest-plugin-jobs
check:
@@ -344,10 +379,23 @@
jobs:
- neutron-tempest-plugin-api-queens
+- project-template:
+ name: neutron-tempest-plugin-jobs-rocky
+ check:
+ jobs:
+ - neutron-tempest-plugin-api-rocky
+ - neutron-tempest-plugin-designate-scenario-rocky
+ - neutron-tempest-plugin-dvr-multinode-scenario-rocky
+ - neutron-tempest-plugin-scenario-linuxbridge-rocky
+ gate:
+ jobs:
+ - neutron-tempest-plugin-api-rocky
+
- project:
templates:
- neutron-tempest-plugin-jobs
- neutron-tempest-plugin-jobs-queens
+ - neutron-tempest-plugin-jobs-rocky
- check-requirements
- tempest-plugin-jobs
- release-notes-jobs-python3
diff --git a/devstack/customize_image.sh b/devstack/customize_image.sh
new file mode 100644
index 0000000..669c761
--- /dev/null
+++ b/devstack/customize_image.sh
@@ -0,0 +1,158 @@
+# This script include functions that allow guest image files customization
+# before uploading them to OpenStack image service
+
+# ensure we don't re-source this in the same environment
+[[ -z "$_NEUTRON_TEMPEST_PLUGIN_CUSTOMIZE_IMAGE" ]] || return 0
+declare -r -g _NEUTRON_TEMPEST_PLUGIN_CUSTOMIZE_IMAGE=1
+
+source "${NEUTRON_TEMPEST_PLUGIN_DIR}/functions.sh"
+
+# By default enable guest image customization. It will be automatically skipped
+# for cirros images
+CUSTOMIZE_IMAGE=${CUSTOMIZE_IMAGE:-True}
+
+# Image customization is performed using virt-customize
+# using direct backend by default
+LIBGUESTFS_BACKEND=${LIBGUESTFS_BACKEND:-direct}
+
+# Disable KVM hardware accelleration by default
+LIBGUESTFS_BACKEND_SETTINGS=${LIBGUESTFS_BACKEND_SETTINGS:-force_tcg}
+
+# Install tools required for customizing guest image files
+function install_customize_image_tools {
+ local do_customize=$(trueorfalse True CUSTOMIZE_IMAGE)
+ if [ ${do_customize} == True ]; then
+ # Make sure virt-customize is installed
+ install_package libguestfs-tools
+ fi
+}
+
+# Wraps upload_image function to eventually customize image file before
+# uploading it via "openstack image create" command
+save_function upload_image overridden_upload_image
+function upload_image {
+ local image_url=$1
+
+ # Fork a subshell to have environment restored at the end of this function
+ (
+ # Check user configuration
+ local customize_image=$(trueorfalse True CUSTOMIZE_IMAGE)
+ if [ ${customize_image} == True ]; then
+ # Temporarly wraps openstack command with openstack_image_create
+ # function
+ function openstack {
+ IMAGE_URL=${image_url} upload_custom_image "$@"
+ }
+ fi
+
+ # Execute original upload_image function
+ overridden_upload_image "$@"
+ )
+}
+
+# Wraps "openstack image create" command to customize image file before
+# uploading it to OpenstackImage service.
+# Called only when ${CUSTOMIZE_IMAGE} is True
+function upload_custom_image {
+ # Copy command arguments for later use
+ local args=( "$@" )
+
+ # Look for image create sub-command:
+ # skip any argument before "image" and "create" words
+ local i=0
+ local subcommands=()
+ for subcommand in image create; do
+ for (( ; i < ${#args[@]}; )) {
+ local arg=${args[i]}
+ (( ++i ))
+ if [ "${arg}" == "${subcommand}" ]; then
+ subcommands+=( "${arg}" )
+ break
+ fi
+ }
+ done
+
+ if [ "${subcommands[*]}" == "image create" ]; then
+ # create image subcommand has been detected
+
+ # Put here temporary files to be delete before exiting from this
+ # function
+ local temp_dir=$(mktemp -d)
+ chmod 777 "${temp_dir}"
+
+ # Parse openstack image create subcommand arguments
+ local image_url="${IMAGE_URL}"
+ local image_file=
+ local disk_format=auto
+ local container_format=bare
+
+ for (( ; i < ${#args[@]}; )) {
+ local arg=${args[$i]}
+ (( ++i ))
+
+ if [[ "${arg}" == --* ]]; then
+ # Handle --<option_name>=<option_value> syntax
+ local option_fields=(${arg//=/ })
+ local option_name=${option_fields[0]}
+ local option_value=${option_fields[1]:-}
+
+ case "${option_name}" in
+
+ --container-format) # Found container format
+ container_format=${option_value:-${args[ (( i++ )) ]}}
+ ;;
+
+ --disk-format) # Found disk format
+ disk_format=${option_value:-${args[ (( i++ )) ]}}
+ ;;
+
+ --file) # Found image file name
+ image_file=${option_value:-${args[ (( i++ )) ]}}
+ ;;
+ esac
+ fi
+ }
+
+ if [ "${image_file}" == "" ]; then
+ # Copy image file from stdin to a temporary file
+ image_file=${temp_dir}/$(basename "${image_url}")
+ cat > "${image_file}"
+
+ # Add option to load image from file
+ args+=( --file "${image_file}" )
+ fi
+
+ # Make image file readable and writable by qemu user
+ sudo chmod 666 "${image_file}"
+
+ # Customize image file
+ TEMP_DIR=${temp_dir} \
+ DISK_FORMAT=${disk_format} \
+ customize_image "${image_file}"
+ fi
+
+ # Upload custom image file
+ overridden_openstack "${args[@]}" || local error=$?
+
+ # Finally delete temporary files
+ sudo rm -fR "${temp_dir}" || true
+
+ return ${error:-0}
+}
+
+function overridden_openstack {
+ "$(which openstack)" "$@"
+}
+
+# Execute customization commands on a VM with attached guest image file.
+# Called only when ${CUSTOMIZE_IMAGE} is True
+function customize_image {
+ local image_file=$1
+ local top_dir=$(dirname "${NEUTRON_TEMPEST_PLUGIN_DIR}")
+ (
+ export TEMP_DIR DISK_FORMAT RC_DIR
+ if [[ "$(basename ${image_file})" == ubuntu-* ]]; then
+ "${top_dir}/tools/customize_ubuntu_image" "${image_file}"
+ fi
+ )
+}
diff --git a/devstack/functions.sh b/devstack/functions.sh
new file mode 100644
index 0000000..026f527
--- /dev/null
+++ b/devstack/functions.sh
@@ -0,0 +1,32 @@
+# Generic use functions
+
+# ensure we don't re-source this in the same environment
+[[ -z "$_NEUTRON_TEMPEST_PLUGIN_FUNCTIONS" ]] || return 0
+declare -r -g _NEUTRON_TEMPEST_PLUGIN_FUNCTIONS=1
+
+# Create a function copying the code from an existing one
+function save_function {
+ local old_name=$1
+ local new_name=$2
+
+ # Saving the same function again after redefining it could produce a
+ # recorsive function in case for example this plugin is sourced twice
+ if type -t "${new_name}"; then
+ # Prevent copying the same function twice
+ return 0
+ fi
+
+ # Save xtrace setting
+ _XTRACE_FUNCTIONS=$(set +o | grep xtrace)
+ set +o xtrace
+
+ # Get code of the original function
+ local old_code=$(declare -f ${old_name})
+ # Produce code for the new function
+ local new_code="${new_name}${old_code#${old_name}}"
+ # Define the new function
+ eval "${new_code}"
+
+ # Restore xtrace
+ $_XTRACE_FUNCTIONS
+}
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index a2009ea..e7e30a9 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -1,6 +1,12 @@
+# Directory where this plugin.sh file is
+NEUTRON_TEMPEST_PLUGIN_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+
+source "${NEUTRON_TEMPEST_PLUGIN_DIR}/customize_image.sh"
+
# install_neutron_tempest_plugin
function install_neutron_tempest_plugin {
setup_dev_lib "neutron-tempest-plugin"
+ install_customize_image_tools
}
if [[ "$1" == "stack" ]]; then
diff --git a/neutron_tempest_plugin/api/admin/test_external_network_extension.py b/neutron_tempest_plugin/api/admin/test_external_network_extension.py
index cd4635c..a713492 100644
--- a/neutron_tempest_plugin/api/admin/test_external_network_extension.py
+++ b/neutron_tempest_plugin/api/admin/test_external_network_extension.py
@@ -162,14 +162,12 @@
target_tenant=self.admin_client.tenant_id)
self.create_subnet(net, client=self.admin_client, enable_dhcp=False)
with testtools.ExpectedException(lib_exc.NotFound):
- self.client2.create_floatingip(
- floating_network_id=net['id'])
+ self.create_floatingip(net['id'], client=self.client2)
self.admin_client.create_rbac_policy(
object_type='network', object_id=net['id'],
action='access_as_external',
target_tenant=self.client2.tenant_id)
- self.client2.create_floatingip(
- floating_network_id=net['id'])
+ self.create_floatingip(net['id'], client=self.client2)
@decorators.idempotent_id('476be1e0-f72e-47dc-9a14-4435926bbe82')
def test_policy_allows_tenant_to_attach_ext_gw(self):
diff --git a/neutron_tempest_plugin/api/admin/test_floating_ips_admin_actions.py b/neutron_tempest_plugin/api/admin/test_floating_ips_admin_actions.py
index 3607060..1efe516 100644
--- a/neutron_tempest_plugin/api/admin/test_floating_ips_admin_actions.py
+++ b/neutron_tempest_plugin/api/admin/test_floating_ips_admin_actions.py
@@ -32,7 +32,7 @@
def resource_setup(cls):
super(FloatingIPAdminTestJSON, cls).resource_setup()
cls.ext_net_id = CONF.network.public_network_id
- cls.floating_ip = cls.create_floatingip(cls.ext_net_id)
+ cls.floating_ip = cls.create_floatingip()
cls.alt_client = cls.os_alt.network_client
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
@@ -44,10 +44,7 @@
@decorators.attr(type='negative')
@decorators.idempotent_id('11116ee9-4e99-5b15-b8e1-aa7df92ca589')
def test_associate_floating_ip_with_port_from_another_project(self):
- body = self.client.create_floatingip(
- floating_network_id=self.ext_net_id)
- floating_ip = body['floatingip']
- self.addCleanup(self.client.delete_floatingip, floating_ip['id'])
+ floating_ip = self.create_floatingip()
project_id = self.create_project()['id']
port = self.admin_client.create_port(network_id=self.network['id'],
@@ -65,20 +62,17 @@
# other tests may end up stealing the IP before we can use it
# since it's on the external network so we need to retry if it's
# in use.
- for i in range(100):
+ for _ in range(100):
fip = self.get_unused_ip(self.ext_net_id, ip_version=4)
try:
- body = self.admin_client.create_floatingip(
- floating_network_id=self.ext_net_id,
- floating_ip_address=fip)
+ created_floating_ip = self.create_floatingip(
+ floating_ip_address=fip,
+ client=self.admin_client)
break
except lib_exc.Conflict:
pass
else:
self.fail("Could not get an unused IP after 100 attempts")
- created_floating_ip = body['floatingip']
- self.addCleanup(self.admin_client.delete_floatingip,
- created_floating_ip['id'])
self.assertIsNotNone(created_floating_ip['id'])
self.assertIsNotNone(created_floating_ip['tenant_id'])
self.assertEqual(created_floating_ip['floating_ip_address'], fip)
diff --git a/neutron_tempest_plugin/api/admin/test_quotas_negative.py b/neutron_tempest_plugin/api/admin/test_quotas_negative.py
index 7d699d1..cd64e5c 100644
--- a/neutron_tempest_plugin/api/admin/test_quotas_negative.py
+++ b/neutron_tempest_plugin/api/admin/test_quotas_negative.py
@@ -167,11 +167,7 @@
new_quotas = {'floatingip': 1}
self._setup_quotas(tenant_id, **new_quotas)
- ext_net_id = CONF.network.public_network_id
- fip_args = {'tenant_id': tenant_id,
- 'floating_network_id': ext_net_id}
- fip = self.admin_client.create_floatingip(**fip_args)['floatingip']
- self.addCleanup(self.admin_client.delete_floatingip, fip['id'])
+ self.create_floatingip(client=self.admin_client, tenant_id=tenant_id)
- self.assertRaises(lib_exc.Conflict,
- self.admin_client.create_floatingip, **fip_args)
+ self.assertRaises(lib_exc.Conflict, self.create_floatingip,
+ client=self.admin_client, tenant_id=tenant_id)
diff --git a/neutron_tempest_plugin/api/admin/test_tag.py b/neutron_tempest_plugin/api/admin/test_tag.py
index c0210a2..fdcb6a1 100644
--- a/neutron_tempest_plugin/api/admin/test_tag.py
+++ b/neutron_tempest_plugin/api/admin/test_tag.py
@@ -15,7 +15,6 @@
from tempest.lib import exceptions as lib_exc
from neutron_tempest_plugin.api import base
-from neutron_tempest_plugin import config
class TagTestJSON(base.BaseAdminNetworkTest):
@@ -177,9 +176,7 @@
@classmethod
@utils.requires_ext(extension="router", service="network")
def _create_resource(cls):
- cls.ext_net_id = config.CONF.network.public_network_id
- floatingip = cls.create_floatingip(cls.ext_net_id)
- return floatingip['id']
+ return cls.create_floatingip()['id']
@decorators.attr(type='smoke')
@decorators.idempotent_id('53f6c2bf-e272-4e9e-b9a9-b165eb7be807')
@@ -418,9 +415,7 @@
@classmethod
@utils.requires_ext(extension="router", service="network")
def _create_resource(cls):
- cls.ext_net_id = config.CONF.network.public_network_id
- floatingip = cls.create_floatingip(cls.ext_net_id)
- return floatingip['id']
+ return cls.create_floatingip()['id']
def _list_resource(self, filters):
res = self.client.list_floatingips(**filters)
diff --git a/neutron_tempest_plugin/api/test_floating_ips.py b/neutron_tempest_plugin/api/test_floating_ips.py
index 9f5778f..ea3d22e 100644
--- a/neutron_tempest_plugin/api/test_floating_ips.py
+++ b/neutron_tempest_plugin/api/test_floating_ips.py
@@ -48,11 +48,7 @@
# originally the floating IP had no attributes other than its
# association, so an update with an empty body was a signal to
# clear the association. This test ensures we maintain that behavior.
- body = self.client.create_floatingip(
- floating_network_id=self.ext_net_id,
- port_id=self.ports[0]['id'],
- )['floatingip']
- self.floating_ips.append(body)
+ body = self.create_floatingip(port=self.ports[0])
self.assertEqual(self.ports[0]['id'], body['port_id'])
body = self.client.update_floatingip(body['id'])['floatingip']
self.assertFalse(body['port_id'])
@@ -61,12 +57,7 @@
@utils.requires_ext(extension="standard-attr-description",
service="network")
def test_create_update_floatingip_description(self):
- body = self.client.create_floatingip(
- floating_network_id=self.ext_net_id,
- port_id=self.ports[0]['id'],
- description='d1'
- )['floatingip']
- self.floating_ips.append(body)
+ body = self.create_floatingip(port=self.ports[0], description='d1')
self.assertEqual('d1', body['description'])
body = self.client.show_floatingip(body['id'])['floatingip']
self.assertEqual('d1', body['description'])
@@ -84,12 +75,7 @@
service="network")
def test_floatingip_update_extra_attributes_port_id_not_changed(self):
port_id = self.ports[1]['id']
- body = self.client.create_floatingip(
- floating_network_id=self.ext_net_id,
- port_id=port_id,
- description='d1'
- )['floatingip']
- self.floating_ips.append(body)
+ body = self.create_floatingip(port_id=port_id, description='d1')
self.assertEqual('d1', body['description'])
body = self.client.show_floatingip(body['id'])['floatingip']
self.assertEqual(port_id, body['port_id'])
@@ -112,12 +98,7 @@
@utils.requires_ext(extension="fip-port-details", service="network")
def test_create_update_floatingip_port_details(self):
- body = self.client.create_floatingip(
- floating_network_id=self.ext_net_id,
- port_id=self.ports[0]['id'],
- description='d1'
- )['floatingip']
- self.floating_ips.append(body)
+ body = self.create_floatingip(port=self.ports[0], description='d1')
self._assert_port_details(self.ports[0], body)
body = self.client.show_floatingip(body['id'])['floatingip']
self._assert_port_details(self.ports[0], body)
diff --git a/neutron_tempest_plugin/api/test_floating_ips_negative.py b/neutron_tempest_plugin/api/test_floating_ips_negative.py
index 453af71..c8b8cb4 100644
--- a/neutron_tempest_plugin/api/test_floating_ips_negative.py
+++ b/neutron_tempest_plugin/api/test_floating_ips_negative.py
@@ -53,14 +53,8 @@
self.addCleanup(self.client.update_router, self.router['id'],
external_gateway_info={})
port = self.create_port(net)
- body1 = self.client.create_floatingip(
- floating_network_id=self.ext_net_id)
- floating_ip1 = body1['floatingip']
- self.addCleanup(self.client.delete_floatingip, floating_ip1['id'])
- body2 = self.client.create_floatingip(
- floating_network_id=self.ext_net_id)
- floating_ip2 = body2['floatingip']
- self.addCleanup(self.client.delete_floatingip, floating_ip2['id'])
+ floating_ip1 = self.create_floatingip()
+ floating_ip2 = self.create_floatingip()
self.client.update_floatingip(floating_ip1['id'],
port_id=port['id'])
self.assertRaises(lib_exc.Conflict, self.client.update_floatingip,
diff --git a/neutron_tempest_plugin/api/test_revisions.py b/neutron_tempest_plugin/api/test_revisions.py
index eb32560..b03285d 100644
--- a/neutron_tempest_plugin/api/test_revisions.py
+++ b/neutron_tempest_plugin/api/test_revisions.py
@@ -309,7 +309,7 @@
@decorators.idempotent_id('9de71ebc-f5df-4cd0-80bc-60299fce3ce9')
@utils.requires_ext(extension="router", service="network")
@utils.requires_ext(extension="standard-attr-description",
- service="network")
+ service="network")
def test_update_floatingip_bumps_revision(self):
ext_id = config.CONF.network.public_network_id
net = self.create_network()
@@ -325,12 +325,7 @@
subnet['id'])
port = self.create_port(net)
self.addCleanup(self.client.delete_port, port['id'])
- body = self.client.create_floatingip(
- floating_network_id=ext_id,
- port_id=port['id'],
- description='d1'
- )['floatingip']
- self.floating_ips.append(body)
+ body = self.create_floatingip(port=port, description='d1')
self.assertIn('revision_number', body)
b2 = self.client.update_floatingip(body['id'], description='d2')
self.assertGreater(b2['floatingip']['revision_number'],
diff --git a/neutron_tempest_plugin/api/test_timestamp.py b/neutron_tempest_plugin/api/test_timestamp.py
index 186d21f..f5888f9 100644
--- a/neutron_tempest_plugin/api/test_timestamp.py
+++ b/neutron_tempest_plugin/api/test_timestamp.py
@@ -247,14 +247,14 @@
@decorators.idempotent_id('8ae55186-464f-4b87-1c9f-eb2765ee81ac')
def test_create_floatingip_with_timestamp(self):
- fip = self.create_floatingip(self.ext_net_id)
+ fip = self.create_floatingip()
# Verifies body contains timestamp fields
self.assertIsNotNone(fip['created_at'])
self.assertIsNotNone(fip['updated_at'])
@decorators.idempotent_id('a3ac215a-61ac-13f9-9d3c-57c51f11afa1')
def test_update_floatingip_with_timestamp(self):
- fip = self.create_floatingip(self.ext_net_id)
+ fip = self.create_floatingip()
origin_updated_at = fip['updated_at']
update_body = {'description': 'new'}
body = self.client.update_floatingip(fip['id'], **update_body)
@@ -266,7 +266,7 @@
@decorators.idempotent_id('32a6a086-e1ef-413b-b13a-0cfe13ef051e')
def test_show_floatingip_attribute_with_timestamp(self):
- fip = self.create_floatingip(self.ext_net_id)
+ fip = self.create_floatingip()
body = self.client.show_floatingip(fip['id'])
show_fip = body['floatingip']
# verify the timestamp from creation and showed is same
diff --git a/neutron_tempest_plugin/scenario/admin/test_floatingip.py b/neutron_tempest_plugin/scenario/admin/test_floatingip.py
index e58be83..2dc0da8 100644
--- a/neutron_tempest_plugin/scenario/admin/test_floatingip.py
+++ b/neutron_tempest_plugin/scenario/admin/test_floatingip.py
@@ -85,13 +85,12 @@
network_id=self.network['id'],
device_id=server['server']['id']
)['ports'][0]
- fips.append(self.create_and_associate_floatingip(
- port['id'], client=self.os_admin.network_client))
+ fip = self.create_floatingip(port=port,
+ client=self.os_admin.network_client)
+ fips.append(fip)
server_ssh_clients.append(ssh.Client(
fips[i]['floating_ip_address'], CONF.validation.image_ssh_user,
pkey=self.keypair['private_key']))
- self.addCleanup(self.os_admin.network_client.delete_floatingip,
- fips[i]['id'])
return server_ssh_clients, fips
@decorators.idempotent_id('6bba729b-3fb6-494b-9e1e-82bbd89a1045')
diff --git a/neutron_tempest_plugin/scenario/test_dns_integration.py b/neutron_tempest_plugin/scenario/test_dns_integration.py
index 923f013..20062c1 100644
--- a/neutron_tempest_plugin/scenario/test_dns_integration.py
+++ b/neutron_tempest_plugin/scenario/test_dns_integration.py
@@ -76,11 +76,9 @@
cls.keypair = cls.create_keypair()
def _create_floatingip_with_dns(self, dns_name):
- fip = self.os_primary.network_client.create_floatingip(
- CONF.network.public_network_id, dns_name=dns_name,
- dns_domain=self.zone['name'])['floatingip']
- self.floating_ips.append(fip)
- return fip
+ return self.create_floatingip(client=self.os_primary.network_client,
+ dns_name=dns_name,
+ dns_domain=self.zone['name'])
def _create_server(self, name=None):
port = self.create_port(self.network)
@@ -92,7 +90,7 @@
waiters.wait_for_server_status(self.os_primary.servers_client,
server['id'],
constants.SERVER_STATUS_ACTIVE)
- fip = self.create_and_associate_floatingip(port['id'])
+ fip = self.create_floatingip(port=port)
return {'port': port, 'fip': fip, 'server': server}
def _verify_dns_records(self, address, name):
diff --git a/neutron_tempest_plugin/scenario/test_floatingip.py b/neutron_tempest_plugin/scenario/test_floatingip.py
index 504af12..19e843b 100644
--- a/neutron_tempest_plugin/scenario/test_floatingip.py
+++ b/neutron_tempest_plugin/scenario/test_floatingip.py
@@ -87,7 +87,7 @@
network = self.network
port = self.create_port(network, security_groups=[self.secgroup['id']])
if create_floating_ip:
- fip = self.create_and_associate_floatingip(port['id'])
+ fip = self.create_floatingip(port=port)
else:
fip = None
server = self.create_server(
@@ -234,19 +234,20 @@
server['server']['id'], port_id=port['id'])
waiters.wait_for_interface_status(
self.os_primary.interfaces_client, server['server']['id'],
- port['id'], 'ACTIVE')
+ port['id'], lib_constants.PORT_STATUS_ACTIVE)
fip = self.client.show_floatingip(fip['id'])['floatingip']
self._check_port_details(
- fip, port, status='ACTIVE',
+ fip, port, status=lib_constants.PORT_STATUS_ACTIVE,
device_id=server['server']['id'], device_owner='compute:nova')
# detach the port from the server; this is a cast in the compute
# API so we have to poll the port until the device_id is unset.
self.delete_interface(server['server']['id'], port['id'])
- self._wait_for_port_detach(port['id'])
- fip = self.client.show_floatingip(fip['id'])['floatingip']
+ port = self._wait_for_port_detach(port['id'])
+ fip = self._wait_for_fip_port_down(fip['id'])
self._check_port_details(
- fip, port, status='DOWN', device_id='', device_owner='')
+ fip, port, status=lib_constants.PORT_STATUS_DOWN,
+ device_id='', device_owner='')
def _check_port_details(self, fip, port, status, device_id, device_owner):
self.assertIn('port_details', fip)
@@ -287,6 +288,36 @@
return port
+ def _wait_for_fip_port_down(self, fip_id, timeout=120, interval=10):
+ """Waits for the fip's attached port status to be 'DOWN'.
+
+ :param fip_id: The id of the floating IP.
+ :returns: The final fip dict from the show_floatingip response.
+ """
+ fip = self.client.show_floatingip(fip_id)['floatingip']
+ self.assertIn('port_details', fip)
+ port_details = fip['port_details']
+ status = port_details['status']
+ start = int(time.time())
+
+ while status != lib_constants.PORT_STATUS_DOWN:
+ time.sleep(interval)
+ fip = self.client.show_floatingip(fip_id)['floatingip']
+ self.assertIn('port_details', fip)
+ port_details = fip['port_details']
+ status = port_details['status']
+
+ timed_out = int(time.time()) - start >= timeout
+
+ if status != lib_constants.PORT_STATUS_DOWN and timed_out:
+ message = ('Floating IP %s attached port status failed to '
+ 'transition to DOWN (current status %s) within '
+ 'the required time (%s s).' %
+ (fip_id, status, timeout))
+ raise exceptions.TimeoutException(message)
+
+ return fip
+
class FloatingIPQosTest(FloatingIpTestCasesMixin,
test_qos.QoSTestMixin,
diff --git a/neutron_tempest_plugin/scenario/test_migration.py b/neutron_tempest_plugin/scenario/test_migration.py
index f4b918c..3d6c1dd 100644
--- a/neutron_tempest_plugin/scenario/test_migration.py
+++ b/neutron_tempest_plugin/scenario/test_migration.py
@@ -173,11 +173,13 @@
class NetworkMigrationFromHA(NetworkMigrationTestBase):
+ @common_utils.unstable_test("bug 1789434")
@decorators.idempotent_id('b4e68ac0-3b76-4306-ae8a-51cf4d363b22')
def test_from_ha_to_legacy(self):
self._test_migration(before_dvr=False, before_ha=True,
after_dvr=False, after_ha=False)
+ @common_utils.unstable_test("bug 1789434")
@decorators.idempotent_id('42260eea-5d56-4d30-b62a-a62694dfe4d5')
@testtools.skipUnless(
CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
@@ -186,6 +188,7 @@
self._test_migration(before_dvr=False, before_ha=True,
after_dvr=True, after_ha=False)
+ @common_utils.unstable_test("bug 1789434")
@decorators.idempotent_id('e4149576-248b-43fa-9d0b-a5c2f51967ce')
@testtools.skipUnless(
CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
diff --git a/neutron_tempest_plugin/scenario/test_mtu.py b/neutron_tempest_plugin/scenario/test_mtu.py
index dbfde9b..7a9f969 100644
--- a/neutron_tempest_plugin/scenario/test_mtu.py
+++ b/neutron_tempest_plugin/scenario/test_mtu.py
@@ -58,7 +58,7 @@
constants.SERVER_STATUS_ACTIVE)
port = self.client.list_ports(
network_id=net['id'], device_id=server['server']['id'])['ports'][0]
- fip = self.create_and_associate_floatingip(port['id'])
+ fip = self.create_floatingip(port=port)
return server, fip
def _get_network_params(self):
diff --git a/neutron_tempest_plugin/scenario/test_security_groups.py b/neutron_tempest_plugin/scenario/test_security_groups.py
index 9503fe3..a764a49 100644
--- a/neutron_tempest_plugin/scenario/test_security_groups.py
+++ b/neutron_tempest_plugin/scenario/test_security_groups.py
@@ -67,7 +67,7 @@
port = self.client.list_ports(
network_id=self.network['id'], device_id=server['server'][
'id'])['ports'][0]
- fips.append(self.create_and_associate_floatingip(port['id']))
+ fips.append(self.create_floatingip(port=port))
server_ssh_clients.append(ssh.Client(
fips[i]['floating_ip_address'], CONF.validation.image_ssh_user,
pkey=self.keypair['private_key']))
diff --git a/neutron_tempest_plugin/scenario/test_trunk.py b/neutron_tempest_plugin/scenario/test_trunk.py
index 9a92b38..e6d8863 100644
--- a/neutron_tempest_plugin/scenario/test_trunk.py
+++ b/neutron_tempest_plugin/scenario/test_trunk.py
@@ -65,7 +65,7 @@
'server': server}
def _create_server_with_fip(self, port_id, **server_kwargs):
- fip = self.create_and_associate_floatingip(port_id)
+ fip = self.create_floatingip(port_id=port_id)
return (
self.create_server(
flavor_ref=CONF.compute.flavor_ref,
diff --git a/tools/customize_ubuntu_image b/tools/customize_ubuntu_image
index 9c3fd07..3697265 100755
--- a/tools/customize_ubuntu_image
+++ b/tools/customize_ubuntu_image
@@ -31,8 +31,11 @@
chown _apt.root -fR "${apt_user_folders[@]}"
# Install desired packages to Ubuntu guest image
- apt-get update -y
- apt-get install -y "${INSTALL_GUEST_PACKAGES[@]}"
+ (
+ DEBIAN_FRONTEND=noninteractive
+ apt-get update -y
+ apt-get install -y "${INSTALL_GUEST_PACKAGES[@]}"
+ )
}
function main {
@@ -64,9 +67,12 @@
bind_dir "${temp_dir}/tmp" "${mount_dir}/var/tmp"
bind_dir "${temp_dir}/apt" "${mount_dir}/var/lib/apt"
- # Replace /etc/resolv.conf symlink to use the same DNS as this host
- sudo rm -f "${mount_dir}/etc/resolv.conf"
- sudo cp /etc/resolv.conf "${mount_dir}/etc/resolv.conf"
+ # Temporarly replace /etc/resolv.conf symlink to use the same DNS as this
+ # host
+ local resolv_file=${mount_dir}/etc/resolv.conf
+ sudo mv -f "${resolv_file}" "${resolv_file}.orig"
+ sudo cp /etc/resolv.conf "${resolv_file}"
+ add_cleanup sudo mv -f "${resolv_file}.orig" "${resolv_file}"
# Makesure /etc/fstab exists and it is readable because it is required by
# /sbin/dhclient-script