Consolidate neutron-tempest-plugin-api with scenario jobs

That way we will run our API tests on the ML2/{OVS,OVN,Linuxbridge}
deployments which will give us slightly better coverage in some cases as
some API extensions may be available only with some specific backends
(see NDPProxy for example, which isn't available on the ML2/OVN case).

This will also allow us to drop neutron-tempest-plugin-api job and
having less jobs with same or better coverage is always good thing :)

Change-Id: Ie34e89636c56783000b4d72a479c23d8d1295002
diff --git a/zuul.d/master_jobs.yaml b/zuul.d/master_jobs.yaml
index b3601c1..56bd6b2 100644
--- a/zuul.d/master_jobs.yaml
+++ b/zuul.d/master_jobs.yaml
@@ -1,7 +1,53 @@
 - job:
-    name: neutron-tempest-plugin-api
-    parent: neutron-tempest-plugin-base
+    name: neutron-tempest-plugin-base
+    parent: devstack-tempest
+    abstract: true
+    description: |
+      Perform setup common to all Neutron tempest tests
+    roles:
+      - zuul: openstack/devstack
+    required-projects:
+      - openstack/neutron
+      - openstack/neutron-tempest-plugin
+      - openstack/tempest
     vars:
+      tempest_concurrency: 3  # out of 4
+      tox_envlist: all
+      # NOTE(slaweq): in case of some tests, which requires advanced image,
+      # default test timeout set to 1200 seconds may be not enough if job is
+      # run on slow node
+      tempest_test_timeout: 2400
+      tempest_test_regex: "\
+          (^neutron_tempest_plugin.api)|\
+          (^neutron_tempest_plugin.scenario)|\
+          (^tempest.api.compute.servers.test_attach_interfaces)|\
+          (^tempest.api.compute.servers.test_multiple_create)"
+      devstack_localrc:
+        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
+        CIRROS_VERSION: 0.5.1
+        DEFAULT_IMAGE_NAME: cirros-0.5.1-x86_64-uec
+        DEFAULT_IMAGE_FILE_NAME: cirros-0.5.1-x86_64-uec.tar.gz
+        ADVANCED_IMAGE_NAME: ubuntu-20.04-minimal-cloudimg-amd64
+        ADVANCED_INSTANCE_TYPE: ntp_image_256M
+        ADVANCED_INSTANCE_USER: ubuntu
+        CUSTOMIZE_IMAGE: true
+        BUILD_TIMEOUT: 784
+        # TODO(lucasagomes): Re-enable MOD_WSGI after
+        # https://bugs.launchpad.net/neutron/+bug/1912359 is implemented
+        NEUTRON_DEPLOY_MOD_WSGI: false
+        # TODO(ralonsoh): remove OVN_BUILD_FROM_SOURCE once the OS packages
+        # include at least OVN v20.12.0.
+        OVN_BUILD_FROM_SOURCE: True
+        OVN_BRANCH: "v21.03.0"
+        OVS_BRANCH: "8dc1733eaea866dce033b3c44853e1b09bf59fc7"
+      devstack_plugins:
+        neutron: https://opendev.org/openstack/neutron.git
+        neutron-tempest-plugin: https://opendev.org/openstack/neutron-tempest-plugin.git
+      tempest_plugins:
+        - neutron-tempest-plugin
       # 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
@@ -36,7 +82,6 @@
         - l3-flavors
         - l3-ha
         - l3_agent_scheduler
-        - logging
         - metering
         - multi-provider
         - net-mtu
@@ -54,7 +99,6 @@
         - project-id
         - provider
         - qos
-        - qos-bw-minimum-ingress
         - qos-fip
         - quotas
         - quota_details
@@ -64,7 +108,6 @@
         - rbac-security-groups
         - rbac-subnetpool
         - router
-        - router-admin-state-down-before-update
         - router_availability_zone
         - security-group
         - security-groups-remote-address-group
@@ -85,33 +128,67 @@
         - trunk
         - trunk-details
         - uplink-status-propagation
-      network_api_extensions_tempest:
-        - dvr
-      network_available_features: &available_features
-        - ipv6_metadata
-      tempest_test_regex: ^neutron_tempest_plugin\.api
       devstack_services:
+        tempest: true
+        neutron-dns: true
         neutron-log: true
