Merge "Enable Octavia API audit logging for API jobs"
diff --git a/octavia_tempest_plugin/config.py b/octavia_tempest_plugin/config.py
index b683ee3..1d874a6 100644
--- a/octavia_tempest_plugin/config.py
+++ b/octavia_tempest_plugin/config.py
@@ -51,7 +51,7 @@
                help='Time in seconds between build status checks for '
                     'non-load-balancer resources to build'),
     cfg.IntOpt('build_timeout',
-               default=60,
+               default=300,
                help='Timeout in seconds to wait for non-load-balancer '
                     'resources to build'),
     # load-balancer specific options
@@ -144,3 +144,12 @@
                default=None,
                help='Availability zone to use for creating servers.'),
 ]
+
+lb_feature_enabled_group = cfg.OptGroup(name='loadbalancer-feature-enabled',
+                                        title='Enabled/Disabled LB features')
+LBFeatureEnabledGroup = [
+    cfg.BoolOpt('health_monitor_enabled',
+                default=True,
+                help="Whether Health Monitor is available with provider"
+                     " driver or not."),
+]
diff --git a/octavia_tempest_plugin/plugin.py b/octavia_tempest_plugin/plugin.py
index 5aae722..ec093e7 100644
--- a/octavia_tempest_plugin/plugin.py
+++ b/octavia_tempest_plugin/plugin.py
@@ -35,6 +35,9 @@
                                   project_config.ServiceAvailableGroup)
         config.register_opt_group(conf, project_config.octavia_group,
                                   project_config.OctaviaGroup)
+        config.register_opt_group(conf,
+                                  project_config.lb_feature_enabled_group,
+                                  project_config.LBFeatureEnabledGroup)
 
     def get_opt_lists(self):
         return [
@@ -42,6 +45,8 @@
              project_config.ServiceAvailableGroup),
             (project_config.octavia_group.name,
              project_config.OctaviaGroup),
+            (project_config.lb_feature_enabled_group.name,
+             project_config.LBFeatureEnabledGroup)
         ]
 
     def get_service_clients(self):
diff --git a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
index 4a43e7b..4887995 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
@@ -34,6 +34,12 @@
     """Test the healthmonitor object API."""
 
     @classmethod
+    def skip_checks(cls):
+        super(HealthMonitorAPITest, cls).skip_checks()
+        if not CONF.loadbalancer_feature_enabled.health_monitor_enabled:
+            cls.skip('Health Monitors not supported')
+
+    @classmethod
     def resource_setup(cls):
         """Setup resources needed by the tests."""
         super(HealthMonitorAPITest, cls).resource_setup()
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py b/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py
index 02cec6e..7b769e1 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py
@@ -29,6 +29,12 @@
 class HealthMonitorScenarioTest(test_base.LoadBalancerBaseTest):
 
     @classmethod
+    def skip_checks(cls):
+        super(HealthMonitorScenarioTest, cls).skip_checks()
+        if not CONF.loadbalancer_feature_enabled.health_monitor_enabled:
+            cls.skip('Health Monitors not supported')
+
+    @classmethod
     def resource_setup(cls):
         """Setup resources needed by the tests."""
         super(HealthMonitorScenarioTest, cls).resource_setup()
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 691dfba..425adbd 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -1,3 +1,36 @@
+- nodeset:
+    name: octavia-two-node
+    nodes:
+      - name: controller
+        label: ubuntu-xenial
+      - name: controller2
+        label: ubuntu-xenial
+    groups:
+      - name: controller
+        nodes:
+          - controller
+      # Node where tests are executed and test results collected
+      - name: tempest
+        nodes:
+          - controller
+      # Nodes running the compute service
+      - name: compute
+        nodes:
+          - controller
+          - controller2
+      # Nodes that are not the controller
+      - name: subnode
+        nodes:
+          - controller2
+      # Switch node for multinode networking setup
+      - name: switch
+        nodes:
+          - controller
+      # Peer nodes for multinode networking setup
+      - name: peers
+        nodes:
+          - controller2
+
 - job:
     name: octavia-dsvm-base
     parent: devstack-tempest
