Merge "Unset new rolevar for run-tempest role for rocky jobs"
diff --git a/neutron_tempest_plugin/api/test_ports_negative.py b/neutron_tempest_plugin/api/test_ports_negative.py
index e327c25..004feb9 100644
--- a/neutron_tempest_plugin/api/test_ports_negative.py
+++ b/neutron_tempest_plugin/api/test_ports_negative.py
@@ -54,10 +54,13 @@
     @decorators.idempotent_id('7cf473ae-7ec8-4834-ae17-9ef6ec6b8a32')
     def test_add_port_with_nonexist_network_id(self):
         network = self.network
+        # Copy and restore net ID so the cleanup will delete correct net
+        original_network_id = network['id']
         network['id'] = uuidutils.generate_uuid()
         self.assertRaises(lib_exc.NotFound,
                           self.create_port,
                           network)
+        network['id'] = original_network_id
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('cad2d349-25fa-490e-9675-cd2ea24164bc')
diff --git a/neutron_tempest_plugin/api/test_qos_negative.py b/neutron_tempest_plugin/api/test_qos_negative.py
index f6c4afc..f4d6636 100644
--- a/neutron_tempest_plugin/api/test_qos_negative.py
+++ b/neutron_tempest_plugin/api/test_qos_negative.py
@@ -110,6 +110,15 @@
             non_exist_id, rule['id'], max_kbps=200, max_burst_kbps=1337)
 
     @decorators.attr(type='negative')
+    @decorators.idempotent_id('1b592566-745f-4e15-a439-073afe341244')
+    def test_rule_create_rule_non_existent_policy(self):
+        non_exist_id = data_utils.rand_name('qos_policy')
+        self.assertRaises(
+            lib_exc.NotFound,
+            self.admin_client.create_bandwidth_limit_rule,
+            non_exist_id, max_kbps=200, max_burst_kbps=300)
+
+    @decorators.attr(type='negative')
     @decorators.idempotent_id('a2c72066-0c32-4f28-be7f-78fa721588b6')
     def test_rule_update_rule_nonexistent_rule(self):
         non_exist_id = data_utils.rand_name('qos_rule')
diff --git a/neutron_tempest_plugin/common/ip.py b/neutron_tempest_plugin/common/ip.py
index 7b172b0..9fe49db 100644
--- a/neutron_tempest_plugin/common/ip.py
+++ b/neutron_tempest_plugin/common/ip.py
@@ -383,6 +383,23 @@
     return arp_table
 
 
+def list_iptables(version=constants.IP_VERSION_4, namespace=None):
+    cmd = ''
+    if namespace:
+        cmd = 'sudo ip netns exec %s ' % namespace
+    cmd += ('iptables-save' if version == constants.IP_VERSION_4 else
+            'ip6tables-save')
+    return shell.execute(cmd).stdout
+
+
+def list_listening_sockets(namespace=None):
+    cmd = ''
+    if namespace:
+        cmd = 'sudo ip netns exec %s ' % namespace
+    cmd += 'netstat -nlp'
+    return shell.execute(cmd).stdout
+
+
 class Route(HasProperties,
             collections.namedtuple('Route',
                                    ['dest', 'properties'])):
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index c29585f..fad85ad 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -222,12 +222,18 @@
 
         error_msg = (
             "Router %s is not active on any of the L3 agents" % router_id)
-        # NOTE(slaweq): timeout here should be lower for sure, but due to
-        # the bug https://launchpad.net/bugs/1923633 let's wait even 10
-        # minutes until router will be active on some of the L3 agents
-        utils.wait_until_true(_router_active_on_l3_agent,
-                              timeout=600, sleep=5,
-                              exception=lib_exc.TimeoutException(error_msg))
+        # NOTE(slaweq): Due to bug
+        # the bug https://launchpad.net/bugs/1923633 let's temporary skip test
+        # if router will not become active on any of the L3 agents in 600
+        # seconds. When that bug will be fixed, we should get rid of that skip
+        # and lower timeout to e.g. 300 seconds, or even less
+        try:
+            utils.wait_until_true(
+                _router_active_on_l3_agent,
+                timeout=600, sleep=5,
+                exception=lib_exc.TimeoutException(error_msg))
+        except lib_exc.TimeoutException:
+            raise cls.skipException("Bug 1923633. %s" % error_msg)
 
     @classmethod
     def skip_if_no_extension_enabled_in_l3_agents(cls, extension):
