From 067f4aea69ad862e1a51a1e6f6a1b50f0147176b Mon Sep 17 00:00:00 2001
From: Corey Bryant <corey.bryant@canonical.com>
Date: Tue, 14 Feb 2023 21:26:01 +0000
Subject: [PATCH] Add Antelope support

* sync charm-helpers to classic charms
* change openstack-origin/source default to antelope
* align testing with antelope
* add new antelope bundles
* add antelope bundles to tests.yaml
* add antelope tests to osci.yaml and .zuul.yaml
* update build-on and run-on bases

Change-Id: I4645af85c618f3da2a9a8b4030e48ce25233a560
---
 .zuul.yaml                                    |   2 +-
 charmcraft.yaml                               |   3 +
 metadata.yaml                                 |   1 +
 osci.yaml                                     |   2 +-
 test-requirements.txt                         |  25 +-
 tests/bundles/jammy-antelope.yaml             | 246 ++++++++++++++++++
 .../{jammy-yoga.yaml => lunar-antelope.yaml}  |   2 +-
 tests/tests.yaml                              |   9 +-
 tox.ini                                       |   2 +-
 9 files changed, 269 insertions(+), 23 deletions(-)
 create mode 100644 tests/bundles/jammy-antelope.yaml
 rename tests/bundles/{jammy-yoga.yaml => lunar-antelope.yaml} (99%)

diff --git a/.zuul.yaml b/.zuul.yaml
index 23bf5f6..fd20909 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,4 +1,4 @@
 - project:
     templates:
-      - openstack-python3-charm-zed-jobs
+      - openstack-python3-charm-jobs
       - openstack-cover-jobs
diff --git a/charmcraft.yaml b/charmcraft.yaml
index 192062a..12551d5 100644
--- a/charmcraft.yaml
+++ b/charmcraft.yaml
@@ -32,3 +32,6 @@ bases:
       - name: ubuntu
         channel: "22.10"
         architectures: [amd64, s390x, ppc64el, arm64]
+      - name: ubuntu
+        channel: "23.04"
+        architectures: [amd64, s390x, ppc64el, arm64]
diff --git a/metadata.yaml b/metadata.yaml
index 7860105..820b32f 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -18,6 +18,7 @@ tags:
 series:
   - jammy
   - kinetic
+  - lunar
 subordinate: true
 provides:
   manila-plugin:
diff --git a/osci.yaml b/osci.yaml
index fda24c4..b76871f 100644
--- a/osci.yaml
+++ b/osci.yaml
@@ -4,7 +4,7 @@
       # More work is needed on the functional jobs; they can't pass at the
       # moment as they need to set up hardware which isn't implemented yet.
       # See LP: #1922214
-      # - charm-zed-functional-jobs
+      # - charm-functional-jobs
     vars:
       needs_charm_build: true
       charm_build_name: manila-netapp
diff --git a/test-requirements.txt b/test-requirements.txt
index 9574e8e..f04967e 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -3,9 +3,7 @@
 # choices of *requirements.txt files for OpenStack Charms:
 #     https://github.com/openstack-charmers/release-tools
 #
-setuptools<50.0.0  # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
-# Lint and unit test requirements
-flake8>=2.2.4
+pyparsing<3.0.0  # aodhclient is pinned in zaza and needs pyparsing < 3.0.0, but cffi also needs it, so pin here.
 
 stestr>=2.2.0
 
@@ -23,24 +21,21 @@ coverage>=3.6
 git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack
 #
 # Revisit for removal / mock improvement:
+#
+# NOTE(lourot): newer versions of cryptography require a Rust compiler to build,
+# see
+# * https://github.com/openstack-charmers/zaza/issues/421
+# * https://mail.python.org/pipermail/cryptography-dev/2021-January/001003.html
+#
 netifaces        # vault
 psycopg2-binary  # vault
 tenacity         # vault
-pbr              # vault
-cryptography     # vault, keystone-saml-mellon
+pbr==5.6.0       # vault
+cryptography<3.4 # vault, keystone-saml-mellon
 lxml             # keystone-saml-mellon
 hvac             # vault, barbican-vault
-
-# pep8 requirements
-charm-tools>=2.4.4
-
-# Workaround until https://github.com/juju/charm-tools/pull/589 gets
-# published
-keyring<21
-
-# Functional Test Requirements (let Zaza's dependencies solve all dependencies here!)
+psutil           # cinder-lvm
 git+https://github.com/openstack-charmers/zaza.git#egg=zaza
 git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack
-
 ops
 git+https://opendev.org/openstack/charm-ops-openstack#egg=ops_openstack
