Merge "Skip scenario tests if HA router will not be active"
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 784d031..fad85ad 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -352,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)
@@ -364,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/stein_jobs.yaml b/zuul.d/stein_jobs.yaml
index 28729a4..7a8ea25 100644
--- a/zuul.d/stein_jobs.yaml
+++ b/zuul.d/stein_jobs.yaml
@@ -144,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
@@ -163,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
@@ -188,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