@@ -346,7 +352,9 @@
         try:
             local_ips = ip_utils.IPCommand(namespace=ns_name).list_addresses()
             local_routes = ip_utils.IPCommand(namespace=ns_name).list_routes()
-            arp_table = ip_utils.arp_table()
+            arp_table = ip_utils.arp_table(namespace=ns_name)
+            iptables = ip_utils.list_iptables(namespace=ns_name)
+            lsockets = ip_utils.list_listening_sockets(namespace=ns_name)
         except exceptions.ShellCommandFailed:
             LOG.debug('Namespace %s has been deleted synchronously during the '
                       'host network collection process', ns_name)
@@ -358,6 +366,8 @@
                   ns_name, '\n'.join(str(r) for r in local_routes))
         LOG.debug('Namespace %s; Local ARP table:\n%s',
                   ns_name, '\n'.join(str(r) for r in arp_table))
+        LOG.debug('Namespace %s; Local iptables:\n%s', ns_name, iptables)
+        LOG.debug('Namespace %s; Listening sockets:\n%s', ns_name, lsockets)
 
     def _check_remote_connectivity(self, source, dest, count,
                                    should_succeed=True,
diff --git a/neutron_tempest_plugin/scenario/test_dns_integration.py b/neutron_tempest_plugin/scenario/test_dns_integration.py
index e5995c0..5c590eb 100644
--- a/neutron_tempest_plugin/scenario/test_dns_integration.py
+++ b/neutron_tempest_plugin/scenario/test_dns_integration.py
@@ -42,7 +42,7 @@
 
 
 class BaseDNSIntegrationTests(base.BaseTempestTestCase, DNSMixin):
-    credentials = ['primary']
+    credentials = ['primary', 'admin']
 
     @classmethod
     def setup_clients(cls):
diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml
index 7ee20dc..04fe323 100644
--- a/zuul.d/base.yaml
+++ b/zuul.d/base.yaml
@@ -7,7 +7,6 @@
     roles:
       - zuul: openstack/devstack
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - openstack/neutron-tempest-plugin
       - openstack/tempest
diff --git a/zuul.d/master_jobs.yaml b/zuul.d/master_jobs.yaml
index 4f32c5e..e9599bf 100644
--- a/zuul.d/master_jobs.yaml
+++ b/zuul.d/master_jobs.yaml
@@ -452,7 +452,6 @@
     roles:
       - zuul: openstack/devstack
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - openstack/neutron-tempest-plugin
       - openstack/tempest
@@ -681,12 +680,26 @@
     parent: neutron-tempest-plugin-base
     timeout: 10800
     required-projects:
-      - openstack/devstack-gate
       - openstack/networking-sfc
       - openstack/neutron
       - openstack/neutron-tempest-plugin
       - openstack/tempest
     vars:
+      devstack_services:
+        # Disable OVN services
+        br-ex-tcpdump: false
+        br-int-flows: false
+        ovn-controller: false
+        ovn-northd: false
+        ovs-vswitchd: false
+        ovsdb-server: false
+        q-ovn-metadata-agent: false
+        # Enable Neutron services that are not used by OVN
+        q-agt: true
+        q-dhcp: true
+        q-l3: true
+        q-meta: true
+        q-metering: true
       network_api_extensions_common: *api_extensions
       tempest_test_regex: ^neutron_tempest_plugin\.sfc
       devstack_plugins:
@@ -696,6 +709,9 @@
         - flow_classifier
         - sfc
       devstack_localrc:
+        Q_AGENT: openvswitch
+        Q_ML2_TENANT_NETWORK_TYPE: vxlan
+        Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
         NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_sfc) | join(',') }}"
       # TODO(bcafarel): tests still fail from time to time in parallel
       # https://bugs.launchpad.net/neutron/+bug/1851500
