Browse Source

Add Rocky, Stein and Train support

Also removed unused/dangling config option and empty test class.

Change-Id: I18b57a85536b4077945fbaf5c1afe95a02d81344
Partial-Bug: #1890628
changes/71/746871/4
Aurelien Lourot 1 year ago
parent
commit
69829ab548
  1. 7
      src/README.md
  2. 4
      src/config.yaml
  3. 32
      src/lib/charm/openstack/neutron_arista.py
  4. 5
      src/reactive/neutron_arista_handlers.py
  5. 20
      src/tests/bundles/bionic-queens.yaml
  6. 28
      src/tests/bundles/bionic-rocky.yaml
  7. 144
      src/tests/bundles/bionic-stein.yaml
  8. 156
      src/tests/bundles/bionic-train.yaml
  9. 4
      src/tests/bundles/overlays/arista-virt-test-fixture-image.yaml.j2
  10. 4
      src/tests/bundles/overlays/bionic-queens.yaml.j2
  11. 1
      src/tests/bundles/overlays/bionic-queens.yaml.j2
  12. 4
      src/tests/bundles/overlays/bionic-rocky.yaml.j2
  13. 1
      src/tests/bundles/overlays/bionic-rocky.yaml.j2
  14. 1
      src/tests/bundles/overlays/bionic-stein.yaml.j2
  15. 1
      src/tests/bundles/overlays/bionic-train.yaml.j2
  16. 4
      src/tests/bundles/overlays/xenial-queens.yaml.j2
  17. 1
      src/tests/bundles/overlays/xenial-queens.yaml.j2
  18. 25
      src/tests/bundles/xenial-queens.yaml
  19. 10
      src/tests/tests.yaml
  20. 74
      unit_tests/test_lib_charm_openstack_neutron_arista.py

7
src/README.md

@ -4,11 +4,8 @@ This subordinate charm provides the
[Arista ML2 Plugin][python-networking-arista] support to the
[OpenStack Neutron API service][charm-neutron-api].
> **Notes**:
> * For now the neutron-api-plugin-arista charm is only supported up to
> OpenStack Queens.
> * For upgrading from earlier prototypes of this charm see
> [Upgrading to stable charm][upgrading-to-stable].
> **Note**: For upgrading from earlier prototypes of this charm see
> [Upgrading to stable charm][upgrading-to-stable].
When this charm is related to the neutron-api charm it will install the Arista
Neutron packages on each neutron-api unit in the region and supply the desired

4
src/config.yaml

@ -4,10 +4,6 @@ options:
type: string
description: |
Repository from which to install. Ex: ppa:canonical-arista/stable
arista-version:
default: '2017.2.2'
type: string
description: Arista Driver version
eapi-host:
default:
type: string

32
src/lib/charm/openstack/neutron_arista.py

@ -13,16 +13,14 @@ from charmhelpers.fetch import (
)
class NeutronAristaCharm(charms_openstack.charm.OpenStackCharm):
class BaseNeutronAristaCharm(charms_openstack.charm.OpenStackCharm):
abstract_class = True
# Internal name of charm
service_name = name = 'neutron-api-plugin-arista'
# First release supported
release = 'queens'
# List of packages to install for this charm
packages = ['python-networking-arista']
# Package to be used to determine the OpenStack release:
release_pkg = version_package = 'neutron-common'
def install(self):
log('Starting arista installation')
@ -31,3 +29,25 @@ class NeutronAristaCharm(charms_openstack.charm.OpenStackCharm):
add_source(config('source'))
apt_update(fatal=True)
apt_install(self.packages[0], fatal=True)
class QueensNeutronAristaCharm(BaseNeutronAristaCharm):
"""The Queens incarnation of the charm."""
abstract_class = False
release = 'queens'
python_version = 2
# List of packages to install for this charm
packages = ['python-networking-arista']
class RockyNeutronAristaCharm(BaseNeutronAristaCharm):
"""The Rocky incarnation of the charm."""
abstract_class = False
release = 'rocky'
python_version = 3
# List of packages to install for this charm
packages = ['python3-networking-arista']

5
src/reactive/neutron_arista_handlers.py

@ -25,7 +25,10 @@ from charms_openstack.charm import (
)
use_defaults('update-status')
use_defaults(
'charm.default-select-release',
'update-status',
)
@reactive.when_not('arista-package.installed')

20
src/tests/bundles/bionic-queens.yaml

