Add Openvswitch component
Change-Id: I39fb2d91fc07ff349eeb8284c7cd592d30487b85
This commit is contained in:
parent
af2bf00077
commit
f12819dc78
@ -15,9 +15,11 @@
|
||||
# under the License.
|
||||
|
||||
from anvil import shell as sh
|
||||
from anvil import importer
|
||||
|
||||
from anvil.components.configurators import base
|
||||
|
||||
|
||||
# Special generated conf
|
||||
API_CONF = "quantum.conf"
|
||||
|
||||
@ -26,59 +28,6 @@ PASTE_CONF = "api-paste.ini"
|
||||
|
||||
CONFIGS = [PASTE_CONF, API_CONF]
|
||||
|
||||
# build PLUGIN_CONFS with
|
||||
# for i in *; do
|
||||
# echo ' "'$i'": ['
|
||||
# for j in $i/*; do echo ' "plugins/'$j'",'; done
|
||||
# echo " ],"
|
||||
# done
|
||||
PLUGIN_CONFS = {
|
||||
"bigswitch": [
|
||||
"plugins/bigswitch/restproxy.ini",
|
||||
],
|
||||
"brocade": [
|
||||
"plugins/brocade/brocade.ini",
|
||||
],
|
||||
"cisco": [
|
||||
"plugins/cisco/cisco_plugins.ini",
|
||||
"plugins/cisco/credentials.ini",
|
||||
"plugins/cisco/db_conn.ini",
|
||||
"plugins/cisco/l2network_plugin.ini",
|
||||
"plugins/cisco/nexus.ini",
|
||||
],
|
||||
"hyperv": [
|
||||
"plugins/hyperv/hyperv_quantum_plugin.ini",
|
||||
],
|
||||
"linuxbridge": [
|
||||
"plugins/linuxbridge/linuxbridge_conf.ini",
|
||||
],
|
||||
"metaplugin": [
|
||||
"plugins/metaplugin/metaplugin.ini",
|
||||
],
|
||||
"midonet": [
|
||||
"plugins/midonet/midonet.ini",
|
||||
],
|
||||
"nec": [
|
||||
"plugins/nec/nec.ini",
|
||||
],
|
||||
"nicira": [
|
||||
"plugins/nicira/nvp.ini",
|
||||
],
|
||||
"openvswitch": [
|
||||
"plugins/openvswitch/ovs_quantum_plugin.ini",
|
||||
],
|
||||
"plumgrid": [
|
||||
"plugins/plumgrid/plumgrid.ini",
|
||||
],
|
||||
"ryu": [
|
||||
"plugins/ryu/ryu.ini",
|
||||
],
|
||||
}
|
||||
|
||||
CORE_PLUGIN_CLASSES = {
|
||||
"linuxbridge":
|
||||
"quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2",
|
||||
}
|
||||
|
||||
class QuantumConfigurator(base.Configurator):
|
||||
|
||||
@ -87,15 +36,19 @@ class QuantumConfigurator(base.Configurator):
|
||||
|
||||
def __init__(self, installer):
|
||||
super(QuantumConfigurator, self).__init__(installer, CONFIGS)
|
||||
self.config_adjusters = {PASTE_CONF: self._config_adjust_paste,
|
||||
API_CONF: self._config_adjust_api,
|
||||
PLUGIN_CONFS["linuxbridge"][0]: self._config_plugin_conf_linuxbridge}
|
||||
self.core_plugin = installer.get_option("core_plugin")
|
||||
self.plugin_confs = PLUGIN_CONFS[self.core_plugin]
|
||||
self.plugin_configurator = importer.import_entry_point(
|
||||
"anvil.components.configurators.quantum_plugins.%s:%sConfigurator" %
|
||||
(self.core_plugin, self.core_plugin.title()))(installer)
|
||||
self.config_adjusters = {
|
||||
PASTE_CONF: self._config_adjust_paste,
|
||||
API_CONF: self._config_adjust_api,
|
||||
}
|
||||
self.config_adjusters.update(self.plugin_configurator.config_adjusters)
|
||||
|
||||
@property
|
||||
def config_files(self):
|
||||
return list(CONFIGS) + self.plugin_confs
|
||||
return list(CONFIGS) + self.plugin_configurator.config_files
|
||||
|
||||
def source_config(self, config_fn):
|
||||
if (config_fn.startswith("plugins") or
|
||||
@ -112,7 +65,7 @@ class QuantumConfigurator(base.Configurator):
|
||||
config.add(k, v)
|
||||
|
||||
def _config_adjust_api(self, config):
|
||||
config.add("core_plugin", CORE_PLUGIN_CLASSES[self.core_plugin])
|
||||
config.add("core_plugin", self.plugin_configurator.PLUGIN_CLASS)
|
||||
config.add('auth_strategy', 'keystone')
|
||||
config.add("api_paste_config", self.target_config(PASTE_CONF))
|
||||
# TODO(aababilov): add debug to other services conf files
|
||||
@ -137,20 +90,6 @@ class QuantumConfigurator(base.Configurator):
|
||||
for (k, v) in self._fetch_keystone_params().items():
|
||||
config.add(k, v)
|
||||
|
||||
def _config_plugin_conf_linuxbridge(self, plugin_conf):
|
||||
plugin_conf.add_with_section(
|
||||
"VLANS",
|
||||
"network_vlan_ranges",
|
||||
self.installer.get_option("network_vlan_ranges"))
|
||||
plugin_conf.add_with_section(
|
||||
"DATABASE",
|
||||
"sql_connection",
|
||||
self.fetch_dbdsn())
|
||||
plugin_conf.add_with_section(
|
||||
"LINUX_BRIDGE",
|
||||
"physical_interface_mappings",
|
||||
self.installer.get_option("physical_interface_mappings"))
|
||||
|
||||
def _fetch_keystone_params(self):
|
||||
params = self.get_keystone_params('quantum')
|
||||
return {
|
||||
|
38
anvil/components/configurators/quantum_plugins/__init__.py
Normal file
38
anvil/components/configurators/quantum_plugins/__init__.py
Normal file
@ -0,0 +1,38 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# 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 anvil import shell as sh
|
||||
|
||||
from anvil.components.configurators import base
|
||||
|
||||
|
||||
class Configurator(base.Configurator):
|
||||
|
||||
DB_NAME = "quantum"
|
||||
PLUGIN_CLASS = "quantum.plugins.UNKNOWN"
|
||||
|
||||
def __init__(self, installer, configs, adjusters):
|
||||
self.core_plugin = installer.get_option("core_plugin")
|
||||
super(Configurator, self).__init__(
|
||||
installer,
|
||||
["plugins/%s/%s" % (self.core_plugin, name) for name in configs])
|
||||
self.config_adjusters = dict(
|
||||
("plugins/%s/%s" % (self.core_plugin, key), value)
|
||||
for key, value in adjusters.iteritems())
|
||||
|
||||
@property
|
||||
def config_files(self):
|
||||
return list(self.configs)
|
@ -0,0 +1,49 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# 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 anvil.components.configurators import quantum_plugins
|
||||
|
||||
# Special generated conf
|
||||
PLUGIN_CONF = "linuxbridge_conf.ini"
|
||||
|
||||
CONFIGS = [PLUGIN_CONF]
|
||||
|
||||
|
||||
class LinuxbridgeConfigurator(quantum_plugins.Configurator):
|
||||
|
||||
PLUGIN_CLASS = "quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2"
|
||||
|
||||
def __init__(self, installer):
|
||||
super(LinuxbridgeConfigurator, self).__init__(
|
||||
installer, CONFIGS, {PLUGIN_CONF: self._config_adjust_plugin})
|
||||
|
||||
def _config_adjust_plugin(self, plugin_conf):
|
||||
plugin_conf.add_with_section(
|
||||
"DATABASE",
|
||||
"sql_connection",
|
||||
self.fetch_dbdsn())
|
||||
plugin_conf.add_with_section(
|
||||
"VLANS",
|
||||
"network_vlan_ranges",
|
||||
self.installer.get_option("network_vlan_ranges"))
|
||||
plugin_conf.add_with_section(
|
||||
"DATABASE",
|
||||
"sql_connection",
|
||||
self.fetch_dbdsn())
|
||||
plugin_conf.add_with_section(
|
||||
"LINUX_BRIDGE",
|
||||
"physical_interface_mappings",
|
||||
self.installer.get_option("physical_interface_mappings"))
|
@ -0,0 +1,37 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# 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 anvil.components.configurators import quantum_plugins
|
||||
|
||||
# Special generated conf
|
||||
PLUGIN_CONF = "ovs_quantum_plugin.ini"
|
||||
|
||||
CONFIGS = [PLUGIN_CONF]
|
||||
|
||||
|
||||
class OpenvswitchConfigurator(quantum_plugins.Configurator):
|
||||
|
||||
PLUGIN_CLASS = "quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2"
|
||||
|
||||
def __init__(self, installer):
|
||||
super(OpenvswitchConfigurator, self).__init__(
|
||||
installer, CONFIGS, {PLUGIN_CONF: self._config_adjust_plugin})
|
||||
|
||||
def _config_adjust_plugin(self, plugin_conf):
|
||||
plugin_conf.add_with_section(
|
||||
"DATABASE",
|
||||
"sql_connection",
|
||||
self.fetch_dbdsn())
|
33
anvil/components/openvswitch.py
Normal file
33
anvil/components/openvswitch.py
Normal file
@ -0,0 +1,33 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# 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 anvil import log as logging
|
||||
from anvil import shell as sh
|
||||
|
||||
from anvil.components import base_runtime as bruntime
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpenvswitchRuntime(bruntime.ServiceRuntime):
|
||||
|
||||
def __init__(self, *args, **kargs):
|
||||
super(OpenvswitchRuntime, self).__init__(*args, **kargs)
|
||||
|
||||
@property
|
||||
def applications(self):
|
||||
return ["openvswitch"]
|
@ -9,7 +9,7 @@ api_host: "$(auto:ip)"
|
||||
api_port: 9696
|
||||
protocol: http
|
||||
|
||||
core_plugin: linuxbridge
|
||||
core_plugin: openvswitch
|
||||
|
||||
network_vlan_ranges: physnet1:100:299
|
||||
physical_interface_mappings: physnet1:100:299
|
||||
|
@ -304,4 +304,10 @@ components:
|
||||
test: anvil.components.base_testing:PythonTestingComponent
|
||||
coverage: anvil.components.base_testing:PythonTestingComponent
|
||||
uninstall: anvil.components.base_install:PkgUninstallComponent
|
||||
openvswitch:
|
||||
action_classes:
|
||||
install: anvil.components.base_install:PkgInstallComponent
|
||||
running: anvil.components.openvswitch:OpenvswitchRuntime
|
||||
test: anvil.components.base_testing:EmptyTestingComponent
|
||||
uninstall: anvil.components.base_install:PkgUninstallComponent
|
||||
...
|
||||
|
@ -15,6 +15,7 @@ components:
|
||||
- quantum-client
|
||||
- swift-client # Seems only needed for horizon?
|
||||
- quantum
|
||||
- openvswitch
|
||||
- cinder
|
||||
- novnc
|
||||
- nova
|
||||
|
3
pylintrc
3
pylintrc
@ -40,6 +40,7 @@ load-plugins=
|
||||
# C0111: Don't require docstrings on every method
|
||||
# E0213: We want different names for 'self', e. g. 'inner_self'
|
||||
# E0611: No name in module -- test cover that
|
||||
# E1002: Use super on an old style class
|
||||
# E1101: Mocks make pylint type deduction crazy
|
||||
# E1103: When some types could not be inferred, we ignore pylint
|
||||
# F0401: Unable to import smth -- test cover that
|
||||
@ -61,7 +62,7 @@ load-plugins=
|
||||
# W0622: Redefining id is fine.
|
||||
# W0702: No exception type(s) specified
|
||||
# W0703: Catching "Exception" is fine if you need it
|
||||
disable=I0011,I0012,I0013,C0111,E0213,E0611,E1101,E1103,F0401,R0201,R0801,R0912,R0914,R0922,W0141,W0142,W0212,W0223,W0232,W0401,W0511,W0603,W0613,W0622,W0702,W0703
|
||||
disable=I0011,I0012,I0013,C0111,E0213,E0611,E1002,E1101,E1103,F0401,R0201,R0801,R0912,R0914,R0922,W0141,W0142,W0212,W0223,W0232,W0401,W0511,W0603,W0613,W0622,W0702,W0703
|
||||
|
||||
[REPORTS]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user