First draft genericswitch

This commit is contained in:
Mathieu Mitchell 2017-11-13 08:15:20 -05:00
parent 23c6085244
commit 057e939ef8
5 changed files with 26 additions and 55 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ bin
*.pyc
interfaces
build
.stestr

View File

@ -40,20 +40,25 @@ def choose_charm_class():
return ch_utils.os_release('neutron-common')
class IcehouseNeutronAPIODLCharm(charms_openstack.charm.OpenStackCharm):
class NewtonNeutronAPIGenericSwitchCharm(charms_openstack.charm.OpenStackCharm):
name = 'neutron-api-genericswitch'
name = 'neutron-api-odl'
release = 'icehouse'
release = 'newton'
packages = ['neutron-common', 'neutron-plugin-ml2']
required_relations = ['neutron-plugin-api-subordinate', 'odl-controller']
packages = ['neutron-common',
'neutron-plugin-ml2',
'nginx-light',
]
required_relations = ['neutron-plugin-api-subordinate']
restart_map = {ML2_CONF: []}
adapters_class = charms_openstack.adapters.OpenStackRelationAdapters
# Custom configure for the class
service_plugins = 'router,firewall,lbaas,vpnaas,metering'
# NOTE: LBaaS v2 for >= newton
service_plugins = ('router,firewall,vpnaas,metering,'
'neutron_lbaas.services.loadbalancer.'
'plugin.LoadBalancerPluginv2')
def configure_plugin(self, api_principle):
"""Add sections and tuples to insert values into neutron-server's
@ -71,33 +76,9 @@ class IcehouseNeutronAPIODLCharm(charms_openstack.charm.OpenStackCharm):
}
api_principle.configure_plugin(
neutron_plugin='odl',
neutron_plugin='genericswitch',
core_plugin='neutron.plugins.ml2.plugin.Ml2Plugin',
neutron_plugin_config='/etc/neutron/plugins/ml2/ml2_conf.ini',
service_plugins=self.service_plugins,
subordinate_configuration=inject_config)
class KiloNeutronAPIODLCharm(IcehouseNeutronAPIODLCharm):
"""For the kilo release we have an additional package to install:
'python-networking-odl'
"""
release = 'kilo'
packages = ['neutron-common',
'neutron-plugin-ml2',
'python-networking-odl',
]
class NewtonNeutronAPIODLCharm(KiloNeutronAPIODLCharm):
"""For Newton, the service_plugins on the configuration is different.
"""
release = 'newton'
# NOTE: LBaaS v2 for >= newton
service_plugins = ('router,firewall,vpnaas,metering,'
'neutron_lbaas.services.loadbalancer.'
'plugin.LoadBalancerPluginv2')

View File

@ -1,6 +1,6 @@
name: neutron-api-odl
name: neutron-api-genericswitch
subordinate: true
summary: OpenStack Networking - OpenDayLight mechanism driver
summary: OpenStack Networking - Generic Switch mechanism driver
maintainer: OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
description: |
Neutron is a virtual network service for OpenStack, and a part of
@ -12,22 +12,17 @@ description: |
advanced network capabilities (e.g., QoS, ACLs, network monitoring,
etc.)
.
This charm configures the neutron-api service with the OpenDayLight
SDN solution.
This charm configures the neutron-api service with the Generic Switch
mechanism driver.
tags:
- openstack
series:
- xenial
- artful
- zesty
- trusty
provides:
neutron-plugin-api-subordinate:
interface: neutron-plugin-api-subordinate
scope: container
requires:
odl-controller:
interface: odl-controller-api
container:
interface: juju-info
scope: container

View File

@ -16,9 +16,7 @@ import charms.reactive as reactive
import charms_openstack.charm as charm
# This charm's library contains all of the handler code associated with
# neutron_api_odl
import charm.openstack.neutron_api_odl as neutron_api_odl
import charm.openstack.neutron_api_genericswitch as neutron_api_genericswitch
charm.use_defaults(
@ -27,21 +25,14 @@ charm.use_defaults(
'update-status')
@reactive.when('odl-controller.available')
def render_config(*args):
with charm.provide_charm_instance() as neutron_api_odl_charm:
neutron_api_odl_charm.render_with_interfaces(args)
neutron_api_odl_charm.assess_status()
@reactive.when('neutron-plugin-api-subordinate.connected')
def configure_plugin(api_principle):
with charm.provide_charm_instance() as neutron_api_odl_charm:
neutron_api_odl_charm.configure_plugin(api_principle)
neutron_api_odl_charm.assess_status()
with charm.provide_charm_instance() as neutron_api_genericswitch_charm:
neutron_api_genericswitch_charm.configure_plugin(api_principle)
neutron_api_genericswitch_charm.assess_status()
@reactive.when_file_changed(neutron_api_odl.ML2_CONF)
@reactive.when_file_changed(neutron_api_genericswitch.ML2_CONF)
@reactive.when('neutron-plugin-api-subordinate.connected')
def remote_restart(api_principle):
api_principle.request_restart()

View File

@ -2,6 +2,9 @@
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
###############################################################################
#
[ml2]
type_drivers = {{ options.overlay_net_types }},local,flat,vlan
tenant_network_types = {{ options.overlay_net_types }}