Change all the quantum references to neutron

DHC-1456

In order to make the RUG working with havana, we need to change
all the references from quantum to neutron

Change-Id: I127ff788f61d55ca12d9da1f2f149c0e2e4ccff1
Signed-off-by: Rosario Di Somma <rosario.disomma@dreamhost.com>
This commit is contained in:
Rosario Di Somma 2013-09-16 17:34:25 -04:00
parent 8cabbd9543
commit cafe405635
15 changed files with 109 additions and 110 deletions

@ -1,5 +1,5 @@
====================================================================
Akanda User-facing API implemented as a Quantum Resource Extension
Akanda User-facing API implemented as a Neutron Resource Extension
====================================================================
Provides
@ -8,20 +8,20 @@ Provides
Portforward
-----------
portfoward.py implemented under quantum/extensions allows the ability
portfoward.py implemented under neutron/extensions allows the ability
to create portforwarding rules.
Filterrule
----------
filterrule.py implemented under quantum/extensions allows the ability
filterrule.py implemented under neutron/extensions allows the ability
to create firewall rules that eventually gets implemented as OpenBSD
PF rules within the Akanda appliance.
AddressBook
-----------
addressbook.py implemented under quantum/extensions allows the ability
addressbook.py implemented under neutron/extensions allows the ability
to administratively manage IP Address groups that can be used in filter
rules.
@ -31,7 +31,7 @@ Info
This is the home for the REST API that users will be calling directly with
their preferred REST tool (curl, Python wrapper, etc.).
This code could eventually become part of OpenStack Quantum or act as a source
This code could eventually become part of OpenStack Neutron or act as a source
or inspiration that will. As such, this API should be constructed entirely with
standard OpenStack tools.
@ -40,7 +40,7 @@ Authz
-----
The resource extensions are implemented with the ability to leverage AuthZ.
In order to use AuthZ, update Quantum's policy file for the extension to work
In order to use AuthZ, update Neutron's policy file for the extension to work
with the following::
"create_portforward": [],
@ -49,7 +49,7 @@ with the following::
"delete_portforward": [["rule:admin_or_owner"]]
To use quotas, add to the QUOTAS section of quantum.conf::
To use quotas, add to the QUOTAS section of neutron.conf::
quota_portforward = 10
@ -70,31 +70,31 @@ Preliminary Steps
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service quantum
enable_service neutron
enable_service q-l3
LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
Q_PLUGIN=openvswitch
NOVA_USE_QUANTUM_API=v2
NOVA_USE_NEUTRON_API=v2
2. Run ./stack.sh until the stack account and /opt/stack directory gets created.
3. Run ./unstack.sh
Quantum Extensions install
Neutron Extensions install
--------------------------
<workdir> = https://github.com/dreamhost/akanda/tree/master/userapi_extensions/akanda/quantum
<workdir> = https://github.com/dreamhost/akanda/tree/master/userapi_extensions/akanda/neutron
1. Clone quantum to /opt/stack using ``git clone https://github.com/openstack/quantum.git``
1. Clone neutron to /opt/stack using ``git clone https://github.com/openstack/neutron.git``
2. Change to the ``userapi_extensions`` dir within the Akanda project
3. Run ``python setup.py develop``
4. Return to devstack directory and replace the following lines::
- Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2"
+ Q_PLUGIN_CLASS="akanda.quantum.plugins.ovs_quantum_plugin.OVSQuantumPluginV2"
- Q_PLUGIN_CLASS="neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2"
+ Q_PLUGIN_CLASS="akanda.neutron.plugins.ovs_neutron_plugin.OVSNeutronPluginV2"
5. Add the following line to load the extension right above Q_AUTH_STRATEGY::
+ iniset $Q_CONF_FILE DEFAULT api_extensions_path "extensions:/opt/stack/akanda/userapi_extensions/akanda/quantum/extensions"
+ iniset $Q_CONF_FILE DEFAULT api_extensions_path "extensions:/opt/stack/akanda/userapi_extensions/akanda/neutron/extensions"
6. Run ./stack.sh again to generate the required DB migrations and start the required services.
@ -102,20 +102,20 @@ Quantum Extensions install
similar to the following to indicate a successful load of an
extension, however it is not complete without quotas::
2012-09-11 09:17:04 INFO [quantum.api.extensions] Initializing extension manager.
2012-09-11 09:17:04 INFO [quantum.api.extensions] Loading extension file: _authzbase.py
2012-09-11 09:17:04 INFO [quantum.api.extensions] Loading extension file: addressbook.py
2012-09-11 09:17:04 DEBUG [quantum.api.extensions] Ext name: addressbook
2012-09-11 09:17:04 DEBUG [quantum.api.extensions] Ext alias: dhaddressbook
2012-09-11 09:17:04 DEBUG [quantum.api.extensions] Ext description: An addressbook extension
2012-09-11 09:17:04 DEBUG [quantum.api.extensions] Ext namespace: http://docs.dreamcompute.com/api/ext/v1.0
2012-09-11 09:17:04 INFO [neutron.api.extensions] Initializing extension manager.
2012-09-11 09:17:04 INFO [neutron.api.extensions] Loading extension file: _authzbase.py
2012-09-11 09:17:04 INFO [neutron.api.extensions] Loading extension file: addressbook.py
2012-09-11 09:17:04 DEBUG [neutron.api.extensions] Ext name: addressbook
2012-09-11 09:17:04 DEBUG [neutron.api.extensions] Ext alias: dhaddressbook
2012-09-11 09:17:04 DEBUG [neutron.api.extensions] Ext description: An addressbook extension
2012-09-11 09:17:04 DEBUG [neutron.api.extensions] Ext namespace: http://docs.dreamcompute.com/api/ext/v1.0
8. Switch to q-svc screen and press Ctrl-C
9. To enable Quote Support
Stop q-svc as add the following to [QUOTA] section of
``/etc/quantum/quantum.conf``::
``/etc/neutron/neutron.conf``::
quota_portforward = 10
quota_filterrule = 100
@ -123,7 +123,7 @@ Quantum Extensions install
quota_addressbookgroup = 50
quota_addressbookentry = 250
10. Add the follow to /etc/quantum/policy.json to enable policies::
10. Add the follow to /etc/neutron/policy.json to enable policies::
"create_filerrule": [],
"get_filterrule": [["rule:admin_or_owner"]],
@ -148,11 +148,11 @@ Quantum Extensions install
Appendix
--------
To manually start and stop Quantum Services under DevStack:
To manually start and stop Neutron Services under DevStack:
1. Run 'screen -x'. To show a list of screens, use Ctrl+A+" (double quote char)
2. Select q-svc. In most cases - Ctrl+A+1 should work.
3. Run the following to start Quantum or Ctrl+C to stop::
3. Run the following to start Neutron or Ctrl+C to stop::
$ need-command-here
@ -160,8 +160,7 @@ To manually start and stop Quantum Services under DevStack:
Gotchas
=======
1. There is no Quantum Model validation for source and destination
1. There is no Neutron Model validation for source and destination
protocols in FilterRule. I.e., you can create forward rules between
UDP and TCP or anything else. Currently validation happens only in
Horizon. If you use the API directly, you are on your own!

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DreamHost Quantum Extensions
# DreamHost Neutron Extensions
# Copyright 2012 New Dream Network, LLC (DreamHost)
# @author: Murali Raju, New Dream Network, LLC (DreamHost)
# @author: Mark Mcclain, New Dream Network, LLC (DreamHost)
@ -26,9 +26,9 @@ from sqlalchemy import orm
from sqlalchemy.orm import validates
from quantum.db import model_base
from quantum.db import models_v2
from quantum.openstack.common import timeutils
from neutron.db import model_base
from neutron.db import models_v2
from neutron.openstack.common import timeutils
def validate_port_number(port):