@@ -16,6 +49,7 @@
     vars:
       devstack_localrc:
         TEMPEST_PLUGINS: "'/opt/stack/octavia-tempest-plugin'"
+        USE_PYTHON3: true
       devstack_local_conf:
         post-config:
           $OCTAVIA_CONF:
@@ -46,7 +80,7 @@
         s-proxy: false
         tempest: true
       devstack_plugins:
-        octavia: https://github.com/openstack/octavia.git
+        octavia: https://git.openstack.org/openstack/octavia.git
 
 - job:
     name: octavia-dsvm-live-base
@@ -63,8 +97,146 @@
         barbican: true
         neutron-qos: true
       devstack_plugins:
-        barbican: https://github.com/openstack/barbican.git
-        neutron: https://github.com/openstack/neutron.git
+        barbican: https://git.openstack.org/openstack/barbican.git
+        neutron: https://git.openstack.org/openstack/neutron.git
+      zuul_copy_output:
+        '/var/log/dib-build' : logs
+
+- job:
+    name: octavia-dsvm-live-two-node-base
+    parent: octavia-dsvm-base
+    nodeset: octavia-two-node
+    timeout: 9000
+    required-projects:
+      - openstack/barbican
+      - openstack/diskimage-builder
+      - openstack/python-barbicanclient
+    host-vars:
+      controller:
+        devstack_localrc:
+          # From devstack "vars:"
+          DATABASE_USER: octavia
+          DATABASE_PASSWORD: octavia_database_pw
+          RABBIT_PASSWORD: octavia_rabbit_pw
+          ADMIN_PASSWORD: octavia_admin_pw
+          SERVICE_PASSWORD: octavia_service_pw
+          NETWORK_GATEWAY: 10.1.0.1
+          FIXED_RANGE: 10.1.0.0/20
+          IPV4_ADDRS_SAFE_TO_USE: 10.1.0.0/20
+          FLOATING_RANGE: 172.24.5.0/24
+          PUBLIC_NETWORK_GATEWAY: 172.24.5.1
+          LOGFILE: /opt/stack/logs/devstacklog.txt
+          LOG_COLOR: false
+          VERBOSE: true
+          VERBOSE_NO_TIMESTAMP: true
+          NOVNC_FROM_PACKAGE: true
+          ERROR_ON_CLONE: true
+          MULTI_HOST: 1
+          SERVICE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
+          HOST_IP: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
+          TEMPEST_PLUGINS: "'/opt/stack/octavia-tempest-plugin'"
+          USE_PYTHON3: true
+          # Octavia specific settings
+          OCTAVIA_CONTROLLER_IP_PORT_LIST: 192.168.0.3:5555,192.168.0.4:5555
+          OCTAVIA_MGMT_PORT_IP: 192.168.0.3
+          OCTAVIA_NODE: main
+          OCTAVIA_NODES: "main:{{ hostvars['controller']['nodepool']['private_ipv4'] }},second:{{ hostvars['controller2']['nodepool']['private_ipv4'] }}"
+          OCTAVIA_USE_PREGENERATED_CERTS: true
+        devstack_plugins:
+          barbican: https://git.openstack.org/openstack/barbican.git
+          neutron: https://git.openstack.org/openstack/neutron.git
+          octavia: https://git.openstack.org/openstack/octavia.git
+      controller2:
+        devstack_localrc:
+          # From devstack "vars:"
+          DATABASE_USER: octavia
+          DATABASE_PASSWORD: octavia_database_pw
+          RABBIT_PASSWORD: octavia_rabbit_pw
+          ADMIN_PASSWORD: octavia_admin_pw
+          SERVICE_PASSWORD: octavia_service_pw
+          NETWORK_GATEWAY: 10.1.0.1
+          FIXED_RANGE: 10.1.0.0/20
+          IPV4_ADDRS_SAFE_TO_USE: 10.1.0.0/20
+          FLOATING_RANGE: 172.24.5.0/24
+          PUBLIC_NETWORK_GATEWAY: 172.24.5.1
+          LOGFILE: /opt/stack/logs/devstacklog.txt
+          LOG_COLOR: false
+          VERBOSE: true
+          VERBOSE_NO_TIMESTAMP: true
+          NOVNC_FROM_PACKAGE: true
+          ERROR_ON_CLONE: true
+          MULTI_HOST: 1
+          HOST_IP: "{{ hostvars['controller2']['nodepool']['private_ipv4'] }}"
+          SERVICE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
+          NEUTRON_SERVICE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
+          DATABASE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
+          RABBIT_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
+          GLANCE_HOSTPORT: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}:9292"
+          USE_PYTHON3: true
+          # Octavia specific settings
+          OCTAVIA_CONTROLLER_IP_PORT_LIST: 192.168.0.3:5555,192.168.0.4:5555
+          OCTAVIA_NODE: subnode
+          OCTAVIA_USE_PREGENERATED_CERTS: true
+          OCTAVIA_MGMT_PORT_IP: 192.168.0.4
+        devstack_plugins:
+          octavia: https://git.openstack.org/openstack/octavia.git
+    group-vars:
+      controller:
+        devstack_local_conf:
+          post-config:
+            $OCTAVIA_CONF:
+              DEFAULT:
+                debug: True
+              api_settings:
+                api_v1_enabled: False
+        devstack_services:
+          base: false
+          barbican: true
+          dstat: true
+          g-api: true
+          g-reg: true
+          key: true
+          mysql: true
+          n-api: true
+          n-api-meta: true
+          n-cauth: true
+          n-cond: true
+          n-cpu: true
+          n-obj: true
+          n-sch: true
+          neutron-qos: true
+          octavia: true
+          o-api-ha: true
+          o-api: true
+          o-cw: true
+          o-hm: true
+          o-hk: true
+          peakmem_tracker: true
+          placement-api: true
+          q-agt: true
+          q-dhcp: true
+          q-l3: true
+          q-meta: true
+          q-svc: true
+          rabbit: true
+          tempest: true
+          tls-proxy: true
+      subnode:
+        devstack_local_conf:
+          post-config:
+            $OCTAVIA_CONF:
+              DEFAULT:
+                debug: True
+              api_settings:
+                api_v1_enabled: False
+        devstack_services:
+          c-vol: false
+          c-bak: false
+          octavia: true
+          o-api: true
+          o-cw: true
+          o-hm: true
+          o-hk: true
 
 - job:
     name: octavia-dsvm-noop-base