@@ -709,12 +725,30 @@
       - openstack/networking-bagpipe
       - openstack/networking-bgpvpn
     vars:
+      devstack_services:
+        # Disable OVN services
+        br-ex-tcpdump: false
+        br-int-flows: false
+        ovn-controller: false
+        ovn-northd: false
+        ovs-vswitchd: false
+        ovsdb-server: false
+        q-ovn-metadata-agent: false
+        # Enable Neutron services that are not used by OVN
+        q-agt: true
+        q-dhcp: true
+        q-l3: true
+        q-meta: true
+        q-metering: true
       tempest_test_regex: ^neutron_tempest_plugin\.bgpvpn
       network_api_extensions: *api_extensions
       network_api_extensions_bgpvpn:
         - bgpvpn
         - bgpvpn-routes-control
       devstack_localrc:
+        Q_AGENT: openvswitch
+        Q_ML2_TENANT_NETWORK_TYPE: vxlan
+        Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
         NETWORKING_BGPVPN_DRIVER: "BGPVPN:BaGPipe:networking_bgpvpn.neutron.services.service_drivers.bagpipe.bagpipe_v2.BaGPipeBGPVPNDriver:default"
         BAGPIPE_DATAPLANE_DRIVER_IPVPN: "ovs"
         BAGPIPE_BGP_PEERS: "-"
@@ -773,7 +807,6 @@
     parent: neutron-tempest-plugin-base
     timeout: 3900
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - openstack/neutron-vpnaas
       - openstack/neutron-tempest-plugin
diff --git a/zuul.d/queens_jobs.yaml b/zuul.d/queens_jobs.yaml
index b4c22bc..33430c8 100644
--- a/zuul.d/queens_jobs.yaml
+++ b/zuul.d/queens_jobs.yaml
@@ -4,7 +4,6 @@
     parent: neutron-tempest-plugin-api
     override-checkout: stable/queens
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 0.3.0
@@ -115,7 +114,6 @@
     nodeset: openstack-single-node-xenial
     override-checkout: stable/queens
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 0.3.0
@@ -152,7 +150,6 @@
       - zuul: openstack/neutron
     override-checkout: stable/queens
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 0.3.0
@@ -203,7 +200,6 @@
     nodeset: openstack-two-node-xenial
     override-checkout: stable/queens
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 0.3.0
@@ -229,7 +225,6 @@
     nodeset: openstack-single-node-xenial
     override-checkout: stable/queens
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 0.3.0
diff --git a/zuul.d/rocky_jobs.yaml b/zuul.d/rocky_jobs.yaml
index fd44caa..c5ccbc0 100644
--- a/zuul.d/rocky_jobs.yaml
+++ b/zuul.d/rocky_jobs.yaml
@@ -6,7 +6,6 @@
       This job run on py2 for stable/rocky gate.
     override-checkout: stable/rocky
     required-projects: &required-projects-rocky
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 0.9.0
@@ -597,7 +596,6 @@
     nodeset: openstack-single-node-xenial
     override-checkout: stable/rocky
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 0.9.0
diff --git a/zuul.d/stein_jobs.yaml b/zuul.d/stein_jobs.yaml
index 8db4508..7a8ea25 100644
--- a/zuul.d/stein_jobs.yaml
+++ b/zuul.d/stein_jobs.yaml
@@ -4,7 +4,6 @@
     nodeset: openstack-single-node-bionic
     override-checkout: stable/stein
     required-projects: &required-projects-stein
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 1.3.0
@@ -145,18 +144,55 @@
 
 - job:
     name: neutron-tempest-plugin-scenario-openvswitch-iptables_hybrid-stein