@ -1,14 +1,21 @@
series: bionic
variables:
openstack-origin: &openstack-origin distro
series: &series bionic
applications:
glance:
charm: cs:~openstack-charmers-next/glance
num_units: 1
options:
openstack-origin: *openstack-origin
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
@ -18,6 +25,7 @@ applications:
charm: cs:~openstack-charmers-next/neutron-api
num_units: 1
options:
openstack-origin: *openstack-origin
enable-ml2-dns: False
flat-network-providers: default
vlan-ranges: default:1000:3000
@ -49,6 +57,7 @@ applications:
charm: cs:~openstack-charmers-next/nova-cloud-controller
num_units: 1
options:
openstack-origin: *openstack-origin
network-manager: Neutron
neutron-api-plugin-arista:
@ -67,6 +76,7 @@ applications:
num_units: 2
constraints: mem=4G cores=4
options:
openstack-origin: *openstack-origin
config-flags: default_ephemeral_format=ext4
enable-live-migration: true
enable-resize: true
@ -76,10 +86,6 @@ applications:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
openstack-dashboard:
charm: cs:openstack-dashboard
num_units: 1
lldpd:
charm: cs:lldpd
options:
@ -131,9 +137,5 @@ relations:
- neutron-api-plugin-arista
- - neutron-api:neutron-plugin-api-subordinate
- neutron-api-plugin-arista:neutron-plugin-api-subordinate
- - openstack-dashboard
- mysql
- - openstack-dashboard:identity-service
- keystone:identity-service
- - lldpd
- nova-compute

28
src/tests/bundles/bionic-rocky.yaml

@ -1,4 +1,7 @@
series: bionic
variables:
openstack-origin: &openstack-origin cloud:bionic-rocky
series: &series bionic
applications:
@ -6,13 +9,13 @@ applications:
charm: cs:~openstack-charmers-next/glance
num_units: 1
options:
openstack-origin: cloud:bionic-rocky
openstack-origin: *openstack-origin
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: cloud:bionic-rocky
openstack-origin: *openstack-origin
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
@ -22,7 +25,7 @@ applications:
charm: cs:~openstack-charmers-next/neutron-api
num_units: 1
options:
openstack-origin: cloud:bionic-rocky
openstack-origin: *openstack-origin
enable-ml2-dns: False
flat-network-providers: default
vlan-ranges: default:1000:3000
@ -54,13 +57,16 @@ applications:
charm: cs:~openstack-charmers-next/nova-cloud-controller
num_units: 1
options:
openstack-origin: cloud:bionic-rocky
openstack-origin: *openstack-origin
network-manager: Neutron
neutron-api-plugin-arista:
charm: ../../../neutron-api-plugin-arista
num_units: 0
options:
# Contains fix https://review.opendev.org/743740
source: ppa:aurelien-lourot/arista-rocky
# Fake IP, will be set to arista-virt-test-fixture's IP address on test
# setup:
eapi-host: 192.0.2.42
@ -73,7 +79,7 @@ applications:
num_units: 2
constraints: mem=4G cores=4
options:
openstack-origin: cloud:bionic-rocky
openstack-origin: *openstack-origin
config-flags: default_ephemeral_format=ext4
enable-live-migration: true
enable-resize: true
@ -83,12 +89,6 @@ applications:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
openstack-dashboard:
charm: cs:openstack-dashboard
num_units: 1
options:
openstack-origin: cloud:bionic-rocky
lldpd:
charm: cs:lldpd
options:
@ -140,9 +140,5 @@ relations:
- neutron-api-plugin-arista
- - neutron-api:neutron-plugin-api-subordinate
- neutron-api-plugin-arista:neutron-plugin-api-subordinate
- - openstack-dashboard
- mysql
- - openstack-dashboard:identity-service
- keystone:identity-service
- - lldpd
- nova-compute

144
src/tests/bundles/bionic-stein.yaml