@ -13,32 +13,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DreamHost Quantum Extensions
# DreamHost Neutron Extensions
# @author: Murali Raju, New Dream Network, LLC (DreamHost)
# @author: Mark Mcclain, New Dream Network, LLC (DreamHost)
import abc
from quantum import quota
from quantum.api.v2 import base
from quantum.api.v2 import resource as api_resource
from quantum.common import exceptions as q_exc
from quantum.common.config import cfg
from neutron import quota
from neutron.api.v2 import base
from neutron.api.v2 import resource as api_resource
from neutron.common import exceptions as q_exc
from neutron.common.config import cfg
class ResourcePlugin(object):
"""
This is a class does some of what the Quantum plugin does, managing
resources in a way very similar to what Quantum does. It differ from
Quantum is that this provides a base plugin infrastructure, and doesn't
This is a class does some of what the Neutron plugin does, managing
resources in a way very similar to what Neutron does. It differ from
Neutron is that this provides a base plugin infrastructure, and doesn't
manage any resources.
Quantum doesn't split infrastructure and implementation.
Neutron doesn't split infrastructure and implementation.
"""
JOINS = ()
def __init__(self, delegate):
# synthesize the hooks because Quantum's base class uses the
# synthesize the hooks because Neutron's base class uses the
# resource name as part of the method name
setattr(self, 'get_%s' % delegate.collection_name,
self._get_collection)