-    parent: neutron-tempest-plugin-scenario-openvswitch-iptables_hybrid
+    parent: neutron-tempest-plugin-scenario
     nodeset: openstack-single-node-bionic
+    timeout: 10000
     override-checkout: stable/stein
     required-projects: *required-projects-stein
     vars:
       branch_override: stable/stein
+      devstack_services:
+        # Disable OVN services
+        br-ex-tcpdump: false
+        br-int-flows: false
+        ovn-controller: false
+        ovn-northd: false
+        ovs-vswitchd: false
+        ovsdb-server: false
+        q-ovn-metadata-agent: false
+        # Neutron services
+        q-agt: true
+        q-dhcp: true
+        q-l3: true
+        q-meta: true
+        q-metering: true
       network_api_extensions: *api_extensions
       network_available_features: *available_features
+      # TODO(slaweq): remove trunks subport_connectivity test from blacklist
+      # when bug https://bugs.launchpad.net/neutron/+bug/1838760 will be fixed
+      tempest_black_regex: "(^neutron_tempest_plugin.scenario.test_trunk.TrunkTest.test_subport_connectivity)"
       devstack_localrc:
+        Q_AGENT: openvswitch
+        Q_ML2_TENANT_NETWORK_TYPE: vxlan
+        Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
         NETWORK_API_EXTENSIONS: "{{ network_api_extensions | join(',') }}"
       devstack_local_conf:
         post-config:
+          $NEUTRON_CONF:
+            DEFAULT:
+              enable_dvr: false
+              l3_ha: true
+          # NOTE(slaweq): We can get rid of this hardcoded absolute path when
+          # devstack-tempest job will be switched to use lib/neutron instead of
+          # lib/neutron-legacy
+          /$NEUTRON_CORE_PLUGIN_CONF:
+            agent:
+              tunnel_types: vxlan,gre
+            ovs:
+              tunnel_bridge: br-tun
+              bridge_mappings: public:br-ex
+            securitygroup:
+              firewall_driver: iptables_hybrid
           $NEUTRON_L3_CONF:
             DEFAULT:
               # NOTE(slaweq): on Bionic keepalived don't knows this option yet
@@ -164,24 +200,84 @@
         test-config:
           $TEMPEST_CONFIG:
             network-feature-enabled:
-              available_features: ""
+              available_features: "{{ network_available_features | join(',') }}"
             neutron_plugin_options:
+              available_type_drivers: flat,vlan,local,vxlan
+              firewall_driver: iptables_hybrid
               ipv6_metadata: False
+    irrelevant-files:
+      - ^(test-|)requirements.txt$
+      - ^releasenotes/.*$
+      - ^doc/.*$
+      - ^setup.cfg$
+      - ^.*\.rst$
+      - ^neutron/locale/.*$
+      - ^neutron/tests/unit/.*$
+      - ^tools/.*$
+      - ^tox.ini$
+      - ^neutron/agent/linux/openvswitch_firewall/.*$
+      - ^neutron/agent/ovn/.*$
+      - ^neutron/agent/windows/.*$
+      - ^neutron/plugins/ml2/drivers/linuxbridge/.*$
+      - ^neutron/plugins/ml2/drivers/macvtap/.*$
+      - ^neutron/plugins/ml2/drivers/mech_sriov/.*$
+      - ^neutron/plugins/ml2/drivers/ovn/.*$
 
 - job:
     name: neutron-tempest-plugin-scenario-linuxbridge-stein
-    parent: neutron-tempest-plugin-scenario-linuxbridge
+    parent: neutron-tempest-plugin-scenario
     nodeset: openstack-single-node-bionic
+    timeout: 10000
+    roles:
+      - zuul: openstack/neutron
+    pre-run: playbooks/linuxbridge-scenario-pre-run.yaml
     override-checkout: stable/stein
     required-projects: *required-projects-stein
     vars:
       branch_override: stable/stein