@ -0,0 +1,144 @@
variables:
openstack-origin: &openstack-origin cloud:bionic-stein
series: &series bionic
applications:
glance:
charm: cs:~openstack-charmers-next/glance
num_units: 1
options:
openstack-origin: *openstack-origin
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
neutron-api:
charm: cs:~openstack-charmers-next/neutron-api
num_units: 1
options:
openstack-origin: *openstack-origin
enable-ml2-dns: False
flat-network-providers: default
vlan-ranges: default:1000:3000
vni-ranges: 1001:2000
neutron-security-groups: True
overlay-network-type: vxlan
use-internal-endpoints: True
enable-l3ha: True
dhcp-agents-per-network: 2
enable-ml2-port-security: True
default-tenant-network-type: vlan
l2-population: False
ipv4-ptr-zone-prefix-size:
reverse-dns-lookup: False
dns-domain:
manage-neutron-plugin-legacy-mode: False
neutron-openvswitch:
charm: cs:~openstack-charmers-next/neutron-openvswitch
num_units: 0
options:
prevent-arp-spoofing: True
firewall-driver: openvswitch
enable-local-dhcp-and-metadata: True
bridge-mappings: default:br-data
data-port: ens7
nova-cloud-controller:
charm: cs:~openstack-charmers-next/nova-cloud-controller
num_units: 1
options:
openstack-origin: *openstack-origin
network-manager: Neutron
neutron-api-plugin-arista:
charm: ../../../neutron-api-plugin-arista
num_units: 0
options:
# Contains fix https://review.opendev.org/743740
source: ppa:aurelien-lourot/arista-stein
# Fake IP, will be set to arista-virt-test-fixture's IP address on test
# setup:
eapi-host: 192.0.2.42
eapi-username: admin
eapi-password: password123
api-type: EAPI
nova-compute:
charm: cs:~openstack-charmers-next/nova-compute
num_units: 2
constraints: mem=4G cores=4
options:
openstack-origin: *openstack-origin
config-flags: default_ephemeral_format=ext4
enable-live-migration: true
enable-resize: true
migration-auth-type: ssh
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
lldpd:
charm: cs:lldpd
options:
interfaces-regex: 'en*'
short-name: true
arista-virt-test-fixture:
charm: cs:~openstack-charmers-next/arista-virt-test-fixture
num_units: 1
relations:
- - nova-compute:amqp
- rabbitmq-server:amqp
- - keystone:shared-db
- mysql:shared-db
- - nova-cloud-controller:identity-service
- keystone:identity-service
- - glance:identity-service
- keystone:identity-service
- - neutron-api:identity-service
- keystone:identity-service
- - neutron-openvswitch:neutron-plugin-api
- neutron-api:neutron-plugin-api
- - neutron-api:shared-db
- mysql:shared-db
- - neutron-api:amqp
- rabbitmq-server:amqp
- - glance:shared-db
- mysql:shared-db
- - glance:amqp
- rabbitmq-server:amqp
- - nova-cloud-controller:image-service
- glance:image-service
- - nova-compute:image-service
- glance:image-service
- - nova-cloud-controller:cloud-compute
- nova-compute:cloud-compute
- - nova-cloud-controller:amqp
- rabbitmq-server:amqp
- - nova-compute:neutron-plugin
- neutron-openvswitch:neutron-plugin
- - neutron-openvswitch:amqp
- rabbitmq-server:amqp
- - nova-cloud-controller:shared-db
- mysql:shared-db
- - nova-cloud-controller:neutron-api
- neutron-api:neutron-api
- - neutron-api
- neutron-api-plugin-arista
- - neutron-api:neutron-plugin-api-subordinate
- neutron-api-plugin-arista:neutron-plugin-api-subordinate
- - lldpd
- nova-compute

156
src/tests/bundles/bionic-train.yaml

