Fix pep8 errors raised with python3.12 and update advanced guest image

Two recent changes in CI infra have affected
whitebox_neutron_tempest_plugin jobs:
1) After updating of pep8 jobs to ubuntu-noble/python3.12, an error is
   reported and this patch fixes it.
2) Tests using advanced images had issues to boot rocky 9.3 VM instances
   and due to that, this patch updates it to rocky 9.5.
   As a consequence of this change, virt-customize command has been
   updated to:
   * install tcpdump
   * enable dhcp for NetworkManager
   And some tests have been adapted to rocky 9.5 characteristics.

Change-Id: I489ecaf1765570e52b1f2d2676f13a0edc5f6fc4
This commit is contained in:
Eduardo Olivares 2024-12-02 17:12:31 +01:00 committed by ccamposr
parent 3feaab6c99
commit 435766502a
5 changed files with 39 additions and 12 deletions

View File

@ -17,7 +17,10 @@ customize_advanced_image(){
if [ -n "$image_file" ] && [ -s "$TOP_DIR/files/$image_file" ]; then
cp -f $TOP_DIR/files/$image_file /tmp
image_file_custom=/tmp/$image_file
timeout 150 sudo virt-customize -a $image_file_custom --install nmap,keepalived,iperf3 --selinux-relabel
dhcp_client_conf_file=/tmp/dhcp-client.conf
echo "[main]" > $dhcp_client_conf_file
echo "dhcp=dhclient" >> $dhcp_client_conf_file
timeout 150 sudo virt-customize -a $image_file_custom --install nmap,keepalived,iperf3,tcpdump,dhcp-client --copy-in $dhcp_client_conf_file:/etc/NetworkManager/conf.d --selinux-relabel
if [ "$?" == "0" ]; then
source $TOP_DIR/openrc admin
old_image_id=$(openstack image show $ADVANCED_IMAGE_NAME -c id -f value)

View File

@ -224,8 +224,11 @@ class ExtraDhcpOptionsTest(base.BaseTempestTestCase):
self._create_port_and_check_dhcp_opts(dhcp4_enabled=False)
vm_ssh_client = self._create_server_and_fip()
# ipv4.domain is not expected
dhclient_and_resolvconf_cmd = (
"sudo timeout 30 dhclient || true; "
"if [ -f /etc/resolv.conf ]; then cat /etc/resolv.conf; fi")
vm_resolv_conf = vm_ssh_client.exec_command(
"sudo dhclient && cat /etc/resolv.conf")
dhclient_and_resolvconf_cmd)
self.assertIsNone(re.search(r'^search\s+{}\s+'.format(domain_value),
vm_resolv_conf,
re.MULTILINE))
@ -240,7 +243,7 @@ class ExtraDhcpOptionsTest(base.BaseTempestTestCase):
neutron_constants.SERVER_STATUS_ACTIVE)
# ipv4.domain is expected
vm_resolv_conf = vm_ssh_client.exec_command(
"sudo dhclient && cat /etc/resolv.conf")
dhclient_and_resolvconf_cmd)
# (rsafrono) this regex will work reliably even in case dhcp_domain in
# nova.conf is defined, i.e. not an empty value. Helps to stabilize
# the test on podified environments.

View File

@ -161,7 +161,7 @@ class TestMetadataRateLimiting(wb_base.BaseTempestWhiteboxTestCase):
responses = []
num_of_tries = 10
cmd = f"curl http://{constants.METADATA_SERVICE_IP}"
cmd = "curl http://{}".format(constants.METADATA_SERVICE_IP)
for i in range(num_of_tries):
try:

View File

@ -235,12 +235,19 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
# several tests in parallel increase this application time
# bw limit properly (buffer is empty when traffic starts being sent)
if not self.has_ovn_support:
ignored_intervals = 3
intervals_start = 3
elif self.sriov_test:
ignored_intervals = 2
intervals_start = 2
else:
ignored_intervals = 1
intervals = perf_measures['intervals'][ignored_intervals:]
intervals_start = 1
# For rocky images, final interval is ignored
# TODO(eolivare): provide link to iperf/rocky bug
intervals_end = (len(perf_measures['intervals'])
if self.username != "rocky"
else len(perf_measures['intervals']) - 1)
intervals = perf_measures['intervals'][intervals_start:intervals_end]
bits_received = sum([interval['sum']['bytes'] * 8
for interval in intervals])
@ -429,17 +436,26 @@ class QosBaseTest(test_qos.QoSTestMixin, base.TrafficFlowTest):
self.qos_bw_limit_rule_client.update_limit_bandwidth_rule(
qos_policy_id=fip_qos_pol_id, rule_id=fip_port_rule_id,
**rule_update_data)
# For rocky images, running iperf tests with low BW limits using
# TCP does not work well, wo UDP is used instead
# TODO(eolivare): provide link to iperf/rocky bug
protocol = (constants.PROTO_NAME_TCP
if self.username != "rocky"
else constants.PROTO_NAME_UDP)
# fip bw limit is lower than port bw limit, so fip_max_kbps
# will be the measured bw
self._validate_bw_limit(client, server, egress,
bw_limit=fip_max_kbps * 1000)
bw_limit=fip_max_kbps * 1000,
protocol=protocol)
# delete bw limit rule associated to fip qos policy
# port bw limit applies again
self.qos_bw_limit_rule_client.delete_limit_bandwidth_rule(
fip_qos_pol_id, fip_port_rule_id)
self._validate_bw_limit(client, server, egress,
bw_limit=max_kbps * 1000)
bw_limit=max_kbps * 1000,
protocol=protocol)
# Delete bw limit rule from the port QoS policy and validate that
# bw is not limited anymore

View File

@ -21,6 +21,10 @@
tempest_test_timeout: 2400
tempest_test_regex: "\
(^whitebox_neutron_tempest_plugin.tests.scenario)"
# NOTE(eolivare): test_extra_dhcp_opts_ipv4_ipv6_stateless is skipped
# because of some issue with rocky9.5 images - the VMs don't receive any
# DHCP6 options when dhcpv6-stateless is used, but this works well with
# other images
tempest_exclude_regex: "\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_metadata_rate_limiting)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_router_flavors)|\
@ -36,12 +40,13 @@
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_dbs.OvnDbsMonitoringTest.*)|\
(^whitebox_neutron_tempest_plugin.*ovn_controller_restart)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_ovn_fdb.*)|\
(^whitebox_neutron_tempest_plugin.tests.scenario.test_api_server.*)"
(^whitebox_neutron_tempest_plugin.tests.scenario.test_api_server.*)|\
(test_extra_dhcp_opts_ipv4_ipv6_stateless)"
devstack_localrc:
USE_PYTHON3: true
NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_tempest) | join(',') }}"
PHYSICAL_NETWORK: public
IMAGE_URLS: https://dl.rockylinux.org/vault/rocky/9.3/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2
IMAGE_URLS: https://dl.rockylinux.org/vault/rocky/9.5/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2
CIRROS_VERSION: 0.6.2
DEFAULT_IMAGE_NAME: cirros-0.6.2-x86_64-uec
DEFAULT_IMAGE_FILE_NAME: cirros-0.6.2-x86_64-uec.tar.gz