+      devstack_services:
+        # Disable OVN services
+        br-ex-tcpdump: false
+        br-int-flows: false
+        ovn-controller: false
+        ovn-northd: false
+        ovs-vswitchd: false
+        ovsdb-server: false
+        q-ovn-metadata-agent: false
+        # Neutron services
+        q-agt: true
+        q-dhcp: true
+        q-l3: true
+        q-meta: true
+        q-metering: true
       network_api_extensions: *api_extensions
+      network_api_extensions_linuxbridge:
+        - vlan-transparent
       network_available_features: *available_features
+      # TODO(eolivare): remove VLAN Transparency tests from blacklist
+      # when bug https://bugs.launchpad.net/neutron/+bug/1907548 will be fixed
+      tempest_black_regex: "(^neutron_tempest_plugin.scenario.test_vlan_transparency.VlanTransparencyTest)"
       devstack_localrc:
-        NETWORK_API_EXTENSIONS: "{{ network_api_extensions | join(',') }}"
+        Q_AGENT: linuxbridge
+        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions + network_api_extensions_linuxbridge) | join(',') }}"
+        Q_ML2_TENANT_NETWORK_TYPE: vxlan
+        Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch,linuxbridge
       devstack_local_conf:
         post-config:
+          $NEUTRON_CONF:
+            DEFAULT:
+              enable_dvr: false
+              vlan_transparent: true
+              l3_ha: true
+            AGENT:
+              debug_iptables_rules: true
+          # NOTE(slaweq): We can get rid of this hardcoded absolute path when
+          # devstack-tempest job will be switched to use lib/neutron instead of
+          # lib/neutron-legacy
+          /$NEUTRON_CORE_PLUGIN_CONF:
+            ml2:
+              type_drivers: flat,vlan,local,vxlan
+              mechanism_drivers: linuxbridge
           $NEUTRON_L3_CONF:
             DEFAULT:
               # NOTE(slaweq): on Bionic keepalived don't knows this option yet
@@ -189,9 +285,29 @@
         test-config:
           $TEMPEST_CONFIG:
             network-feature-enabled:
-              available_features: ""
+              available_features: "{{ network_available_features | join(',') }}"
             neutron_plugin_options:
+              available_type_drivers: flat,vlan,local,vxlan
+              q_agent: linuxbridge
+              firewall_driver: iptables
               ipv6_metadata: False
+    irrelevant-files:
+      - ^(test-|)requirements.txt$
+      - ^releasenotes/.*$
+      - ^doc/.*$
+      - ^setup.cfg$
+      - ^.*\.rst$
+      - ^neutron/locale/.*$
+      - ^neutron/tests/unit/.*$
+      - ^tools/.*$
+      - ^tox.ini$
+      - ^neutron/agent/linux/openvswitch_firewall/.*$
+      - ^neutron/agent/ovn/.*$
+      - ^neutron/agent/windows/.*$
+      - ^neutron/plugins/ml2/drivers/openvswitch/.*$
+      - ^neutron/plugins/ml2/drivers/macvtap/.*$
+      - ^neutron/plugins/ml2/drivers/mech_sriov/.*$
+      - ^neutron/plugins/ml2/drivers/ovn/.*$
 
 - job:
     name: neutron-tempest-plugin-dvr-multinode-scenario-stein
@@ -209,7 +325,6 @@
     nodeset: openstack-single-node-bionic
     override-checkout: stable/stein
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron
       - name: openstack/neutron-tempest-plugin
         override-checkout: 1.3.0
diff --git a/zuul.d/ussuri_jobs.yaml b/zuul.d/ussuri_jobs.yaml
index 88f64b6..945ec25 100644
--- a/zuul.d/ussuri_jobs.yaml
+++ b/zuul.d/ussuri_jobs.yaml
@@ -263,7 +263,6 @@
     timeout: 10800
     override-checkout: stable/ussuri
     required-projects:
-      - openstack/devstack-gate
       - openstack/neutron-fwaas
       - openstack/neutron
       - openstack/neutron-tempest-plugin