@ -0,0 +1,156 @@
variables:
openstack-origin: &openstack-origin cloud:bionic-train
series: &series bionic
applications:
glance:
charm: cs:~openstack-charmers-next/glance
num_units: 1
options:
openstack-origin: *openstack-origin
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
neutron-api:
charm: cs:~openstack-charmers-next/neutron-api
num_units: 1
options:
openstack-origin: *openstack-origin
enable-ml2-dns: False
flat-network-providers: default
vlan-ranges: default:1000:3000
vni-ranges: 1001:2000
neutron-security-groups: True
overlay-network-type: vxlan
use-internal-endpoints: True
enable-l3ha: True
dhcp-agents-per-network: 2
enable-ml2-port-security: True
default-tenant-network-type: vlan
l2-population: False
ipv4-ptr-zone-prefix-size:
reverse-dns-lookup: False
dns-domain:
manage-neutron-plugin-legacy-mode: False
neutron-openvswitch:
charm: cs:~openstack-charmers-next/neutron-openvswitch
num_units: 0
options:
prevent-arp-spoofing: True
firewall-driver: openvswitch
enable-local-dhcp-and-metadata: True
bridge-mappings: default:br-data
data-port: ens7
nova-cloud-controller:
charm: cs:~openstack-charmers-next/nova-cloud-controller
num_units: 1
options:
openstack-origin: *openstack-origin
network-manager: Neutron
neutron-api-plugin-arista:
charm: ../../../neutron-api-plugin-arista
num_units: 0
options:
# Contains fix https://review.opendev.org/743740
source: ppa:aurelien-lourot/arista-train
# Fake IP, will be set to arista-virt-test-fixture's IP address on test
# setup:
eapi-host: 192.0.2.42
eapi-username: admin
eapi-password: password123
api-type: EAPI
placement:
charm: cs:~openstack-charmers-next/placement
num_units: 1
options:
openstack-origin: *openstack-origin
nova-compute:
charm: cs:~openstack-charmers-next/nova-compute
num_units: 2
constraints: mem=4G cores=4
options:
openstack-origin: *openstack-origin
config-flags: default_ephemeral_format=ext4
enable-live-migration: true
enable-resize: true
migration-auth-type: ssh
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
lldpd:
charm: cs:lldpd
options:
interfaces-regex: 'en*'
short-name: true
arista-virt-test-fixture:
charm: cs:~openstack-charmers-next/arista-virt-test-fixture
num_units: 1
relations:
- - nova-compute:amqp
- rabbitmq-server:amqp
- - keystone:shared-db
- mysql:shared-db
- - nova-cloud-controller:identity-service
- keystone:identity-service
- - glance:identity-service
- keystone:identity-service
- - neutron-api:identity-service
- keystone:identity-service
- - neutron-openvswitch:neutron-plugin-api
- neutron-api:neutron-plugin-api
- - neutron-api:shared-db
- mysql:shared-db
- - neutron-api:amqp
- rabbitmq-server:amqp
- - glance:shared-db
- mysql:shared-db
- - glance:amqp
- rabbitmq-server:amqp
- - nova-cloud-controller:image-service
- glance:image-service
- - nova-compute:image-service
- glance:image-service
- - nova-cloud-controller:cloud-compute
- nova-compute:cloud-compute
- - nova-cloud-controller:amqp
- rabbitmq-server:amqp
- - nova-compute:neutron-plugin
- neutron-openvswitch:neutron-plugin
- - neutron-openvswitch:amqp
- rabbitmq-server:amqp
- - nova-cloud-controller:shared-db
- mysql:shared-db
- - nova-cloud-controller:neutron-api
- neutron-api:neutron-api
- - neutron-api
- neutron-api-plugin-arista
- - neutron-api:neutron-plugin-api-subordinate
- neutron-api-plugin-arista:neutron-plugin-api-subordinate
- - lldpd
- nova-compute
- - placement:shared-db
- mysql:shared-db
- - placement:identity-service
- keystone:identity-service
- - placement:placement
- nova-cloud-controller:placement

4
src/tests/bundles/overlays/arista-virt-test-fixture-image.yaml.j2

@ -0,0 +1,4 @@
applications:
arista-virt-test-fixture:
resources:
arista-image: '{{ TEST_ARISTA_IMAGE_LOCAL }}'

4
src/tests/bundles/overlays/bionic-queens.yaml.j2

@ -1,4 +0,0 @@
applications:
arista-virt-test-fixture:
resources:
arista-image: '{{ TEST_ARISTA_IMAGE_LOCAL }}'

1
src/tests/bundles/overlays/bionic-queens.yaml.j2

@ -0,0 +1 @@
arista-virt-test-fixture-image.yaml.j2

4
src/tests/bundles/overlays/bionic-rocky.yaml.j2

@ -1,4 +0,0 @@
applications:
arista-virt-test-fixture:
resources:
arista-image: '{{ TEST_ARISTA_IMAGE_LOCAL }}'

1
src/tests/bundles/overlays/bionic-rocky.yaml.j2

@ -0,0 +1 @@
arista-virt-test-fixture-image.yaml.j2

1
src/tests/bundles/overlays/bionic-stein.yaml.j2

@ -0,0 +1 @@
arista-virt-test-fixture-image.yaml.j2

1
src/tests/bundles/overlays/bionic-train.yaml.j2

@ -0,0 +1 @@
arista-virt-test-fixture-image.yaml.j2

4
src/tests/bundles/overlays/xenial-queens.yaml.j2