-      devstack_localrc:
-        # TODO(lucasagomes): Re-enable MOD_WSGI after
-        # https://bugs.launchpad.net/neutron/+bug/1912359 is implemented
-        NEUTRON_DEPLOY_MOD_WSGI: false
-        # TODO(ralonsoh): remove OVN_BUILD_FROM_SOURCE once the OS packages
-        # include at least OVN v20.12.0.
-        OVN_BUILD_FROM_SOURCE: True
-        OVN_BRANCH: "v21.03.0"
-        OVS_BRANCH: "8dc1733eaea866dce033b3c44853e1b09bf59fc7"
-        NETWORK_API_EXTENSIONS: "{{ network_api_extensions_common | join(',') }}"
+        neutron-qos: true
+        neutron-segments: true
+        neutron-trunk: true
+        neutron-uplink-status-propagation: true
+        neutron-network-segment-range: true
+        neutron-port-forwarding: true
+        neutron-conntrack-helper: true
+        neutron-tag-ports-during-bulk-creation: true
+        br-ex-tcpdump: true
+        br-int-flows: true
+        # Cinder services
+        c-api: false
+        c-bak: false
+        c-sch: false
+        c-vol: false
+        cinder: false
+        # We don't need Swift to be run in the Neutron jobs
+        s-account: false
+        s-container: false
+        s-object: false
+        s-proxy: false
       devstack_local_conf:
         post-config:
+          $NEUTRON_CONF:
+            QUOTAS:
+              quota_router: 100
+              quota_floatingip: 500
+              quota_security_group: 150
+              quota_security_group_rule: 1000
           # 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: gre,vxlan
+            ml2:
+              type_drivers: flat,geneve,vlan,gre,local,vxlan
+            ml2_type_vlan:
+              network_vlan_ranges: foo:1:10
+            ml2_type_vxlan:
+              vni_ranges: 1:2000
+            ml2_type_gre:
+              tunnel_id_ranges: 1:1000
             network_log:
               local_output_log_base: /tmp/test_log.log
+          $NEUTRON_L3_CONF:
+            agent:
+              availability_zone: nova
+          $NEUTRON_DHCP_CONF:
+            agent:
+              availability_zone: nova
+        test-config:
+          $TEMPEST_CONFIG:
+            neutron_plugin_options:
+              provider_vlans: foo,
+              agent_availability_zone: nova
+              image_is_advanced: true
+              available_type_drivers: flat,geneve,vlan,gre,local,vxlan
+              provider_net_base_segm_id: 1
     irrelevant-files:
       - ^(test-|)requirements.txt$
       - lower-constraints.txt
@@ -135,8 +212,8 @@
       - ^zuul.d/(?!(project)).*\.yaml
 
 - job:
-    name: neutron-tempest-plugin-scenario-openvswitch
-    parent: neutron-tempest-plugin-scenario-nested-switch
+    name: neutron-tempest-plugin-openvswitch
+    parent: neutron-tempest-plugin-base-nested-switch
     timeout: 10000
     vars:
       devstack_services:
@@ -155,15 +232,16 @@
         q-l3: true
         q-meta: true
         q-metering: true
-      network_api_extensions: *api_extensions
       network_api_extensions_openvswitch:
         - local_ip
-      network_available_features: *available_features
+        - qos-bw-minimum-ingress
+      network_available_features: &available_features
+        - ipv6_metadata
       devstack_localrc:
         Q_AGENT: openvswitch
         Q_ML2_TENANT_NETWORK_TYPE: vxlan
         Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
-        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions + network_api_extensions_openvswitch) | join(',') }}"
+        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_openvswitch) | join(',') }}"
       devstack_local_conf:
         post-config:
           $NEUTRON_CONF:
@@ -224,8 +302,8 @@
       - ^zuul.d/(?!(project)).*\.yaml
 
 - job:
-    name: neutron-tempest-plugin-scenario-openvswitch-iptables_hybrid
-    parent: neutron-tempest-plugin-scenario-nested-switch
+    name: neutron-tempest-plugin-openvswitch-iptables_hybrid
+    parent: neutron-tempest-plugin-base-nested-switch
     timeout: 10000
     vars:
       devstack_services:
@@ -244,9 +322,9 @@
         q-l3: true
         q-meta: true
         q-metering: true
-      network_api_extensions: *api_extensions
       network_api_extensions_openvswitch:
         - local_ip
+        - logging
       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
@@ -259,7 +337,7 @@
         Q_AGENT: openvswitch
         Q_ML2_TENANT_NETWORK_TYPE: vxlan
         Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch
-        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions + network_api_extensions_openvswitch) | join(',') }}"
+        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_openvswitch) | join(',') }}"
       devstack_local_conf:
         post-config:
           $NEUTRON_CONF:
@@ -321,9 +399,17 @@
       - ^vagrant/.*$
       - ^zuul.d/(?!(project)).*\.yaml
 
+# TODO(slaweq): remove that job's definition as soon as new job
+# "neutron-tempest-plugin-openvswitch-iptables_hybrid" will be used in the
+# neutron repo as a parent for a
+# "neutron-ovs-tempest-plugin-scenario-iptables_hybrid-nftables" job
 - job:
-    name: neutron-tempest-plugin-scenario-openvswitch-distributed-dhcp
-    parent: neutron-tempest-plugin-scenario-openvswitch
+    name: neutron-tempest-plugin-scenario-openvswitch-iptables_hybrid
+    parent: neutron-tempest-plugin-openvswitch-iptables_hybrid
+
+- job:
+    name: neutron-tempest-plugin-openvswitch-distributed-dhcp
+    parent: neutron-tempest-plugin-openvswitch
     timeout: 10000
     vars:
       # NOTE: DHCP extra options and dns services aren't supported with
@@ -336,8 +422,8 @@
         q-distributed-dhcp: true
 
 - job:
-    name: neutron-tempest-plugin-scenario-openvswitch-iptables_hybrid-distributed-dhcp
-    parent: neutron-tempest-plugin-scenario-openvswitch-iptables_hybrid
+    name: neutron-tempest-plugin-openvswitch-iptables_hybrid-distributed-dhcp
+    parent: neutron-tempest-plugin-openvswitch-iptables_hybrid
     timeout: 10000
     vars:
       # NOTE: DHCP extra options and dns services aren't supported with
@@ -350,8 +436,8 @@
         q-distributed-dhcp: true
 
 - job:
-    name: neutron-tempest-plugin-scenario-linuxbridge
-    parent: neutron-tempest-plugin-scenario-nested-switch
+    name: neutron-tempest-plugin-linuxbridge
+    parent: neutron-tempest-plugin-base-nested-switch
     timeout: 10000
     roles:
       - zuul: openstack/neutron
@@ -372,7 +458,8 @@
         q-l3: true
         q-meta: true
         q-metering: true
-      network_api_extensions: *api_extensions
+        # SG logging isn't supported by linuxbridge backend
+        neutron-log: false
       network_api_extensions_linuxbridge:
         - vlan-transparent
       network_available_features: *available_features
@@ -391,7 +478,7 @@
           (^neutron_tempest_plugin.scenario.test_floatingip.FloatingIPPortDetailsTest.test_floatingip_port_details)"
       devstack_localrc:
         Q_AGENT: linuxbridge
-        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions + network_api_extensions_linuxbridge) | join(',') }}"
+        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_linuxbridge) | join(',') }}"
         Q_ML2_TENANT_NETWORK_TYPE: vxlan
         Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch,linuxbridge
       devstack_local_conf:
@@ -456,12 +543,18 @@
       - ^vagrant/.*$
       - ^zuul.d/(?!(project)).*\.yaml
 
+# TODO(slaweq): remove that job's definition as soon as new job
+# "neutron-tempest-plugin-linuxbridge" will be used in the neutron repo as
+# a parent for a "neutron-linuxbridge-tempest-plugin-scenario-nftables" job
 - job:
-    name: neutron-tempest-plugin-scenario-ovn
-    parent: neutron-tempest-plugin-scenario-nested-switch
+    name: neutron-tempest-plugin-scenario-linuxbridge
+    parent: neutron-tempest-plugin-linuxbridge
+
+- job:
+    name: neutron-tempest-plugin-ovn
+    parent: neutron-tempest-plugin-base-nested-switch
     timeout: 10800
     vars:
-      network_api_extensions: *api_extensions
       network_api_extensions_ovn:
         - vlan-transparent
       # TODO(jlibosva): Remove the NetworkWritableMtuTest test from the list
@@ -470,12 +563,11 @@
           (^neutron_tempest_plugin.scenario.test_mtu.NetworkWritableMtuTest)"
       devstack_localrc:
         Q_AGENT: ovn
