---

# TODO(paweł_zadrożny) remove voting:false from all noc-tempest* jobs
# when all defects are fixed, add them as well to gate.

# TODO(kamil_mankowski) enable voting check-requirements
# when contrail-api-client will be in OpenStack global requirements list.
# Details: https://docs.openstack.org/project-team-guide/dependency-management.html

# TODO(kamil_mankowski) python 3 support is dropped due to incompatibility with
# contrail-api-client. When this works with Py3, enable tests for python3
# and configure tox envs integration, cover, lower-constraints to use Python 3

- project:
    templates:
      - build-openstack-docs-pti
      - openstack-lower-constraints-jobs-neutron
      - openstack-python-jobs-neutron
      # - openstack-python35-jobs-neutron
      # - openstack-python36-jobs-neutron
      # - check-requirements
      - openstack-cover-jobs-neutron
    check:
      jobs:
        - noc-integration:
            voting: false
        - noc-tempest:
            voting: false
        - noc-tempest-neutron-plugin:
            voting: false
        - requirements-check:
            voting: false
    periodic:
      jobs:
        - noc-integration:
            branches:
              - master
              - ^stable/[a-z]+$
        - noc-tempest-neutron-plugin:
            branches:
              - master
              - ^stable/[a-z]+$

- job:
    name: noc-base
    parent: devstack-tempest
    description: Networking-OpenContrail base job
    post-run: playbooks/zuul/post.yaml
    nodeset: devstack-single-node-centos-7
    roles:
      - zuul: openstack/devstack
    timeout: 10080
    irrelevant-files:
      - ^.*\.rst$
      - ^doc/.*$
      - ^releasenotes/.*$
    required-projects:
      - openstack/devstack-gate
      - openstack/tempest
      - openstack/neutron-tempest-plugin
      - x/networking-opencontrail
      - openstack/glance
      - openstack/keystone
      - openstack/neutron
      - openstack/nova
    vars:
      devstack_plugins:
        networking-opencontrail: https://opendev.org/x/networking-opencontrail
      devstack_base_dir: /opt/stack
      devstack_localrc:
        DEBUG: true
        ADMIN_PASSWORD: admin
        HOST_IP: "{{hostvars['controller'].ansible_default_ipv4.address}}"
        SERVICE_HOST: "{{hostvars['controller'].ansible_default_ipv4.address}}"
        OPENCONTRAIL_APISERVER_IP: "{{hostvars['controller'].ansible_default_ipv4.address}}"
        OPENCONTRAIL_APISERVER_PORT: 8082
        Q_USE_SECGROUP: true
        Q_PLUGIN: ml2
        Q_ML2_TENANT_NETWORK_TYPE: vlan
        Q_ML2_PLUGIN_MECHANISM_DRIVERS: opencontrail
        NEUTRON_CREATE_INITIAL_NETWORKS: false
        PUBLIC_PHYSICAL_NETWORK: public
        PHYSICAL_NETWORK: default
        PROVIDER_NETWORK_TYPE: vlan
        USE_SSL: false
        FLOATING_RANGE: 172.24.0.0/16
        PUBLIC_NETWORK_GATEWAY: 172.24.0.1
      devstack_services:
        # Shared services
        dstat: true
        etcd3: true
        mysql: true
        peakmem_tracker: true
        rabbit: true
        tls-proxy: false
        # Keystone services
        key: true
        # Glance services
        g-api: true
        g-reg: true
        # Nova services
        n-api: true
        n-api-meta: true
        n-cauth: true
        n-cond: true
        n-cpu: true
        n-novnc: true
        n-obj: true
        n-sch: true
        placement-api: true
        # Neutron services
        # We need to keep using the neutron-legacy based services for
        # now until all issues with the new lib/neutron code are solved
        q-agt: true
        q-dhcp: true
        q-l3: true
        q-meta: true
        q-metering: true
        q-svc: true
        # neutron-api: true
        # neutron-agent: true
        # neutron-dhcp: true
        # neutron-l3: true
        # neutron-metadata-agent: true
        # neutron-metering: true
        # Swift services
        s-account: false
        s-container: false
        s-object: false
        s-proxy: false
        # Cinder services
        c-api: false
        c-bak: false
        c-sch: false
        c-vol: false
        cinder: false
        # Services we don't need.
        # This section is not really needed, it's for readability.
        horizon: false
        tempest: true
      devstack_local_conf:
        post-config:
          $NEUTRON_CONF:
            DEFAULT:
              router_scheduler_driver: neutron.scheduler.l3_agent_scheduler.LeastRoutersScheduler
              router_auto_schedule: true
              enable_snat_by_default: false
            quotas:
              # A negative value means unlimited. (integer value)
              quota_network: -1
              quota_subnet: -1
              quota_port: -1
              quota_router: -1
              quota_floatingip: -1
              quota_security_group: -1
              quota_security_group_rule: -1
          $NEUTRON_CORE_PLUGIN_CONF:
            ml2:
              type_drivers: vlan,local,gre,vxlan
              tenant_network_types: vlan,local
              extension_drivers: port_security
              mechanism_drivers: opencontrail,openvswitch,linuxbridge
            ml2_type_vlan:
              network_vlan_ranges: public:1:1000,vhost:1:1000

- job:
    name: noc-integration
    parent: noc-base
    description: Integration tests between devstack and opencontrail
    run: playbooks/zuul/noc-integration.yaml
    vars:
      tox_envlist: integration
    post-run: playbooks/zuul/post-integration.yaml

- job:
    name: noc-tempest
    parent: noc-base
    description: Tempest network tests
    run: playbooks/zuul/noc-tempest.yaml
    vars:
      devstack_local_conf:
        test-config:
          $TEMPEST_CONFIG:
            network:
              project_networks_reachable: true
      tox_envlist: all-plugin
      tempest_test_regex: (?x)^tempest\.(api|scenario).*$
      tempest_test_blacklist: "{{devstack_base_dir}}/networking-opencontrail/tempest-blacklist.txt"

- job:
    name: noc-tempest-neutron-plugin
    parent: noc-tempest
    description: Tempest neutron plugin tests
    vars:
      devstack_local_conf:
        test-config:
          $TEMPEST_CONFIG:
            network:
              project_networks_reachable: true
            neutron_plugin_options:
              available_type_drivers: vlan,local
      devstack_plugins:
        networking-opencontrail: https://opendev.org/x/networking-opencontrail
        neutron-tempest-plugin: https://opendev.org/openstack/neutron-tempest-plugin
      tempest_test_regex: (?x)^neutron_tempest_plugin.*$