@ -1,4 +0,0 @@
applications:
arista-virt-test-fixture:
resources:
arista-image: '{{ TEST_ARISTA_IMAGE_LOCAL }}'

1
src/tests/bundles/overlays/xenial-queens.yaml.j2

@ -0,0 +1 @@
arista-virt-test-fixture-image.yaml.j2

25
src/tests/bundles/xenial-queens.yaml

@ -1,4 +1,7 @@
series: xenial
variables:
openstack-origin: &openstack-origin cloud:xenial-queens
series: &series xenial
applications:
@ -6,13 +9,13 @@ applications:
charm: cs:~openstack-charmers-next/glance
num_units: 1
options:
openstack-origin: cloud:xenial-queens
openstack-origin: *openstack-origin
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: cloud:xenial-queens
openstack-origin: *openstack-origin
mysql:
charm: cs:~openstack-charmers-next/percona-cluster
@ -22,7 +25,7 @@ applications:
charm: cs:~openstack-charmers-next/neutron-api
num_units: 1
options:
openstack-origin: cloud:xenial-queens
openstack-origin: *openstack-origin
enable-ml2-dns: False
flat-network-providers: default
vlan-ranges: default:1000:3000
@ -54,7 +57,7 @@ applications:
charm: cs:~openstack-charmers-next/nova-cloud-controller
num_units: 1
options:
openstack-origin: cloud:xenial-queens
openstack-origin: *openstack-origin
network-manager: Neutron
neutron-api-plugin-arista:
@ -73,7 +76,7 @@ applications:
num_units: 2
constraints: mem=4G cores=4
options:
openstack-origin: cloud:xenial-queens
openstack-origin: *openstack-origin
config-flags: default_ephemeral_format=ext4
enable-live-migration: true
enable-resize: true
@ -83,12 +86,6 @@ applications:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
openstack-dashboard:
charm: cs:openstack-dashboard
num_units: 1
options:
openstack-origin: cloud:xenial-queens
lldpd:
charm: cs:lldpd
options:
@ -140,9 +137,5 @@ relations:
- neutron-api-plugin-arista
- - neutron-api:neutron-plugin-api-subordinate
- neutron-api-plugin-arista:neutron-plugin-api-subordinate
- - openstack-dashboard
- mysql
- - openstack-dashboard:identity-service
- keystone:identity-service
- - lldpd
- nova-compute

10
src/tests/tests.yaml

@ -1,14 +1,12 @@
charm_name: neutron-api-plugin-arista
smoke_bundles:
- bionic-queens
- bionic-train
gate_bundles:
- xenial-queens
- bionic-queens
# NOTE(lourot): on bionic-rocky neutron-server fails to start with:
# neutron.plugins.ml2.managers The following mechanism drivers were not found: set(['hyperv'])
# Disabling for now. To be investigated.
#- bionic-rocky
- bionic-rocky
- bionic-stein
- bionic-train
before_deploy:
- zaza.openstack.charm_tests.neutron_arista.setup.download_arista_image

74
unit_tests/test_lib_charm_openstack_neutron_arista.py

@ -1,74 +0,0 @@
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import print_function
import unittest
import mock
def FakeConfig(init_dict):
def _config(key=None):
return init_dict[key] if key else init_dict
return _config
class Helper(unittest.TestCase):
def setUp(self):
self._patches = {}
self._patches_start = {}
self.ch_config_patch = mock.patch('charmhelpers.core.hookenv.config')
self.ch_config = self.ch_config_patch.start()
self.ch_config.side_effect = lambda: {'ssl_param': None}
def tearDown(self):
for k, v in self._patches.items():
v.stop()
setattr(self, k, None)
self._patches = None
self._patches_start = None
self.ch_config_patch.stop()
def patch(self, obj, attr, return_value=None, **kwargs):
mocked = mock.patch.object(obj, attr, **kwargs)
self._patches[attr] = mocked
started = mocked.start()
started.return_value = return_value
self._patches_start[attr] = started
setattr(self, attr, started)
def patch_object(self, obj, attr, return_value=None, name=None, new=None):
if name is None:
name = attr
if new is not None:
mocked = mock.patch.object(obj, attr, new=new)
else:
mocked = mock.patch.object(obj, attr)
self._patches[name] = mocked
started = mocked.start()
if new is None:
started.return_value = return_value
self._patches_start[name] = started
setattr(self, name, started)
class TestNeutronAristaCharm(Helper):
def test_write_config(self):
pass
Loading…
Cancel
Save