-        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions + network_api_extensions_ovn) | join(',') }}"
+        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_ovn) | join(',') }}"
         Q_ML2_PLUGIN_MECHANISM_DRIVERS: ovn,logger
         Q_ML2_PLUGIN_TYPE_DRIVERS: local,flat,vlan,geneve
         Q_ML2_TENANT_NETWORK_TYPE: geneve
         Q_USE_PROVIDERNET_FOR_PUBLIC: true
-        PHYSICAL_NETWORK: public
         # NOTE(slaweq): In the job with OVN backend we can't use Ubuntu minimal
         # image because kernel in that image don't supports MULTICAST traffic
         # thus multicast scenario test with IGMP snooping enabled would fail
@@ -542,6 +634,9 @@
         '{{ devstack_base_dir }}/data/ovn': 'logs'
         '{{ devstack_log_dir }}/ovsdb-server-nb.log': 'logs'
         '{{ devstack_log_dir }}/ovsdb-server-sb.log': 'logs'
+        '/var/log/ovn': 'logs'
+        '/var/log/openvswitch': 'logs'
+        '/var/lib/ovn': 'logs'
     irrelevant-files:
       - ^(test-|)requirements.txt$
       - lower-constraints.txt
@@ -583,6 +678,13 @@
       - ^vagrant/.*$
       - ^zuul.d/(?!(project)).*\.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:
     name: neutron-tempest-plugin-dvr-multinode-scenario
     parent: tempest-multinode-full
@@ -774,7 +876,7 @@
 
 - job:
     name: neutron-tempest-plugin-designate-scenario
-    parent: neutron-tempest-plugin-scenario-nested-switch
+    parent: neutron-tempest-plugin-base-nested-switch
     description: Neutron designate integration scenario
     required-projects:
       - openstack/designate
@@ -850,7 +952,6 @@
         q-l3: true
         q-meta: true
         q-metering: true
-      network_api_extensions_common: *api_extensions
       tempest_test_regex: ^neutron_tempest_plugin\.sfc
       devstack_plugins:
         networking-sfc: https://opendev.org/openstack/networking-sfc
@@ -911,7 +1012,6 @@
         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
@@ -922,7 +1022,7 @@
         NETWORKING_BGPVPN_DRIVER: "BGPVPN:BaGPipe:networking_bgpvpn.neutron.services.service_drivers.bagpipe.bagpipe_v2.BaGPipeBGPVPNDriver:default"
         BAGPIPE_DATAPLANE_DRIVER_IPVPN: "ovs"
         BAGPIPE_BGP_PEERS: "-"
-        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions + network_api_extensions_bgpvpn) | join(',') }}"
+        NETWORK_API_EXTENSIONS: "{{ (network_api_extensions_common + network_api_extensions_bgpvpn) | join(',') }}"
       devstack_plugins:
         networking-bgpvpn: https://git.openstack.org/openstack/networking-bgpvpn
         networking-bagpipe: https://git.openstack.org/openstack/networking-bagpipe
@@ -962,7 +1062,6 @@
       devstack_plugins:
         neutron-dynamic-routing: https://opendev.org/openstack/neutron-dynamic-routing
         neutron-tempest-plugin: https://opendev.org/openstack/neutron-tempest-plugin
-      network_api_extensions_common: *api_extensions
       network_api_extensions_bgp:
         - bgp
         - bgp_dragent_scheduler
@@ -1022,11 +1121,11 @@
       - openstack/neutron-tempest-plugin
       - openstack/tempest
     vars:
+      tempest_concurrency: 4
       tempest_test_regex: ^neutron_tempest_plugin\.fwaas
       devstack_plugins:
         neutron-fwaas: https://opendev.org/openstack/neutron-fwaas.git
         neutron-tempest-plugin: https://opendev.org/openstack/neutron-tempest-plugin.git
-      network_api_extensions_common: *api_extensions
       network_api_extensions_fwaas:
         - fwaas_v2
       devstack_localrc:
@@ -1047,6 +1146,7 @@
         q-meta: true
         q-metering: true
         q-l3: true
+        neutron-log: false
     irrelevant-files:
       - ^(test-|)requirements.txt$
       - ^releasenotes/.*$
@@ -1142,7 +1242,6 @@
     vars:
       tempest_test_regex: ^neutron_tempest_plugin\.tap_as_a_service
       tox_envlist: all
-      network_api_extensions_common: *api_extensions
       network_api_extensions_tempest:
         - taas
         - taas-vlan-filter