@@ -106,11 +278,21 @@
       tox_envlist: all
 
 - job:
-    name: octavia-v2-dsvm-noop-py35-api
+    name: octavia-v2-dsvm-noop-py2-api
     parent: octavia-v2-dsvm-noop-api
     vars:
       devstack_localrc:
-        USE_PYTHON3: true
+        USE_PYTHON3: False
+
+- job:
+    name: octavia-v2-dsvm-noop-py2-api-stable-rocky
+    parent: octavia-v2-dsvm-noop-py2-api
+    override-checkout: stable/rocky
+
+- job:
+    name: octavia-v2-dsvm-noop-py2-api-stable-queens
+    parent: octavia-v2-dsvm-noop-py2-api
+    override-checkout: stable/queens
 
 - job:
     name: octavia-v2-dsvm-scenario
@@ -126,14 +308,44 @@
       tox_envlist: all
 
 - job:
-    name: octavia-v2-dsvm-py35-scenario
+    name: octavia-v2-dsvm-py2-scenario
     parent: octavia-v2-dsvm-scenario
     vars:
       devstack_localrc:
-        USE_PYTHON3: true
+        USE_PYTHON3: False
+
 - job:
-    name: octavia-v2-dsvm-scenario-centos-7
-    parent: octavia-v2-dsvm-scenario
+    name: octavia-v2-dsvm-py2-scenario-stable-rocky
+    parent: octavia-v2-dsvm-py2-scenario
+    override-checkout: stable/rocky
+
+- job:
+    name: octavia-v2-dsvm-py2-scenario-stable-queens
+    parent: octavia-v2-dsvm-py2-scenario
+    override-checkout: stable/queens
+
+- job:
+    name: octavia-v2-dsvm-scenario-two-node
+    parent: octavia-dsvm-live-two-node-base
+    vars:
+      tempest_concurrency: 2
+      tempest_test_regex: ^octavia_tempest_plugin.tests.scenario.v2
+      tox_envlist: all
+
+- job:
+    name: octavia-v2-dsvm-py2-scenario-two-node
+    parent: octavia-v2-dsvm-scenario-two-node
+    host-vars:
+      controller:
+        devstack_localrc:
+          USE_PYTHON3: False
+      controller2:
+        devstack_localrc:
+          USE_PYTHON3: False
+
+- job:
+    name: octavia-v2-dsvm-py2-scenario-centos-7
+    parent: octavia-v2-dsvm-py2-scenario
     nodeset: devstack-single-node-centos-7
     vars:
       devstack_localrc:
@@ -148,3 +360,17 @@
       devstack_localrc:
         OCTAVIA_AMP_BASE_OS: ubuntu
         OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID: bionic
+
+# Temporary transitional aliases for gates used in other repos
+# Remove once octavia has transitioned job names
+- job:
+    name: octavia-v2-dsvm-noop-py35-api
+    parent: octavia-v2-dsvm-noop-api
+
+- job:
+    name: octavia-v2-dsvm-py35-scenario
+    parent: octavia-v2-dsvm-scenario
+
+- job:
+    name: octavia-v2-dsvm-scenario-centos-7
+    parent: octavia-v2-dsvm-py2-scenario-centos-7
diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml
index 2064db5..94aa8c1 100644
--- a/zuul.d/projects.yaml
+++ b/zuul.d/projects.yaml
@@ -8,17 +8,29 @@
     check:
       jobs:
         - octavia-v2-dsvm-noop-api
-        - octavia-v2-dsvm-noop-py35-api
+        - octavia-v2-dsvm-noop-py2-api
+        - octavia-v2-dsvm-noop-py2-api-stable-rocky
+        - octavia-v2-dsvm-noop-py2-api-stable-queens
         - octavia-v2-dsvm-scenario
-        - octavia-v2-dsvm-py35-scenario
-        - octavia-v2-dsvm-scenario-centos-7
+        - octavia-v2-dsvm-py2-scenario
+        - octavia-v2-dsvm-py2-scenario-stable-rocky
+        - octavia-v2-dsvm-py2-scenario-stable-queens
+        - octavia-v2-dsvm-scenario-centos-7:
+            voting: false
         - octavia-v2-dsvm-scenario-ubuntu-bionic:
             voting: false
+        - octavia-v2-dsvm-scenario-two-node:
+            voting: false
+        - octavia-v2-dsvm-py2-scenario-two-node:
+            voting: false
     gate:
       queue: octavia
       jobs:
         - octavia-v2-dsvm-noop-api
-        - octavia-v2-dsvm-noop-py35-api
+        - octavia-v2-dsvm-noop-py2-api
+        - octavia-v2-dsvm-noop-py2-api-stable-rocky
+        - octavia-v2-dsvm-noop-py2-api-stable-queens
         - octavia-v2-dsvm-scenario
-        - octavia-v2-dsvm-py35-scenario
-        - octavia-v2-dsvm-scenario-centos-7
+        - octavia-v2-dsvm-py2-scenario
+        - octavia-v2-dsvm-py2-scenario-stable-rocky
+        - octavia-v2-dsvm-py2-scenario-stable-queens