Merge "List networks with limit and filter by provider network attrs"
diff --git a/neutron_tempest_plugin/common/ssh.py b/neutron_tempest_plugin/common/ssh.py
index 700d21b..6e7e2c5 100644
--- a/neutron_tempest_plugin/common/ssh.py
+++ b/neutron_tempest_plugin/common/ssh.py
@@ -230,8 +230,6 @@
 
             # Update local environment
             lang, encoding = locale.getlocale()
-            if not lang:
-                lang, encoding = locale.getdefaultlocale()
             _locale = '.'.join([lang, encoding])
             channel.update_environment({'LC_ALL': _locale,
                                         'LANG': _locale})
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index 70cb2dc..d299c47 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -176,7 +176,7 @@
                                        client=None):
         """This rule is intended to permit inbound ssh
 
-        Allowing ssh traffic traffic from all sources, so no group_id is
+        Allowing ssh traffic from all sources, so no group_id is
         provided.
         Setting a group_id would only permit traffic from ports
         belonging to the same security group.
diff --git a/neutron_tempest_plugin/scenario/test_security_groups.py b/neutron_tempest_plugin/scenario/test_security_groups.py
index dc0f5ef..b963887 100644
--- a/neutron_tempest_plugin/scenario/test_security_groups.py
+++ b/neutron_tempest_plugin/scenario/test_security_groups.py
@@ -437,6 +437,9 @@
         # configure sec group to support SSH connectivity
         self.create_loginable_secgroup_rule(
             secgroup_id=ssh_secgrp['id'])
+        if self.stateless_sg:
+            self.create_ingress_metadata_secgroup_rule(
+                secgroup_id=ssh_secgrp['id'])
         # spawn two instances with the sec group created
         server_ssh_clients, fips, servers = self.create_vm_testing_sec_grp(
             security_groups=[{'name': ssh_secgrp['name']}])
@@ -464,9 +467,13 @@
                              should_succeed=False)
 
         # add ICMP rule with remote address group
+        address_set = [str(netaddr.IPNetwork(fips[0]['fixed_ip_address']))]
+        if self.stateless_sg:
+            address_set.append(
+                str(netaddr.IPNetwork(fips[1]['fixed_ip_address'])))
         test_ag = self.create_address_group(
             name=data_utils.rand_name('test_ag'),
-            addresses=[str(netaddr.IPNetwork(fips[0]['fixed_ip_address']))])
+            addresses=address_set)
         rule_list = [{'protocol': constants.PROTO_NUM_ICMP,
                       'direction': constants.INGRESS_DIRECTION,
                       'remote_address_group_id': test_ag['id']}]
@@ -762,8 +769,8 @@
         self._test_remote_group()
 
     @testtools.skipUnless(
-        CONF.neutron_plugin_options.firewall_driver == 'openvswitch',
-        "Openvswitch agent is required to run this test")
+        CONF.neutron_plugin_options.firewall_driver in ['openvswitch', 'ovn'],
+        "Openvswitch agent or Ml2/OVN is required to run this test")
     @decorators.idempotent_id('678dd4c0-2953-4626-b89c-8e7e4110ec4b')
     @tempest_utils.requires_ext(extension="address-group", service="network")
     @tempest_utils.requires_ext(
@@ -949,8 +956,8 @@
         self._test_remote_group()
 
     @testtools.skipUnless(
-        CONF.neutron_plugin_options.firewall_driver == 'openvswitch',
-        "Openvswitch agent is required to run this test")
+        CONF.neutron_plugin_options.firewall_driver in ['openvswitch', 'ovn'],
+        "Openvswitch agent or Ml2/OVN is required to run this test")
     @decorators.idempotent_id('9fae530d-2711-4c61-a4a5-8efe6e58ab14')
     @tempest_utils.requires_ext(extension="address-group", service="network")
     @tempest_utils.requires_ext(
diff --git a/neutron_tempest_plugin/scenario/test_vlan_transparency.py b/neutron_tempest_plugin/scenario/test_vlan_transparency.py
index 85648bc..11ff510 100644
--- a/neutron_tempest_plugin/scenario/test_vlan_transparency.py
+++ b/neutron_tempest_plugin/scenario/test_vlan_transparency.py
@@ -123,8 +123,8 @@
             self, port_security=True, use_allowed_address_pairs=False):
         self._ensure_ethtype()
         vlan_tag = data_utils.rand_int_id(start=MIN_VLAN_ID, end=MAX_VLAN_ID)
-        vlan_ipmask_template = '192.168.%d.{ip_last_byte}/24' % (vlan_tag %
-                                                                 256)
+        vtag = vlan_tag % 256
+        vlan_ipmask_template = '192.%d.%d.{ip_last_byte}/24' % (vtag, vtag)
         vms = []
         vlan_ipmasks = []
         floating_ips = []
diff --git a/releasenotes/notes/advance-image-ubuntu-jammy-2204-11b5ee414d665b66.yaml b/releasenotes/notes/advance-image-ubuntu-jammy-2204-11b5ee414d665b66.yaml
new file mode 100644
index 0000000..49d7652
--- /dev/null
+++ b/releasenotes/notes/advance-image-ubuntu-jammy-2204-11b5ee414d665b66.yaml
@@ -0,0 +1,5 @@
+---
+other:
+  - |
+    The testing advanced image used in some jobs has been bumped from Ubuntu
+    Focal 20.04 to Ubuntu Jammy 22.04.
diff --git a/test-requirements.txt b/test-requirements.txt
index ebde755..924f9ae 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,7 +2,6 @@
 
 coverage>=4.4.1 # Apache-2.0
 flake8-import-order>=0.18.0,<0.19.0 # LGPLv3
-python-subunit>=1.0.0 # Apache-2.0/BSD
 oslotest>=3.2.0 # Apache-2.0
 stestr>=1.0.0 # Apache-2.0
 testtools>=2.2.0 # MIT
diff --git a/tools/customize_ubuntu_image b/tools/customize_ubuntu_image
index cb96b17..1ded664 100755
--- a/tools/customize_ubuntu_image
+++ b/tools/customize_ubuntu_image
@@ -67,6 +67,21 @@
     bind_dir "/dev/pts" "${mount_dir}/dev/pts"
     bind_dir "/proc" "${mount_dir}/proc"
     bind_dir "/sys" "${mount_dir}/sys"
+    if [ -f /etc/apt/sources.list ]; then
+      mirror=$(grep -oP 'https?://\K[^/ ]+' /etc/apt/sources.list|head -1)
+      if sudo test -f ${mount_dir}/etc/apt/sources.list.d/ubuntu.sources; then
+          sudo sed -Ei "s|(http[s]?://)([^/]+)|\1${mirror}|g" ${mount_dir}/etc/apt/sources.list.d/ubuntu.sources
+          sudo sed -i "/URIs:/a Trusted: yes" ${mount_dir}/etc/apt/sources.list.d/ubuntu.sources
+      elif sudo test -f ${mount_dir}/etc/apt/sources.list; then
+          source <(sudo cat ${mount_dir}/etc/os-release)
+          sudo tee ${mount_dir}/etc/apt/sources.list <<EOF
+          deb [ trusted=yes ] https://${mirror}/ubuntu ${UBUNTU_CODENAME} main universe
+          deb [ trusted=yes ] https://${mirror}/ubuntu ${UBUNTU_CODENAME}-updates main universe
+          deb [ trusted=yes ] https://${mirror}/ubuntu ${UBUNTU_CODENAME}-backports main universe
+          deb [ trusted=yes ] https://${mirror}/ubuntu ${UBUNTU_CODENAME}-security main universe
+EOF
+      fi
+    fi
 
     # Mount to keep temporary files out of guest image
     mkdir -p "${temp_dir}/apt" "${temp_dir}/cache" "${temp_dir}/tmp"
diff --git a/zuul.d/2023_1_jobs.yaml b/zuul.d/2023_1_jobs.yaml
index cedbc67..d69054c 100644
--- a/zuul.d/2023_1_jobs.yaml
+++ b/zuul.d/2023_1_jobs.yaml
@@ -216,6 +216,11 @@
           (^neutron_tempest_plugin.scenario)|\
           (^tempest.api.compute.servers.test_attach_interfaces)|\
           (^tempest.api.compute.servers.test_multiple_create)"
+      # NOTE(liushy): This branch of Neutron does not support
+      # the address_group feature for the OVN driver.
+      tempest_exclude_regex: "\
+          (^neutron_tempest_plugin.scenario.test_security_groups.StatefulNetworkSecGroupTest.test_remote_group_and_remote_address_group)|\
+          (^neutron_tempest_plugin.scenario.test_security_groups.StatelessNetworkSecGroupIPv4Test.test_remote_group_and_remote_address_group)"
       devstack_localrc:
         NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_ovn) | join(',') }}"
         NEUTRON_DEPLOY_MOD_WSGI: false
diff --git a/zuul.d/2024_2_jobs.yaml b/zuul.d/2024_2_jobs.yaml
index f42bdbf..e19767c 100644
--- a/zuul.d/2024_2_jobs.yaml
+++ b/zuul.d/2024_2_jobs.yaml
@@ -214,7 +214,8 @@
       # TODO(jlibosva): Remove the NetworkWritableMtuTest test from the list
       # once east/west fragmentation is supported in core OVN
       tempest_exclude_regex: "\
-          (^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest)"
+          (^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest)|\
+          (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)"
       devstack_localrc:
         NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_ovn) | join(',') }}"
         NEUTRON_DEPLOY_MOD_WSGI: false
diff --git a/zuul.d/2025_1_jobs.yaml b/zuul.d/2025_1_jobs.yaml
index b34db9f..d4093f0 100644
--- a/zuul.d/2025_1_jobs.yaml
+++ b/zuul.d/2025_1_jobs.yaml
@@ -183,6 +183,18 @@
     name: neutron-tempest-plugin-ovn-ubuntu-jammy-2025-1
     parent: neutron-tempest-plugin-ovn-2025-1
     nodeset: neutron-nested-virt-ubuntu-jammy
+    vars:
+      # NOTE(ralonsoh): The advance image used "ubuntu-22.04-minimal" has a reported issue (LP#2110520)
+      # with the IGMP report messages. Because of that and because ML2/OVN has "igmp_snooping_enable"
+      # set, the receiver VM cannot subscribe to the IGMP group nor receive any IGMP message.
+      # NOTE(ykarel) Known issue in OVN version included in OVN jammy
+      # https://bugs.launchpad.net/neutron/+bug/2112620, skipping random failing tests
+      # neutron_tempest_plugin.scenario.test_vlan_transparency
+      # neutron_tempest_plugin.scenario.test_security_groups
+      tempest_exclude_regex: "\
+        (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)|\
+        (^neutron_tempest_plugin.scenario.test_vlan_transparency)|\
+        (^neutron_tempest_plugin.scenario.test_security_groups)"
 
 - job:
     name: neutron-tempest-plugin-dvr-multinode-scenario-2025-1
diff --git a/zuul.d/master_jobs.yaml b/zuul.d/master_jobs.yaml
index 3d4f0e9..232f0a1 100644
--- a/zuul.d/master_jobs.yaml
+++ b/zuul.d/master_jobs.yaml
@@ -26,11 +26,11 @@
         USE_PYTHON3: true
         NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_tempest) | join(',') }}"
         PHYSICAL_NETWORK: public
-        IMAGE_URLS: https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img
+        IMAGE_URLS: https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
         CIRROS_VERSION: 0.6.3
         DEFAULT_IMAGE_NAME: cirros-0.6.3-x86_64-uec
         DEFAULT_IMAGE_FILE_NAME: cirros-0.6.3-x86_64-uec.tar.gz
-        ADVANCED_IMAGE_NAME: ubuntu-20.04-minimal-cloudimg-amd64
+        ADVANCED_IMAGE_NAME: ubuntu-22.04-minimal-cloudimg-amd64
         ADVANCED_INSTANCE_TYPE: ntp_image_256M
         ADVANCED_INSTANCE_USER: ubuntu
         CUSTOMIZE_IMAGE: true
@@ -610,6 +610,11 @@
         OVN_DBS_LOG_LEVEL: dbg
         ENABLE_TLS: True
         OVN_IGMP_SNOOPING_ENABLE: True
+      # NOTE(ralonsoh): The advance image used "ubuntu-22.04-minimal" has a reported issue (LP#2110520)
+      # with the IGMP report messages. Because of that and because ML2/OVN has "igmp_snooping_enable"
+      # set, the receiver VM cannot subscribe to the IGMP group nor receive any IGMP message.
+      tempest_exclude_regex: "\
+        (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)"
       devstack_services:
         br-ex-tcpdump: true
         br-int-flows: true
@@ -722,13 +727,6 @@
       - ^zuul.d/.*_jobs\.yaml$
       - ^zuul.d/base-nested-switch.yaml
 
-# TODO(slaweq): remove that job's definition as soon as new job
-# "neutron-tempest-plugin-ovn" will be used in the neutron-lib repo as
-# instead of old "neutron-tempest-plugin-api" job
-- job:
-    name: neutron-tempest-plugin-api
-    parent: neutron-tempest-plugin-ovn
-
 - job:  # Needed only in Neutron stable/2024.2
     name: neutron-tempest-plugin-api-ovs-wsgi
     parent: neutron-tempest-plugin-openvswitch
@@ -778,8 +776,8 @@
         CIRROS_VERSION: 0.6.3
         DEFAULT_IMAGE_NAME: cirros-0.6.3-x86_64-uec
         DEFAULT_IMAGE_FILE_NAME: cirros-0.6.3-x86_64-uec.tar.gz
-        IMAGE_URLS: https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img
-        ADVANCED_IMAGE_NAME: ubuntu-20.04-minimal-cloudimg-amd64
+        IMAGE_URLS: https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
+        ADVANCED_IMAGE_NAME: ubuntu-22.04-minimal-cloudimg-amd64
         ADVANCED_INSTANCE_TYPE: ntp_image_256M
         ADVANCED_INSTANCE_USER: ubuntu
         CUSTOMIZE_IMAGE: true
@@ -1148,6 +1146,7 @@
     required-projects:
       - openstack/networking-bagpipe
       - openstack/networking-bgpvpn
+    timeout: 10800
     vars:
       devstack_services:
         # Disable OVN services
@@ -1358,12 +1357,6 @@
               driver: openvswitch
     irrelevant-files: *fwaas_irrelevant_files
 
-# TODO(slaweq):
-# Remove this alias once jobs in fwaas project will be moved to the new names
-- job:
-    name: neutron-tempest-plugin-fwaas
-    parent: neutron-tempest-plugin-fwaas-openvswitch
-
 - job:
     name: neutron-tempest-plugin-vpnaas
     parent: neutron-tempest-plugin-base
diff --git a/zuul.d/victoria_jobs.yaml b/zuul.d/victoria_jobs.yaml
index c7bc886..aebafda 100644
--- a/zuul.d/victoria_jobs.yaml
+++ b/zuul.d/victoria_jobs.yaml
@@ -233,7 +233,9 @@
           (^tempest.api.compute.servers.test_attach_interfaces)|\
           (^tempest.api.compute.servers.test_multiple_create)"
       # NOTE(ralonsoh): ``NetworkWritableMtuTest`` excluded because of https://bugs.launchpad.net/neutron/+bug/2082344
-      tempest_exclude_regex: "^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*"
+      tempest_exclude_regex: "\
+          (^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*)|\
+          (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)"
       network_api_extensions: *api_extensions
       devstack_localrc:
         NETWORK_API_EXTENSIONS: "{{ network_api_extensions | join(',') }}"
diff --git a/zuul.d/wallaby_jobs.yaml b/zuul.d/wallaby_jobs.yaml
index 5b35bbc..bd3b74f 100644
--- a/zuul.d/wallaby_jobs.yaml
+++ b/zuul.d/wallaby_jobs.yaml
@@ -178,7 +178,9 @@
           (^tempest.api.compute.servers.test_attach_interfaces)|\
           (^tempest.api.compute.servers.test_multiple_create)"
       # NOTE(ralonsoh): ``NetworkWritableMtuTest`` excluded because of https://bugs.launchpad.net/neutron/+bug/2082344
-      tempest_exclude_regex: "^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*"
+      tempest_exclude_regex: "\
+          (^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*)|\
+          (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)"
       network_api_extensions: *api_extensions
       devstack_localrc:
         NETWORK_API_EXTENSIONS: "{{ network_api_extensions | join(',') }}"
diff --git a/zuul.d/xena_jobs.yaml b/zuul.d/xena_jobs.yaml
index b03b6c5..847c611 100644
--- a/zuul.d/xena_jobs.yaml
+++ b/zuul.d/xena_jobs.yaml
@@ -174,7 +174,9 @@
           (^tempest.api.compute.servers.test_attach_interfaces)|\
           (^tempest.api.compute.servers.test_multiple_create)"
       # NOTE(ralonsoh): ``NetworkWritableMtuTest`` excluded because of https://bugs.launchpad.net/neutron/+bug/2082344
-      tempest_exclude_regex: "^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*"
+      tempest_exclude_regex: "\
+          (^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*)|\
+          (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)"
       network_api_extensions: *api_extensions
       devstack_localrc:
         NETWORK_API_EXTENSIONS: "{{ network_api_extensions | join(',') }}"
diff --git a/zuul.d/yoga_jobs.yaml b/zuul.d/yoga_jobs.yaml
index be6c65e..2c18450 100644
--- a/zuul.d/yoga_jobs.yaml
+++ b/zuul.d/yoga_jobs.yaml
@@ -6,8 +6,12 @@
     required-projects: &required-projects-yoga
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
-        override-checkout: 2.6.0
+        override-checkout: yoga-last
       - openstack/tempest
+      - name: openstack/designate-tempest-plugin
+        override-checkout: yoga-last
+      - name: openstack/designate
+        override-checkout: yoga-eol
     vars:
       devstack_localrc:
         NEUTRON_DEPLOY_MOD_WSGI: false
@@ -181,12 +185,17 @@
           (^tempest.api.compute.servers.test_multiple_create)"
       # NOTE(ralonsoh): tests disabled because of https://bugs.launchpad.net/neutron/+bug/2082070
       # NOTE(ralonsoh): ``NetworkWritableMtuTest`` excluded because of https://bugs.launchpad.net/neutron/+bug/2082344
+      # NOTE(liushy): This branch of Neutron does not support
+      # the address_group feature for the OVN driver.
       tempest_exclude_regex: "\
           (neutron_tempest_plugin.scenario.test_security_groups.StatelessNetworkSecGroupIPv4Test.test_connectivity_between_vms_using_different_sec_groups)|\
           (neutron_tempest_plugin.scenario.test_security_groups.StatelessNetworkSecGroupIPv4Test.test_packets_of_any_connection_state_can_reach_dest)|\
           (neutron_tempest_plugin.scenario.test_vlan_transparency.VlanTransparencyTest.test_vlan_transparent_allowed_address_pairs)|\
           (neutron_tempest_plugin.scenario.test_vlan_transparency.VlanTransparencyTest.test_vlan_transparent_port_sec_disabled)|\
-          (neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*)"
+          (neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*)|\
+          (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)|\
+          (neutron_tempest_plugin.scenario.test_security_groups.StatefulNetworkSecGroupTest.test_remote_group_and_remote_address_group)|\
+          (neutron_tempest_plugin.scenario.test_security_groups.StatelessNetworkSecGroupIPv4Test.test_remote_group_and_remote_address_group)"
       network_api_extensions: *api_extensions
       network_api_extensions_ovn:
         - vlan-transparent
diff --git a/zuul.d/zed_jobs.yaml b/zuul.d/zed_jobs.yaml
index 9ae2d87..fe98935 100644
--- a/zuul.d/zed_jobs.yaml
+++ b/zuul.d/zed_jobs.yaml
@@ -189,12 +189,17 @@
           (^tempest.api.compute.servers.test_multiple_create)"
       # NOTE(ralonsoh): tests disabled because of https://bugs.launchpad.net/neutron/+bug/2082070
       # NOTE(ralonsoh): ``NetworkWritableMtuTest`` excluded because of https://bugs.launchpad.net/neutron/+bug/2082344
+      # NOTE(liushy): This branch of Neutron does not support
+      # the address_group feature for the OVN driver.
       tempest_exclude_regex: "\
           (neutron_tempest_plugin.scenario.test_security_groups.StatelessNetworkSecGroupIPv4Test.test_connectivity_between_vms_using_different_sec_groups)|\
           (neutron_tempest_plugin.scenario.test_security_groups.StatelessNetworkSecGroupIPv4Test.test_packets_of_any_connection_state_can_reach_dest)|\
           (neutron_tempest_plugin.scenario.test_vlan_transparency.VlanTransparencyTest.test_vlan_transparent_allowed_address_pairs)|\
           (neutron_tempest_plugin.scenario.test_vlan_transparency.VlanTransparencyTest.test_vlan_transparent_port_sec_disabled)|\
-          (neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*)"
+          (neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest.*)|\
+          (^neutron_tempest_plugin.scenario.test_multicast.MulticastTestIPv4.test_multicast_between_vms_on_same_network)|\
+          (neutron_tempest_plugin.scenario.test_security_groups.StatefulNetworkSecGroupTest.test_remote_group_and_remote_address_group)|\
+          (neutron_tempest_plugin.scenario.test_security_groups.StatelessNetworkSecGroupIPv4Test.test_remote_group_and_remote_address_group)"
       network_api_extensions: *api_extensions
       network_api_extensions_ovn:
         - vlan-transparent