diff --git a/tests/bundles/jammy-antelope.yaml b/tests/bundles/jammy-antelope.yaml
new file mode 100644
index 0000000..504b7c4
--- /dev/null
+++ b/tests/bundles/jammy-antelope.yaml
@@ -0,0 +1,246 @@
+variables:
+  openstack-origin: &openstack-origin cloud:jammy-antelope
+
+local_overlay_enabled: True
+
+series: jammy
+
+comment:
+- 'machines section to decide order of deployment. database sooner = faster'
+machines:
+  '0':
+    constraints: mem=3072M
+  '1':
+    constraints: mem=3072M
+  '2':
+    constraints: mem=3072M
+  '3':
+  '4':
+  '5':
+  '6':
+  '7':
+  '8':
+  '9':
+  # The following units are the nova compute units
+  '10':
+    constraints: mem=4G
+  '11':
+    constraints: mem=4G
+  '12':
+
+applications:
+  manila-mysql-router:
+    charm: ch:mysql-router
+    channel: latest/edge
+  keystone-mysql-router:
+    charm: ch:mysql-router
+    channel: latest/edge
+  neutron-api-mysql-router:
+    charm: ch:mysql-router
+    channel: latest/edge
+  nova-cloud-controller-mysql-router:
+    charm: ch:mysql-router
+    channel: latest/edge
+  glance-mysql-router:
+    charm: ch:mysql-router
+    channel: latest/edge
+  placement-mysql-router:
+    charm: ch:mysql-router
+    channel: latest/edge
+
+  mysql-innodb-cluster:
+    charm: ch:mysql-innodb-cluster
+    num_units: 3
+    options:
+      source: *openstack-origin
+    to:
+      - '0'
+      - '1'
+      - '2'
+    channel: latest/edge
+
+  nova-cloud-controller:
+    charm: ch:nova-cloud-controller
+    num_units: 1
+    options:
+      network-manager: Neutron
+      openstack-origin: *openstack-origin
+    to:
+      - '3'
+    channel: latest/edge
+
+  glance:
+    charm: ch:glance
+    num_units: 1
+    options:
+      openstack-origin: *openstack-origin
+    to:
+      - '4'
+    channel: latest/edge
+
+  neutron-api:
+    charm: ch:neutron-api
+    num_units: 1
+    options:
+      openstack-origin: *openstack-origin
+      manage-neutron-plugin-legacy-mode: true
+      neutron-plugin: ovs
+      flat-network-providers: physnet1
+      neutron-security-groups: true
+    to:
+      - '5'
+    channel: latest/edge
+
+  neutron-openvswitch:
+    charm: ch:neutron-openvswitch
+    channel: latest/edge
+
+  neutron-gateway:
+    charm: ch:neutron-gateway
+    num_units: 1
+    options:
+      openstack-origin: *openstack-origin
+      bridge-mappings: physnet1:br-ex
+    to:
+      - '6'
+    channel: latest/edge
+
+  keystone:
+    charm: ch:keystone
+    num_units: 1
+    options:
+      openstack-origin: *openstack-origin
+    to:
+      - '7'
+    channel: latest/edge
+
+  rabbitmq-server:
+    charm: ch:rabbitmq-server
+    num_units: 1
+    to:
+      - '8'
+    channel: latest/edge
+
+  placement:
+    charm: ch:placement
+    num_units: 1
+    options:
+      openstack-origin: *openstack-origin
+    to:
+      - '9'
+    channel: latest/edge
+
+  nova-compute:
+    charm: ch:nova-compute
+    num_units: 2
+    storage:
+      ephemeral-device: '40G'
+    options:
+      openstack-origin: *openstack-origin
+      config-flags: default_ephemeral_format=ext4
+    to:
+      - '10'
+      - '11'
+    channel: latest/edge
+
+  manila:
+    charm: ch:manila
+    num_units: 1
+    options:
+      openstack-origin: *openstack-origin
+      default-share-backend: netapp-ontap
+    to:
+      - '12'
+    channel: latest/edge
+
+  manila-netapp:
+    charm: ../../manila-netapp.charm
+    options:
+      share-backend-name: netapp-ontap
+      driver-handles-share-servers: False
+
+  manila-netapp-dhss:
+    charm: ../../manila-netapp.charm
+    options:
+      share-backend-name: netapp-ontap-dhss
+      driver-handles-share-servers: True
+
+relations:
+  - - 'manila:shared-db'
+    - 'manila-mysql-router:shared-db'
+  - - 'manila-mysql-router:db-router'
+    - 'mysql-innodb-cluster:db-router'
+  - - 'manila'
+    - 'rabbitmq-server'
+  - - 'manila'
+    - 'keystone'
+  - - 'manila:manila-plugin'
+    - 'manila-netapp:manila-plugin'
+  - - 'manila:manila-plugin'
+    - 'manila-netapp-dhss:manila-plugin'
+
+  - - 'keystone:shared-db'
+    - 'keystone-mysql-router:shared-db'
+  - - 'keystone-mysql-router:db-router'
+    - 'mysql-innodb-cluster:db-router'
+
+  - - 'neutron-api:shared-db'
+    - 'neutron-api-mysql-router:shared-db'
+  - - 'neutron-api-mysql-router:db-router'
+    - 'mysql-innodb-cluster:db-router'
+  - - 'neutron-api:amqp'
+    - 'rabbitmq-server:amqp'
+  - - 'neutron-api:identity-service'
+    - 'keystone:identity-service'
+  - - 'neutron-api:neutron-api'
+    - 'nova-cloud-controller:neutron-api'
+  - - 'neutron-api:neutron-plugin-api'
+    - 'neutron-gateway:neutron-plugin-api'
+
+  - - 'nova-cloud-controller:shared-db'
+    - 'nova-cloud-controller-mysql-router:shared-db'
+  - - 'nova-cloud-controller-mysql-router:db-router'
+    - 'mysql-innodb-cluster:db-router'
+  - - 'nova-cloud-controller:amqp'
+    - 'rabbitmq-server:amqp'
+  - - 'nova-cloud-controller:identity-service'
+    - 'keystone:identity-service'
+  - - 'nova-cloud-controller:cloud-compute'
+    - 'nova-compute:cloud-compute'
+  - - 'nova-cloud-controller:image-service'
+    - 'glance:image-service'
+  - - 'nova-cloud-controller:quantum-network-service'
+    - 'neutron-gateway:quantum-network-service'
+
+  - - 'nova-compute:amqp'
+    - 'rabbitmq-server:amqp'
+  - - 'nova-compute:image-service'
+    - 'glance:image-service'
+  - - 'nova-compute:neutron-plugin'
+    - 'neutron-openvswitch:neutron-plugin'
+
+  - - 'neutron-gateway:amqp'
+    - 'rabbitmq-server:amqp'
+
+  - - 'neutron-openvswitch:amqp'
+    - 'rabbitmq-server:amqp'
+
+  - - 'glance:shared-db'
+    - 'glance-mysql-router:shared-db'
+  - - 'glance-mysql-router:db-router'
+    - 'mysql-innodb-cluster:db-router'
+  - - 'glance:amqp'
+    - 'rabbitmq-server:amqp'
+  - - 'glance:identity-service'
+    - 'keystone:identity-service'
+
+  - - 'placement:shared-db'
+    - 'placement-mysql-router:shared-db'
+  - - 'placement-mysql-router:db-router'
+    - 'mysql-innodb-cluster:db-router'
+  - - 'placement:amqp'
+    - 'rabbitmq-server:amqp'
+  - - 'placement:identity-service'
+    - 'keystone:identity-service'
+  - - 'placement:placement'
+    - 'nova-cloud-controller:placement'
diff --git a/tests/bundles/jammy-yoga.yaml b/tests/bundles/lunar-antelope.yaml
similarity index 99%
rename from tests/bundles/jammy-yoga.yaml
rename to tests/bundles/lunar-antelope.yaml
index 8eb1d62..ebe9725 100644
--- a/tests/bundles/jammy-yoga.yaml
+++ b/tests/bundles/lunar-antelope.yaml
@@ -3,7 +3,7 @@ variables:
 
 local_overlay_enabled: True
 
-series: jammy
+series: lunar
 
 comment:
 - 'machines section to decide order of deployment. database sooner = faster'
diff --git a/tests/tests.yaml b/tests/tests.yaml
index 8d6c411..ed16463 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -1,17 +1,17 @@
 charm_name: manila-netapp
 
 gate_bundles:
-  - jammy-yoga
+  - jammy-zed
 
 dev_bundles:
-  - jammy-yoga
-  - jammy-zed
+  - jammy-antelope
   - kinetic-zed
+  - lunar-antelope
 
 # WARNING(lourot): func-smoke has been temporarily disabled in tox.ini. See
 # rationale there.
 smoke_bundles:
-  - jammy-yoga
+  - jammy-zed
 
 target_deploy_status: {}
 
@@ -32,4 +32,5 @@ tests:
 tests_options:
   force_deploy:
     - kinetic-zed
+    - lunar-antelope
 
diff --git a/tox.ini b/tox.ini
index 854d8be..c11375e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -33,7 +33,7 @@ allowlist_externals =
     charmcraft
     bash
     tox
-    rename.sh
+    {toxinidir}/rename.sh
 deps =
     -r{toxinidir}/requirements.txt