@ -13,20 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DreamHost Quantum Extensions
# DreamHost Neutron Extensions
# @author: Murali Raju, New Dream Network, LLC (DreamHost)
# @author: Mark Mcclain, New Dream Network, LLC (DreamHost)
import logging
from quantum.api import extensions
from quantum.api.v2 import attributes
from quantum.common import exceptions as q_exc
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import exceptions as q_exc
from sqlalchemy.orm import exc
from akanda.quantum.db import models_v2
from akanda.quantum.extensions import _authzbase
from akanda.neutron.db import models_v2
from akanda.neutron.extensions import _authzbase
LOG = logging.getLogger(__name__)

@ -13,17 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DreamHost Quantum Extensions
# DreamHost Neutron Extensions
# @author: Murali Raju, New Dream Network, LLC (DreamHost)
# @author: Mark Mcclain, New Dream Network, LLC (DreamHost)
from quantum.api import extensions
from quantum.api.v2 import attributes
from quantum.common import exceptions
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import exceptions
from akanda.quantum.db import models_v2
from akanda.quantum.extensions import _authzbase
from akanda.neutron.db import models_v2
from akanda.neutron.extensions import _authzbase
class AddressGroupResource(_authzbase.ResourceDelegate):

@ -13,18 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DreamHost Quantum Extensions
# DreamHost Neutron Extensions
# @author: Murali Raju, New Dream Network, LLC (DreamHost)
# @author: Mark Mcclain, New Dream Network, LLC (DreamHost)
from quantum.api import extensions
from quantum.api.v2 import attributes
from quantum.common import exceptions as q_exc
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import exceptions as q_exc
from sqlalchemy.orm import exc
from akanda.quantum.db import models_v2
from akanda.quantum.extensions import _authzbase
from akanda.neutron.db import models_v2
from akanda.neutron.extensions import _authzbase
class FilterruleResource(_authzbase.ResourceDelegate):

@ -13,16 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DreamHost Quantum Extensions
# DreamHost Neutron Extensions
# @author: Murali Raju, New Dream Network, LLC (DreamHost)
from quantum.api import extensions
from quantum.api.v2 import attributes
from quantum.common import exceptions
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import exceptions
from akanda.quantum.db import models_v2
from akanda.quantum.extensions import _authzbase
from akanda.neutron.db import models_v2
from akanda.neutron.extensions import _authzbase
class PortaliasResource(_authzbase.ResourceDelegate):

@ -13,19 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# DreamHost Quantum Extensions
# DreamHost Neutron Extensions
# @author: Murali Raju, New Dream Network, LLC (DreamHost)
# @author: Mark Mcclain, New Dream Network, LLC (DreamHost)
from sqlalchemy.orm import exc
from quantum.api import extensions
from quantum.api.v2 import attributes
from quantum.common import exceptions as q_exc
from quantum.db import models_v2 as qmodels
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import exceptions as q_exc
from neutron.db import models_v2 as qmodels
from akanda.quantum.db import models_v2
from akanda.quantum.extensions import _authzbase
from akanda.neutron.db import models_v2
from akanda.neutron.extensions import _authzbase
class PortforwardResource(_authzbase.ResourceDelegate):

@ -3,16 +3,16 @@ import netaddr
import logging
import random
from quantum.api.v2 import attributes
from quantum.common.config import cfg
from quantum.common import exceptions as q_exc
from quantum.db import db_base_plugin_v2
from quantum.db import models_v2 as qmodels
from quantum.db import l3_db
from quantum import manager
from neutron.api.v2 import attributes
from neutron.common.config import cfg
from neutron.common import exceptions as q_exc
from neutron.db import db_base_plugin_v2
from neutron.db import models_v2 as qmodels
from neutron.db import l3_db
from neutron import manager
from sqlalchemy.orm import exc
from akanda.quantum.db import models_v2 as akmodels
from akanda.neutron.db import models_v2 as akmodels
IPV6_ASSIGNMENT_ATTEMPTS = 1000
LOG = logging.getLogger(__name__)
@ -103,7 +103,7 @@ def auto_add_other_resources(f):
def monkey_patch_ipv6_generator():
cls = db_base_plugin_v2.QuantumDbPluginV2
cls = db_base_plugin_v2.NeutronDbPluginV2
cls._generate_mac = _wrap_generate_mac(cls._generate_mac)
cls._generate_ip = _wrap_generate_ip(cls, cls._generate_ip)
@ -159,7 +159,7 @@ def _add_subnet_to_router(context, subnet):
if not subnet.get('gateway_ip'):
return
plugin = manager.QuantumManager.get_plugin()
plugin = manager.NeutronManager.get_plugin()
router_q = context.session.query(l3_db.Router)
router_q = router_q.filter_by(tenant_id=context.tenant_id)
@ -242,7 +242,7 @@ def _update_internal_gateway_port_ip(context, router_id, subnet):
# we call into the plugin vs updating the db directly because of l3 hooks
# baked into the plugins.
plugin = manager.QuantumManager.get_plugin()
plugin = manager.NeutronManager.get_plugin()
port_dict = {'fixed_ips': fixed_ips}
plugin.update_port(
context.elevated(),
@ -254,7 +254,7 @@ def _update_internal_gateway_port_ip(context, router_id, subnet):
def _add_ipv6_subnet(context, network):
plugin = manager.QuantumManager.get_plugin()
plugin = manager.NeutronManager.get_plugin()
try:
subnet_generator = _ipv6_subnet_generator(
@ -322,7 +322,7 @@ def _ipv6_subnet_generator(network_range, prefixlen):
def _wrap_generate_mac(f):
""" Adds mac_address to context object instead of patch Quantum.
""" Adds mac_address to context object instead of patch Neutron.
Annotating the object requires a less invasive change until upstream
can be fixed in Havana. This version works in concert with
@ -345,7 +345,7 @@ def _wrap_generate_ip(cls, f):
the network.
NOTE: This method is intended to patch a private method on the
Quantum base plugin. The method prefers to generate an IP from large IPv6
Neutron base plugin. The method prefers to generate an IP from large IPv6
subnets. If a suitable subnet cannot be found, the method will fallback
to the original implementation.
"""

@ -18,20 +18,20 @@
import functools
from quantum.common import topics
from quantum.db import l3_db
from quantum.db import l3_rpc_base as l3_rpc
from quantum.extensions import portsecurity as psec
from quantum.extensions import securitygroup as ext_sg
from quantum.openstack.common import log as logging
from quantum.openstack.common import rpc
from quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin import nicira_db
from quantum.plugins.nicira.nicira_nvp_plugin import QuantumPlugin as nvp
from quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin import nvplib
from neutron.common import topics
from neutron.db import l3_db
from neutron.db import l3_rpc_base as l3_rpc
from neutron.extensions import portsecurity as psec
from neutron.extensions import securitygroup as ext_sg
from neutron.openstack.common import log as logging
from neutron.openstack.common import rpc
from neutron.plugins.nicira.nicira_nvp_plugin.NeutronPlugin import nicira_db
from neutron.plugins.nicira.nicira_nvp_plugin import NeutronPlugin as nvp
from neutron.plugins.nicira.nicira_nvp_plugin.NeutronPlugin import nvplib
from akanda.quantum.plugins import decorators as akanda
from akanda.neutron.plugins import decorators as akanda
LOG = logging.getLogger("QuantumPlugin")
LOG = logging.getLogger("NeutronPlugin")
akanda.monkey_patch_ipv6_generator()
@ -73,7 +73,7 @@ class AkandaNvpRpcCallbacks(l3_rpc.L3RpcCallbackMixin, nvp.NVPRpcCallbacks):
class NvpPluginV2(nvp.NvpPluginV2):
"""
NvpPluginV2 is a Quantum plugin that provides L2 Virtual Network
NvpPluginV2 is a Neutron plugin that provides L2 Virtual Network
functionality using NVP.
"""
supported_extension_aliases = (
@ -174,7 +174,7 @@ class NvpPluginV2(nvp.NvpPluginV2):
port_data['fixed_ips'],
port_data[psec.PORTSECURITY],
port_data[ext_sg.SECURITYGROUPS])
nicira_db.add_quantum_nvp_port_mapping(
nicira_db.add_neutron_nvp_port_mapping(
context.session, port_data['id'], lport['uuid'])
d_owner = port_data['device_owner']
@ -189,7 +189,7 @@ class NvpPluginV2(nvp.NvpPluginV2):
'port_id': port_data['id'],
'nvp_port_id': lport['uuid']})
except Exception:
# failed to create port in NVP delete port from quantum_db
# failed to create port in NVP delete port from neutron_db
LOG.exception(_("An exception occured while plugging "
"the interface"))
raise

@ -16,15 +16,15 @@
# under the License.
#
from quantum.plugins.openvswitch import ovs_quantum_plugin
from neutron.plugins.openvswitch import ovs_neutron_plugin
from akanda.quantum.plugins import decorators as akanda
from akanda.neutron.plugins import decorators as akanda
akanda.monkey_patch_ipv6_generator()
class OVSQuantumPluginV2(ovs_quantum_plugin.OVSQuantumPluginV2):
class OVSNeutronPluginV2(ovs_neutron_plugin.OVSNeutronPluginV2):
_supported_extension_aliases = (
ovs_quantum_plugin.OVSQuantumPluginV2._supported_extension_aliases +
ovs_neutron_plugin.OVSNeutronPluginV2._supported_extension_aliases +
["dhportforward", "dhaddressgroup", "dhaddressentry",
"dhfilterrule", "dhportalias"])
@ -36,13 +36,13 @@ class OVSQuantumPluginV2(ovs_quantum_plugin.OVSQuantumPluginV2):
@akanda.auto_add_other_resources
@akanda.auto_add_ipv6_subnet
def create_network(self, context, network):
return super(OVSQuantumPluginV2, self).create_network(context, network)
return super(OVSNeutronPluginV2, self).create_network(context, network)
@akanda.auto_add_subnet_to_router
def create_subnet(self, context, subnet):
return super(OVSQuantumPluginV2, self).create_subnet(context, subnet)
return super(OVSNeutronPluginV2, self).create_subnet(context, subnet)
@akanda.sync_subnet_gateway_port
def update_subnet(self, context, id, subnet):
return super(OVSQuantumPluginV2, self).update_subnet(
return super(OVSNeutronPluginV2, self).update_subnet(
context, id, subnet)