quantum_tests.sqlite
quantum.sqlite
*.quantum-venv
+neutron.egg-info
+neutron_tests.sqlite
+neutron.sqlite
+*.neutron-venv
.venv
dist/
ChangeLog
*.pid
*.log
+neutron/vcsversion.py
quantum/vcsversion.py
.ropeproject
doc/build
*.DS_Store
*.pyc
+neutron.egg-info/
+neutron/vcsversion.py
+neutron/versioninfo
quantum.egg-info/
quantum/vcsversion.py
quantum/versioninfo
# and be lowecased with underscores
method-rgx=([a-z_][a-z0-9_]{2,50}|setUp|tearDown)$
-# Module names matching quantum-* are ok (files in bin/)
+# Module names matching neutron-* are ok (files in bin/)
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(neutron-[a-z0-9_-]+))$
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(quantum-[a-z0-9_-]+))$
# Don't require docstrings on tests.
[DEFAULT]
-test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ quantum/tests/unit $LISTOPT $IDOPTION
+test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ neutron/tests/unit $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
-Quantum Style Commandments
+Neutron Style Commandments
==========================
- Step 1: Read http://www.python.org/dev/peps/pep-0008/
The following imports,
- from quantum.api import networks
- from quantum import wsgi
+ from neutron.api import networks
+ from neutron import wsgi
are considered equivalent for ordering purposes to
- import quantum.api.networks
- import quantum.wsgi
+ import neutron.api.networks
+ import neutron.wsgi
- Organize your imports according to the following template
\n
{{third-party lib imports in human alphabetical order}}
\n
- {{quantum imports in human alphabetical order}}
+ {{neutron imports in human alphabetical order}}
\n
\n
{{begin your code}}
import testtools
import webob.exc
- import quantum.api.networks
- from quantum.api import ports
- from quantum.db import models
- from quantum.extensions import multiport
- from quantum.openstack.common import log as logging
- import quantum.manager
- from quantum import service
+ import neutron.api.networks
+ from neutron.api import ports
+ from neutron.db import models
+ from neutron.extensions import multiport
+ from neutron.openstack.common import log as logging
+ import neutron.manager
+ from neutron import service
Docstrings
without the patch and passes with the patch.
All unittest classes must ultimately inherit from testtools.TestCase. In the
-Quantum test suite, this should be done by inheriting from
-quantum.tests.base.BaseTestCase.
+Neutron test suite, this should be done by inheriting from
+neutron.tests.base.BaseTestCase.
All setUp and tearDown methods must upcall using the super() method.
tearDown methods should be avoided and addCleanup calls should be preferred.
include README.rst
include ChangeLog
include LICENSE
-include quantum/db/migration/README
-include quantum/db/migration/alembic.ini
-include quantum/db/migration/alembic_migrations/script.py.mako
-include quantum/db/migration/alembic_migrations/versions/README
-recursive-include quantum/locale *
+include neutron/db/migration/README
+include neutron/db/migration/alembic.ini
+include neutron/db/migration/alembic_migrations/script.py.mako
+include neutron/db/migration/alembic_migrations/versions/README
+recursive-include neutron/locale *
exclude .gitignore
exclude .gitreview
# -- Welcome!
You have come across a cloud computing network fabric controller. It has
- identified itself as "Quantum." It aims to tame your (cloud) networking!
+ identified itself as "Neutron." It aims to tame your (cloud) networking!
# -- External Resources:
- The homepage for Quantum is: http://launchpad.net/quantum . Use this
+ The homepage for Neutron is: http://launchpad.net/neutron . Use this
site for asking for help, and filing bugs. Code is available on github at
- <http://github.com/openstack/quantum>.
+ <http://github.com/openstack/neutron>.
- The latest and most in-depth documentation on how to use Quantum is
+ The latest and most in-depth documentation on how to use Neutron is
available at: <http://docs.openstack.org>. This includes:
- Quantum Administrator Guide
+ Neutron Administrator Guide
http://docs.openstack.org/trunk/openstack-network/admin/content/
- Quantum API Reference:
+ Neutron API Reference:
http://docs.openstack.org/api/openstack-network/2.0/content/
The start of some developer documentation is available at:
- http://wiki.openstack.org/QuantumDevelopment
+ http://wiki.openstack.org/NeutronDevelopment
- For help using or hacking on Quantum, you can send mail to
+ For help using or hacking on Neutron, you can send mail to
<mailto:openstack-dev@lists.openstack.org>.
-Testing Quantum
+Testing Neutron
=============================================================
Overview
The unit tests are meant to cover as much code as possible and should
be executed without the service running. They are designed to test
- the various pieces of the quantum tree to make sure any new changes
+ the various pieces of the neutron tree to make sure any new changes
don't break existing functionality.
Running tests
class separating it from the module path with a colon.
For example, the following would run only the JSONV2TestCase tests from
- quantum/tests/unit/test_api_v2.py:
+ neutron/tests/unit/test_api_v2.py:
- $ ./run_tests.sh quantum.tests.unit.test_api_v2:JSONV2TestCase
+ $ ./run_tests.sh neutron.tests.unit.test_api_v2:JSONV2TestCase
or
- $ ./tox quantum.tests.unit.test_api_v2:JSONV2TestCase
+ $ ./tox neutron.tests.unit.test_api_v2:JSONV2TestCase
Adding more tests
- Quantum has a fast growing code base and there is plenty of areas that
+ Neutron has a fast growing code base and there is plenty of areas that
need to be covered by unit tests.
To get a grasp of the areas where unit tests are needed, you can check
--- /dev/null
+#!/usr/bin/env python
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2012 OpenStack Foundation.
+# 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 neutron.agent.linux import dhcp
+dhcp.Dnsmasq.lease_update()
--- /dev/null
+#!/usr/bin/env python
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2012 OpenStack Foundation.
+# 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.
+
+"""Root wrapper for Neutron
+
+ Filters which commands neutron is allowed to run as another user.
+
+ To use this, you should set the following in neutron.conf and the
+ various .ini files for the agent plugins:
+ root_helper=sudo neutron-rootwrap /etc/neutron/rootwrap.conf
+
+ You also need to let the neutron user run neutron-rootwrap as root in
+ /etc/sudoers:
+ neutron ALL = (root) NOPASSWD: /usr/bin/neutron-rootwrap
+ /etc/neutron/rootwrap.conf *
+
+ Filter specs live in /etc/neutron/rootwrap.d/*.filters, or
+ other locations pointed to by /etc/neutron/rootwrap.conf.
+ To make allowed commands node-specific, your packaging should only
+ install apropriate .filters for commands which are needed on each
+ node.
+"""
+
+from __future__ import print_function
+
+import ConfigParser
+import logging
+import os
+import pwd
+import signal
+import subprocess
+import sys
+
+
+RC_UNAUTHORIZED = 99
+RC_NOCOMMAND = 98
+RC_BADCONFIG = 97
+RC_NOEXECFOUND = 96
+
+
+def _subprocess_setup():
+ # Python installs a SIGPIPE handler by default. This is usually not what
+ # non-Python subprocesses expect.
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+
+def _exit_error(execname, message, errorcode, log=True):
+ print("%s: %s" % (execname, message))
+ if log:
+ logging.error(message)
+ sys.exit(errorcode)
+
+
+if __name__ == '__main__':
+ # Split arguments, require at least a command
+ execname = sys.argv.pop(0)
+ if len(sys.argv) < 2:
+ _exit_error(execname, "No command specified", RC_NOCOMMAND, log=False)
+
+ configfile = sys.argv.pop(0)
+ userargs = sys.argv[:]
+
+ # Add ../ to sys.path to allow running from branch
+ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(execname),
+ os.pardir, os.pardir))
+ if os.path.exists(os.path.join(possible_topdir, "neutron", "__init__.py")):
+ sys.path.insert(0, possible_topdir)
+
+ from neutron.rootwrap import wrapper
+
+ # Load configuration
+ try:
+ rawconfig = ConfigParser.RawConfigParser()
+ rawconfig.read(configfile)
+ config = wrapper.RootwrapConfig(rawconfig)
+ except ValueError as exc:
+ msg = "Incorrect value in %s: %s" % (configfile, exc.message)
+ _exit_error(execname, msg, RC_BADCONFIG, log=False)
+ except ConfigParser.Error:
+ _exit_error(execname, "Incorrect configuration file: %s" % configfile,
+ RC_BADCONFIG, log=False)
+
+ if config.use_syslog:
+ wrapper.setup_syslog(execname,
+ config.syslog_log_facility,
+ config.syslog_log_level)
+
+ # Execute command if it matches any of the loaded filters
+ filters = wrapper.load_filters(config.filters_path)
+ try:
+ filtermatch = wrapper.match_filter(filters, userargs,
+ exec_dirs=config.exec_dirs)
+ if filtermatch:
+ command = filtermatch.get_command(userargs,
+ exec_dirs=config.exec_dirs)
+ if config.use_syslog:
+ logging.info("(%s > %s) Executing %s (filter match = %s)" % (
+ os.getlogin(), pwd.getpwuid(os.getuid())[0],
+ command, filtermatch.name))
+
+ obj = subprocess.Popen(command,
+ stdin=sys.stdin,
+ stdout=sys.stdout,
+ stderr=sys.stderr,
+ preexec_fn=_subprocess_setup,
+ env=filtermatch.get_environment(userargs))
+ obj.wait()
+ sys.exit(obj.returncode)
+
+ except wrapper.FilterMatchNotExecutable as exc:
+ msg = ("Executable not found: %s (filter match = %s)"
+ % (exc.match.exec_path, exc.match.name))
+ _exit_error(execname, msg, RC_NOEXECFOUND, log=config.use_syslog)
+
+ except wrapper.NoFilterMatched:
+ msg = ("Unauthorized command: %s (no filter matched)"
+ % ' '.join(userargs))
+ _exit_error(execname, msg, RC_UNAUTHORIZED, log=config.use_syslog)
import sys
sys.path.insert(0, os.getcwd())
-from quantum.plugins.nicira.check_nvp_config import main
+from neutron.plugins.nicira.check_nvp_config import main
main(sys.argv)
import sys
sys.path.insert(0, os.getcwd())
-from quantum.db.migration.cli import main
+from neutron.db.migration.cli import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.debug.shell import main
+from neutron.debug.shell import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent.dhcp_agent import main
+from neutron.agent.dhcp_agent import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent.linux import dhcp
+from neutron.agent.linux import dhcp
dhcp.Dnsmasq.lease_update()
import sys
sys.path.insert(0, os.getcwd())
-from quantum.plugins.hyperv.agent.hyperv_quantum_agent import main
+from neutron.plugins.hyperv.agent.hyperv_neutron_agent import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent.l3_agent import main
+from neutron.agent.l3_agent import main
main()
import sys
sys.path.insert(0, os.getcwd())
-from quantum.services.loadbalancer.drivers.haproxy.agent import main
+from neutron.services.loadbalancer.drivers.haproxy.agent import main
main()
import os
import sys
sys.path.insert(0, os.getcwd())
-from quantum.plugins.linuxbridge.agent.linuxbridge_quantum_agent import main
+from neutron.plugins.linuxbridge.agent.linuxbridge_neutron_agent import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent.metadata.agent import main
+from neutron.agent.metadata.agent import main
main()
import sys
sys.path.insert(0, os.getcwd())
-from quantum.plugins.mlnx.agent.eswitch_quantum_agent import main
+from neutron.plugins.mlnx.agent.eswitch_neutron_agent import main
main()
import os
import sys
sys.path.insert(0, os.getcwd())
-from quantum.plugins.nec.agent.nec_quantum_agent import main
+from neutron.plugins.nec.agent.nec_neutron_agent import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent.netns_cleanup_util import main
+from neutron.agent.netns_cleanup_util import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent.metadata.namespace_proxy import main
+from neutron.agent.metadata.namespace_proxy import main
main()
import os
import sys
sys.path.insert(0, os.getcwd())
-from quantum.plugins.openvswitch.agent.ovs_quantum_agent import main
+from neutron.plugins.openvswitch.agent.ovs_neutron_agent import main
main()
import sys
sys.path.insert(0, os.getcwd())
-from quantum.agent.ovs_cleanup_util import main
+from neutron.agent.ovs_cleanup_util import main
main()
# License for the specific language governing permissions and limitations
# under the License.
-"""Root wrapper for Quantum
+"""Root wrapper for Neutron
- Filters which commands quantum is allowed to run as another user.
+ Filters which commands neutron is allowed to run as another user.
- To use this, you should set the following in quantum.conf and the
+ To use this, you should set the following in neutron.conf and the
various .ini files for the agent plugins:
- root_helper=sudo quantum-rootwrap /etc/quantum/rootwrap.conf
+ root_helper=sudo neutron-rootwrap /etc/neutron/rootwrap.conf
- You also need to let the quantum user run quantum-rootwrap as root in
+ You also need to let the neutron user run neutron-rootwrap as root in
/etc/sudoers:
- quantum ALL = (root) NOPASSWD: /usr/bin/quantum-rootwrap
- /etc/quantum/rootwrap.conf *
+ neutron ALL = (root) NOPASSWD: /usr/bin/neutron-rootwrap
+ /etc/neutron/rootwrap.conf *
- Filter specs live in /etc/quantum/rootwrap.d/*.filters, or
- other locations pointed to by /etc/quantum/rootwrap.conf.
+ Filter specs live in /etc/neutron/rootwrap.d/*.filters, or
+ other locations pointed to by /etc/neutron/rootwrap.conf.
To make allowed commands node-specific, your packaging should only
install apropriate .filters for commands which are needed on each
node.
# Add ../ to sys.path to allow running from branch
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(execname),
os.pardir, os.pardir))
- if os.path.exists(os.path.join(possible_topdir, "quantum", "__init__.py")):
+ if os.path.exists(os.path.join(possible_topdir, "neutron", "__init__.py")):
sys.path.insert(0, possible_topdir)
- from quantum.rootwrap import wrapper
+ from neutron.rootwrap import wrapper
# Load configuration
try:
import os
import sys
-# If ../quantum/__init__.py exists, add ../ to Python search path, so that
+# If ../neutron/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
-if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'quantum', '__init__.py')):
+if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'neutron', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
from oslo.config import cfg
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import impl_zmq
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import impl_zmq
CONF = cfg.CONF
CONF.register_opts(rpc.rpc_opts)
def main():
- CONF(sys.argv[1:], project='quantum')
- logging.setup("quantum")
+ CONF(sys.argv[1:], project='neutron')
+ logging.setup("neutron")
with contextlib.closing(impl_zmq.ZmqProxy(CONF)) as reactor:
reactor.consume_in_thread()
import os
import sys
sys.path.insert(0, os.getcwd())
-from quantum.plugins.ryu.agent.ryu_quantum_agent import main
+from neutron.plugins.ryu.agent.ryu_neutron_agent import main
main()
import os
import sys
sys.path.insert(0, os.getcwd())
-from quantum.server import main as server
+from neutron.server import main as server
server()
from oslo.config import cfg
-from quantum import context
-from quantum import manager
-from quantum.common import config
-from quantum.openstack.common.notifier import api as notifier_api
+from neutron import context
+from neutron import manager
+from neutron.common import config
+from neutron.openstack.common.notifier import api as notifier_api
if __name__ == '__main__':
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
config.setup_logging(cfg.CONF)
context = context.get_admin_context()
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
for network in plugin.get_networks(context):
notifier_api.notify(context,
notifier_api.publisher_id('network'),
<sectionLabelIncludesComponentLabel>0</sectionLabelIncludesComponentLabel>\r
<postProcess>\r
<!-- Copies the figures to the correct location for webhelp -->\r
- <copy todir="${basedir}/target/docbkx/webhelp/quantum-api-1.0/figures">\r
- <fileset dir="${basedir}/source/docbkx/quantum-api-1.0/figures">\r
+ <copy todir="${basedir}/target/docbkx/webhelp/neutron-api-1.0/figures">\r
+ <fileset dir="${basedir}/source/docbkx/neutron-api-1.0/figures">\r
<include name="**/*.png" />\r
</fileset>\r
</copy>\r
\r
<!-- New stuff -->\r
<copy\r
- todir="${basedir}/target/docbkx/webhelp/trunk/developer/quantum-api-1.0">\r
+ todir="${basedir}/target/docbkx/webhelp/trunk/developer/neutron-api-1.0">\r
<fileset\r
- dir="${basedir}/target/docbkx/webhelp/quantum-api-1.0/quantum-api-guide/">\r
+ dir="${basedir}/target/docbkx/webhelp/neutron-api-1.0/neutron-api-guide/">\r
<include name="**/*" />\r
</fileset>\r
</copy>\r
<!--Moves PDFs to the needed placement -->\r
<move failonerror="false"\r
- file="${basedir}/target/docbkx/pdf/quantum-api-1.0/quantum-api-guide.pdf"\r
- tofile="${basedir}/target/docbkx/webhelp/trunk/developer/quantum-api-1.0/quantum-api-guide-trunk.pdf"/>\r
+ file="${basedir}/target/docbkx/pdf/neutron-api-1.0/neutron-api-guide.pdf"\r
+ tofile="${basedir}/target/docbkx/webhelp/trunk/developer/neutron-api-1.0/neutron-api-guide-trunk.pdf"/>\r
\r
<!--Deletes leftover uneeded directories -->\r
<delete\r
- dir="${basedir}/target/docbkx/webhelp/quantum-api-1.0"/>\r
+ dir="${basedir}/target/docbkx/webhelp/neutron-api-1.0"/>\r
</postProcess>\r
</configuration>\r
</execution>\r
<xincludeSupported>true</xincludeSupported>\r
<sourceDirectory>source/docbkx</sourceDirectory>\r
<includes>\r
- quantum-api-1.0/quantum-api-guide.xml\r
+ neutron-api-1.0/neutron-api-guide.xml\r
</includes>\r
<profileSecurity>reviewer</profileSecurity>\r
<branding>openstack</branding>\r
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-QUANTUM_DIR = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
-sys.path.insert(0, QUANTUM_DIR)
+NEUTRON_DIR = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
+sys.path.insert(0, NEUTRON_DIR)
# -- General configuration ---------------------------------------------------
master_doc = 'index'
# General information about the project.
-project = u'Quantum'
+project = u'Neutron'
copyright = u'2011-present, OpenStack Foundation.'
# The version info for the project you're documenting, acts as replacement for
# built documents.
#
# Version info
-from quantum.version import version_info as quantum_version
-release = quantum_version.release_string()
+from neutron.version import version_info as neutron_version
+release = neutron_version.release_string()
# The short X.Y version.
-version = quantum_version.version_string()
+version = neutron_version.version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
-modindex_common_prefix = ['quantum.']
+modindex_common_prefix = ['neutron.']
# -- Options for man page output --------------------------------------------
# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual'
man_pages = [
- ('man/quantum-server', 'quantum-server', u'Quantum Server',
+ ('man/neutron-server', 'neutron-server', u'Neutron Server',
[u'OpenStack'], 1)
]
#html_file_suffix = ''
# Output file base name for HTML help builder.
-htmlhelp_basename = 'quantumdoc'
+htmlhelp_basename = 'neutrondoc'
# -- Options for LaTeX output ------------------------------------------------
# (source start file, target name, title, author,
# documentclass [howto/manual]).
latex_documents = [
- ('index', 'Quantum.tex', u'Quantum Documentation',
- u'Quantum development team', 'manual'),
+ ('index', 'Neutron.tex', u'Neutron Documentation',
+ u'Neutron development team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
=================
A number of modules used are from the openstack-common project.
-The imported files are in 'quantum/openstack-common.conf'.
+The imported files are in 'neutron/openstack-common.conf'.
More information can be found at `OpenStack Common`_.
.. _`OpenStack Common`: https://launchpad.net/openstack-common
Developer Guide
===============
-The `Quantum Wiki`_ is a very good place to start.
+The `Neutron Wiki`_ is a very good place to start.
-.. _`Quantum wiki`: http://wiki.openstack.org/Quantum
+.. _`Neutron wiki`: http://wiki.openstack.org/Neutron
Plugin API
==========
-.. automodule:: quantum.quantum_plugin_base_v2
+.. automodule:: neutron.neutron_plugin_base_v2
-.. autoclass:: QuantumPluginBaseV2
+.. autoclass:: NeutronPluginBaseV2
:members:
License for the specific language governing permissions and limitations
under the License.
-Welcome to Quantum's developer documentation!
+Welcome to Neutron's developer documentation!
=============================================
-Quantum is an OpenStack project to provide "network connectivity as a service"
+Neutron is an OpenStack project to provide "network connectivity as a service"
between interface devices (e.g., vNICs) managed by other Openstack services
-(e.g., nova). It implements the `Quantum API Guide`_.
+(e.g., nova). It implements the `Neutron API Guide`_.
-.. _`Quantum API Guide`: http://docs.openstack.org/incubation/openstack-network/developer/quantum-api-1.0/content/
+.. _`Neutron API Guide`: http://docs.openstack.org/incubation/openstack-network/developer/quantum-api-1.0/content/
-This document describes Quantum for contributors of the project, and assumes
-that you are already familiar with Quantum from an `end-user perspective`_.
+This document describes Neutron for contributors of the project, and assumes
+that you are already familiar with Neutron from an `end-user perspective`_.
.. _`end-user perspective`: http://docs.openstack.org/trunk/openstack-network/admin/content/index.html
This documentation is generated by the Sphinx toolkit and lives in the source
-tree. Additional documentation on Quantum and other components of OpenStack
-can be found on the `OpenStack wiki`_. The `Quantum Development wiki`_ is a very good
+tree. Additional documentation on Neutron and other components of OpenStack
+can be found on the `OpenStack wiki`_. The `Neutron Development wiki`_ is a very good
place to start.
.. _`OpenStack wiki`: http://wiki.openstack.org
-.. _`Quantum Development wiki`: http://wiki.openstack.org/QuantumDevelopment
+.. _`Neutron Development wiki`: http://wiki.openstack.org/NeutronDevelopment
Enjoy!
.. toctree::
- man/quantum-server
+ man/neutron-server
==============
-quantum-server
+neutron-server
==============
--------------
-Quantum Server
+Neutron Server
--------------
:Author: openstack@lists.launchpad.net
SYNOPSIS
========
- quantum-server [options]
+ neutron-server [options]
DESCRIPTION
===========
-quantum-server provides a webserver that exposes the Quantum API, and
-passes all webservice calls to the Quantum plugin for processing.
+neutron-server provides a webserver that exposes the Neutron API, and
+passes all webservice calls to the Neutron plugin for processing.
OPTIONS
=======
-v, --verbose Print more verbose output
-d, --debug Print debugging output
--config-file=PATH Path to the config file to use, for example,
- /etc/quantum/quantum.conf. When not specified
+ /etc/neutron/neutron.conf. When not specified
(the default), we generally look at the first argument
specified to be a config file, and if that is also
missing, we search standard directories for a config
- file. (/etc/quantum/,
- /usr/lib/pythonX/site-packages/quantum/)
+ file. (/etc/neutron/,
+ /usr/lib/pythonX/site-packages/neutron/)
Logging Options:
The following configuration options are specific to logging
========
plugins.ini file contains the plugin information
-quantum.conf file contains configuration information in the form of python-gflags.
+neutron.conf file contains configuration information in the form of python-gflags.
SEE ALSO
========
-* `OpenStack Quantum <http://quantum.openstack.org>`__
+* `OpenStack Neutron <http://neutron.openstack.org>`__
BUGS
====
-* Quantum is sourced in Launchpad so you can view current bugs at `OpenStack Bugs <https://bugs.launchpad.net/quantum>`__
+* Neutron is sourced in Launchpad so you can view current bugs at `OpenStack Bugs <https://bugs.launchpad.net/neutron>`__
-[composite:quantum]
+[composite:neutron]
use = egg:Paste#urlmap
-/: quantumversions
-/v2.0: quantumapi_v2_0
+/: neutronversions
+/v2.0: neutronapi_v2_0
-[composite:quantumapi_v2_0]
-use = call:quantum.auth:pipeline_factory
-noauth = extensions quantumapiapp_v2_0
-keystone = authtoken keystonecontext extensions quantumapiapp_v2_0
+[composite:neutronapi_v2_0]
+use = call:neutron.auth:pipeline_factory
+noauth = extensions neutronapiapp_v2_0
+keystone = authtoken keystonecontext extensions neutronapiapp_v2_0
[filter:keystonecontext]
-paste.filter_factory = quantum.auth:QuantumKeystoneContext.factory
+paste.filter_factory = neutron.auth:NeutronKeystoneContext.factory
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
[filter:extensions]
-paste.filter_factory = quantum.api.extensions:plugin_aware_extension_middleware_factory
+paste.filter_factory = neutron.api.extensions:plugin_aware_extension_middleware_factory
-[app:quantumversions]
-paste.app_factory = quantum.api.versions:Versions.factory
+[app:neutronversions]
+paste.app_factory = neutron.api.versions:Versions.factory
-[app:quantumapiapp_v2_0]
-paste.app_factory = quantum.api.v2.router:APIRouter.factory
+[app:neutronapiapp_v2_0]
+paste.app_factory = neutron.api.v2.router:APIRouter.factory
# Show debugging output in log (sets DEBUG log level output)
# debug = true
-# The DHCP agent will resync its state with Quantum to recover from any
+# The DHCP agent will resync its state with Neutron to recover from any
# transient notification or rpc errors. The interval is number of
# seconds between attempts.
# resync_interval = 5
# matches you plugin.
# OVS based plugins(OVS, Ryu, NEC, NVP, BigSwitch/Floodlight)
-interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
+interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
# OVS based plugins(Ryu, NEC, NVP, BigSwitch/Floodlight) that use OVS
# as OpenFlow switch and check port status
#ovs_use_veth = True
# LinuxBridge
-#interface_driver = quantum.agent.linux.interface.BridgeInterfaceDriver
+#interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
# The agent can use other DHCP drivers. Dnsmasq is the simplest and requires
# no additional setup of the DHCP server.
-dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
+dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
# Allow overlapping IP (Must have kernel build with CONFIG_NET_NS=y and
# iproute2 package that supports namespaces).
# Allows for serving metadata requests coming from a dedicated metadata
# access network whose cidr is 169.254.169.254/16 (or larger prefix), and
-# is connected to a Quantum router from which the VMs send metadata
+# is connected to a Neutron router from which the VMs send metadata
# request. In this case DHCP Option 121 will not be injected in VMs, as
# they will be able to reach 169.254.169.254 through a router.
# This option requires enable_isolated_metadata = True
# matches your plugin.
# OVS based plugins (OVS, Ryu, NEC) that supports L3 agent
-interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
+interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
# OVS based plugins(Ryu, NEC) that use OVS
# as OpenFlow switch and check port status
#ovs_use_veth = True
# LinuxBridge
-#interface_driver = quantum.agent.linux.interface.BridgeInterfaceDriver
+#interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
# Allow overlapping IP (Must have kernel build with CONFIG_NET_NS=y and
# iproute2 package that supports namespaces).
# Indicates that this L3 agent should also handle routers that do not have
# an external network gateway configured. This option should be True only
-# for a single agent in a Quantum deployment, and may be False for all agents
+# for a single agent in a Neutron deployment, and may be False for all agents
# if all routers must have an external network gateway
# handle_internal_only_routers = True
# empty value for the linux bridge
# external_network_bridge = br-ex
-# TCP Port used by Quantum metadata server
+# TCP Port used by Neutron metadata server
# metadata_port = 9697
# Send this many gratuitous ARPs for HA setup. Set it below or equal to 0
# enable_metadata_proxy, which is true by default, can be set to False
# if the Nova metadata server is not available
-# enable_metadata_proxy = True
\ No newline at end of file
+# enable_metadata_proxy = True
# Show debugging output in log (sets DEBUG log level output)
# debug = true
-# The LBaaS agent will resync its state with Quantum to recover from any
+# The LBaaS agent will resync its state with Neutron to recover from any
# transient notification or rpc errors. The interval is number of
# seconds between attempts.
# periodic_interval = 10
# OVS based plugins(OVS, Ryu, NEC, NVP, BigSwitch/Floodlight)
-interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
+interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
# OVS based plugins(Ryu, NEC, NVP, BigSwitch/Floodlight) that use OVS
# as OpenFlow switch and check port status
# ovs_use_veth = True
# LinuxBridge
-# interface_driver = quantum.agent.linux.interface.BridgeInterfaceDriver
+# interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
# The agent requires a driver to manage the loadbalancer. HAProxy is the
# opensource version.
-#device_driver = quantum.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
+#device_driver = neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
# Allow overlapping IP (Must have kernel build with CONFIG_NET_NS=y and
# iproute2 package that supports namespaces).
# Show debugging output in log (sets DEBUG log level output)
# debug = True
-# The Quantum user information for accessing the Quantum API.
+# The Neutron user information for accessing the Neutron API.
auth_url = http://localhost:35357/v2.0
auth_region = RegionOne
admin_tenant_name = %SERVICE_TENANT_NAME%
# TCP Port used by Nova metadata server
# nova_metadata_port = 8775
-# When proxying metadata requests, Quantum signs the Instance-ID header with a
+# When proxying metadata requests, Neutron signs the Instance-ID header with a
# shared secret to prevent spoofing. You may select any string for a secret,
# but it must match here and in the configuration used by the Nova Metadata
-# Server. NOTE: Nova uses a different key: quantum_metadata_proxy_shared_secret
+# Server. NOTE: Nova uses a different key: neutron_metadata_proxy_shared_secret
# metadata_proxy_shared_secret =
-# quantum-rootwrap command filters for nodes on which quantum is
+# neutron-rootwrap command filters for nodes on which neutron is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
-# quantum-rootwrap command filters for nodes on which quantum is
+# neutron-rootwrap command filters for nodes on which neutron is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
dnsmasq_usr: DnsmasqFilter, /usr/sbin/dnsmasq, root
# dhcp-agent uses kill as well, that's handled by the generic KillFilter
# it looks like these are the only signals needed, per
-# quantum/agent/linux/dhcp.py
+# neutron/agent/linux/dhcp.py
kill_dnsmasq: KillFilter, root, /sbin/dnsmasq, -9, -HUP
kill_dnsmasq_usr: KillFilter, root, /usr/sbin/dnsmasq, -9, -HUP
ivs-ctl: CommandFilter, ivs-ctl, root
# metadata proxy
-metadata_proxy: CommandFilter, quantum-ns-metadata-proxy, root
+metadata_proxy: CommandFilter, neutron-ns-metadata-proxy, root
+metadata_proxy_quantum: CommandFilter, quantum-ns-metadata-proxy, root
# If installed from source (say, by devstack), the prefix will be
# /usr/local instead of /usr/bin.
-metadata_proxy_local: CommandFilter, /usr/local/bin/quantum-ns-metadata-proxy, root
+metadata_proxy_local: CommandFilter, /usr/local/bin/neutron-ns-metadata-proxy, root
+metadata_proxy_local_quantum: CommandFilter, /usr/local/bin/quantum-ns-metadata-proxy, root
# RHEL invocation of the metadata proxy will report /usr/bin/python
kill_metadata: KillFilter, root, /usr/bin/python, -9
kill_metadata7: KillFilter, root, /usr/bin/python2.7, -9
-# quantum-rootwrap command filters for nodes on which quantum is
+# neutron-rootwrap command filters for nodes on which neutron is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
[Filters]
-# quantum/agent/linux/iptables_manager.py
+# neutron/agent/linux/iptables_manager.py
# "iptables-save", ...
iptables-save: CommandFilter, iptables-save, root
iptables-restore: CommandFilter, iptables-restore, root
ip6tables-save: CommandFilter, ip6tables-save, root
ip6tables-restore: CommandFilter, ip6tables-restore, root
-# quantum/agent/linux/iptables_manager.py
+# neutron/agent/linux/iptables_manager.py
# "iptables", "-A", ...
iptables: CommandFilter, iptables, root
ip6tables: CommandFilter, ip6tables, root
-# quantum-rootwrap command filters for nodes on which quantum is
+# neutron-rootwrap command filters for nodes on which neutron is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
route: CommandFilter, route, root
# metadata proxy
-metadata_proxy: CommandFilter, quantum-ns-metadata-proxy, root
+metadata_proxy: CommandFilter, neutron-ns-metadata-proxy, root
+metadata_proxy_quantum: CommandFilter, quantum-ns-metadata-proxy, root
# If installed from source (say, by devstack), the prefix will be
# /usr/local instead of /usr/bin.
-metadata_proxy_local: CommandFilter, /usr/local/bin/quantum-ns-metadata-proxy, root
+metadata_proxy_local: CommandFilter, /usr/local/bin/neuton-ns-metadata-proxy, root
+metadata_proxy_local_quantum: CommandFilter, /usr/local/bin/quantum-ns-metadata-proxy, root
# RHEL invocation of the metadata proxy will report /usr/bin/python
kill_metadata: KillFilter, root, /usr/bin/python, -9
kill_metadata7: KillFilter, root, /usr/bin/python2.7, -9
-# quantum-rootwrap command filters for nodes on which quantum is
+# neuton-rootwrap command filters for nodes on which neuton is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
-# quantum-rootwrap command filters for nodes on which quantum is
+# neuton-rootwrap command filters for nodes on which neuton is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
-# quantum-rootwrap command filters for nodes on which quantum is
+# neuton-rootwrap command filters for nodes on which neuton is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
[Filters]
-# nec_quantum_agent
+# nec_neutron_agent
ovs-vsctl: CommandFilter, ovs-vsctl, root
-# quantum-rootwrap command filters for nodes on which quantum is
+# neutron-rootwrap command filters for nodes on which neutron is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
-# quantum-rootwrap command filters for nodes on which quantum is
+# neutron-rootwrap command filters for nodes on which neutron is
# expected to control network
#
# This file should be owned by (and only-writeable by) the root user
# unclear whether both variants are necessary, but I'm transliterating
# from the old mechanism
-# quantum/plugins/ryu/agent/ryu_quantum_agent.py:
+# neutron/plugins/ryu/agent/ryu_neutron_agent.py:
# "ovs-vsctl", "--timeout=2", ...
ovs-vsctl: CommandFilter, ovs-vsctl, root
-# quantum/plugins/ryu/agent/ryu_quantum_agent.py:
+# neutron/plugins/ryu/agent/ryu_neutron_agent.py:
# "xe", "vif-param-get", ...
xe: CommandFilter, xe, root
--- /dev/null
+neutron
\ No newline at end of file
--- /dev/null
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack Foundation
+# 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.
+
+import gettext
+
+
+gettext.install('neutron', unicode=1)
from oslo.config import cfg
-from quantum.common import config
-from quantum.openstack.common import log as logging
+from neutron.common import config
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def setup_conf():
bind_opts = [
cfg.StrOpt('state_path',
- default='/var/lib/quantum',
+ default='/var/lib/neutron',
help=_('Top-level directory for maintaining dhcp state')),
]
import netaddr
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.linux import dhcp
-from quantum.agent.linux import external_process
-from quantum.agent.linux import interface
-from quantum.agent.linux import ip_lib
-from quantum.agent import rpc as agent_rpc
-from quantum.common import constants
-from quantum.common import exceptions
-from quantum.common import topics
-from quantum.common import utils
-from quantum import context
-from quantum import manager
-from quantum.openstack.common import importutils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
-from quantum.openstack.common.rpc import proxy
-from quantum.openstack.common import service
-from quantum.openstack.common import uuidutils
-from quantum import service as quantum_service
+from neutron.agent.common import config
+from neutron.agent.linux import dhcp
+from neutron.agent.linux import external_process
+from neutron.agent.linux import interface
+from neutron.agent.linux import ip_lib
+from neutron.agent import rpc as agent_rpc
+from neutron.common import constants
+from neutron.common import exceptions
+from neutron.common import legacy
+from neutron.common import topics
+from neutron.common import utils
+from neutron import context
+from neutron import manager
+from neutron.openstack.common import importutils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
+from neutron.openstack.common.rpc import proxy
+from neutron.openstack.common import service
+from neutron.openstack.common import uuidutils
+from neutron import service as neutron_service
LOG = logging.getLogger(__name__)
NS_PREFIX = 'qdhcp-'
cfg.IntOpt('resync_interval', default=5,
help=_("Interval to resync.")),
cfg.StrOpt('dhcp_driver',
- default='quantum.agent.linux.dhcp.Dnsmasq',
+ default='neutron.agent.linux.dhcp.Dnsmasq',
help=_("The driver used to manage the DHCP server.")),
cfg.BoolOpt('use_namespaces', default=True,
help=_("Allow overlapping IP.")),
LOG.exception(_('Unable to update lease'))
def sync_state(self):
- """Sync the local DHCP state with Quantum."""
+ """Sync the local DHCP state with Neutron."""
LOG.info(_('Synchronizing state'))
known_networks = set(self.cache.get_network_ids())
# The proxy might work for either a single network
# or all the networks connected via a router
# to the one passed as a parameter
- quantum_lookup_param = '--network_id=%s' % network.id
+ neutron_lookup_param = '--network_id=%s' % network.id
meta_cidr = netaddr.IPNetwork(METADATA_DEFAULT_IP)
has_metadata_subnet = any(netaddr.IPNetwork(s.cidr) in meta_cidr
for s in network.subnets)
{'port_num': len(router_ports),
'port_id': router_ports[0].id,
'router_id': router_ports[0].device_id})
- quantum_lookup_param = ('--router_id=%s' %
+ neutron_lookup_param = ('--router_id=%s' %
router_ports[0].device_id)
def callback(pid_file):
- proxy_cmd = ['quantum-ns-metadata-proxy',
+ proxy_cmd = ['neutron-ns-metadata-proxy',
'--pid_file=%s' % pid_file,
- quantum_lookup_param,
+ neutron_lookup_param,
'--state_path=%s' % self.conf.state_path,
'--metadata_port=%d' % METADATA_PORT]
proxy_cmd.extend(config.get_log_args(
- cfg.CONF, 'quantum-ns-metadata-proxy-%s.log' % network.id))
+ cfg.CONF, 'neutron-ns-metadata-proxy-%s.log' % network.id))
return proxy_cmd
pm = external_process.ProcessManager(
if not conf.interface_driver:
raise SystemExit(_('You must specify an interface driver'))
try:
- self.driver = importutils.import_object(conf.interface_driver,
- conf)
+ self.driver = importutils.import_object(
+ conf.interface_driver, conf
+ )
except Exception:
msg = _("Error importing interface driver "
"'%s'") % conf.interface_driver
"""UNIX domain socket server for processing lease updates.
Network namespace isolation prevents the DHCP process from notifying
- Quantum directly. This class works around the limitation by using the
+ Neutron directly. This class works around the limitation by using the
domain socket to pass the information. This class handles message.
receiving and then calls the callback method.
"""
super(DhcpAgentWithStateReport, self).__init__(host=host)
self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
self.agent_state = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': host,
'topic': topics.DHCP_AGENT,
'configurations': {
self.use_call = False
except AttributeError:
# This means the server does not support report_state
- LOG.warn(_("Quantum server does not support state report."
+ LOG.warn(_("Neutron server does not support state report."
" State report for this agent will be disabled."))
self.heartbeat.stop()
self.run()
def main():
eventlet.monkey_patch()
register_options()
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
config.setup_logging(cfg.CONF)
- server = quantum_service.Service.create(
- binary='quantum-dhcp-agent',
+ legacy.modernize_quantum_config(cfg.CONF)
+ server = neutron_service.Service.create(
+ binary='neutron-dhcp-agent',
topic=topics.DHCP_AGENT,
report_interval=cfg.CONF.AGENT.report_interval,
- manager='quantum.agent.dhcp_agent.DhcpAgentWithStateReport')
+ manager='neutron.agent.dhcp_agent.DhcpAgentWithStateReport')
service.launch(server).wait()
import netaddr
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.linux import external_process
-from quantum.agent.linux import interface
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import iptables_manager
-from quantum.agent.linux import utils
-from quantum.agent import rpc as agent_rpc
-from quantum.common import constants as l3_constants
-from quantum.common import topics
-from quantum.common import utils as common_utils
-from quantum import context
-from quantum import manager
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
-from quantum.openstack.common import periodic_task
-from quantum.openstack.common.rpc import common as rpc_common
-from quantum.openstack.common.rpc import proxy
-from quantum.openstack.common import service
-from quantum import service as quantum_service
+from neutron.agent.common import config
+from neutron.agent.linux import external_process
+from neutron.agent.linux import interface
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import iptables_manager
+from neutron.agent.linux import utils
+from neutron.agent import rpc as agent_rpc
+from neutron.common import constants as l3_constants
+from neutron.common import legacy
+from neutron.common import topics
+from neutron.common import utils as common_utils
+from neutron import context
+from neutron import manager
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
+from neutron.openstack.common import periodic_task
+from neutron.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.rpc import proxy
+from neutron.openstack.common import service
+from neutron import service as neutron_service
LOG = logging.getLogger(__name__)
"interface.")),
cfg.IntOpt('metadata_port',
default=9697,
- help=_("TCP Port used by Quantum metadata namespace "
+ help=_("TCP Port used by Neutron metadata namespace "
"proxy.")),
cfg.IntOpt('send_arp_for_ha',
default=3,
if not self.conf.interface_driver:
raise SystemExit(_('An interface driver must be specified'))
try:
- self.driver = importutils.import_object(self.conf.interface_driver,
- self.conf)
+ self.driver = importutils.import_object(
+ self.conf.interface_driver,
+ self.conf
+ )
except Exception:
msg = _("Error importing interface driver "
"'%s'") % self.conf.interface_driver
if e.exc_type == 'TooManyExternalNetworks':
msg = _(
"The 'gateway_external_network_id' option must be "
- "configured for this agent as Quantum has more than "
+ "configured for this agent as Neutron has more than "
"one external network.")
raise Exception(msg)
else:
def _spawn_metadata_proxy(self, router_info):
def callback(pid_file):
- proxy_cmd = ['quantum-ns-metadata-proxy',
+ proxy_cmd = ['neutron-ns-metadata-proxy',
'--pid_file=%s' % pid_file,
'--router_id=%s' % router_info.router_id,
'--state_path=%s' % self.conf.state_path,
'--metadata_port=%s' % self.conf.metadata_port]
proxy_cmd.extend(config.get_log_args(
- cfg.CONF, 'quantum-ns-metadata-proxy-%s.log' %
+ cfg.CONF, 'neutron-ns-metadata-proxy-%s.log' %
router_info.router_id))
return proxy_cmd
super(L3NATAgentWithStateReport, self).__init__(host=host, conf=conf)
self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
self.agent_state = {
- 'binary': 'quantum-l3-agent',
+ 'binary': 'neutron-l3-agent',
'host': host,
'topic': topics.L3_AGENT,
'configurations': {
self.use_call = False
except AttributeError:
# This means the server does not support report_state
- LOG.warn(_("Quantum server does not support state report."
+ LOG.warn(_("Neutron server does not support state report."
" State report for this agent will be disabled."))
self.heartbeat.stop()
return
config.register_root_helper(conf)
conf.register_opts(interface.OPTS)
conf.register_opts(external_process.OPTS)
- conf(project='quantum')
+ conf(project='neutron')
config.setup_logging(conf)
- server = quantum_service.Service.create(
- binary='quantum-l3-agent',
+ legacy.modernize_quantum_config(conf)
+ server = neutron_service.Service.create(
+ binary='neutron-l3-agent',
topic=topics.L3_AGENT,
report_interval=cfg.CONF.AGENT.report_interval,
- manager='quantum.agent.l3_agent.L3NATAgentWithStateReport')
+ manager='neutron.agent.l3_agent.L3NATAgentWithStateReport')
service.launch(server).wait()
import os
import sys
-from quantum.agent.linux import utils
-from quantum.openstack.common import log as logging
+from neutron.agent.linux import utils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
import netaddr
from oslo.config import cfg
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import uuidutils
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import uuidutils
LOG = logging.getLogger(__name__)
class Dnsmasq(DhcpLocalProcess):
# The ports that need to be opened when security policies are active
- # on the Quantum port used for DHCP. These are provided as a convenience
+ # on the Neutron port used for DHCP. These are provided as a convenience
# for users of this class.
PORTS = {IPV4: [(UDP, DNS_PORT), (TCP, DNS_PORT), (UDP, DHCPV4_PORT)],
IPV6: [(UDP, DNS_PORT), (TCP, DNS_PORT), (UDP, DHCPV6_PORT)],
_TAG_PREFIX = 'tag%d'
- QUANTUM_NETWORK_ID_KEY = 'QUANTUM_NETWORK_ID'
- QUANTUM_RELAY_SOCKET_PATH_KEY = 'QUANTUM_RELAY_SOCKET_PATH'
+ NEUTRON_NETWORK_ID_KEY = 'NEUTRON_NETWORK_ID'
+ NEUTRON_RELAY_SOCKET_PATH_KEY = 'NEUTRON_RELAY_SOCKET_PATH'
MINIMUM_VERSION = 2.59
@classmethod
def spawn_process(self):
"""Spawns a Dnsmasq process for the network."""
env = {
- self.QUANTUM_NETWORK_ID_KEY: self.network.id,
- self.QUANTUM_RELAY_SOCKET_PATH_KEY:
+ self.NEUTRON_NETWORK_ID_KEY: self.network.id,
+ self.NEUTRON_RELAY_SOCKET_PATH_KEY:
self.conf.dhcp_lease_relay_socket
}
def _lease_relay_script_path(self):
return os.path.join(os.path.dirname(sys.argv[0]),
- 'quantum-dhcp-agent-dnsmasq-lease-update')
+ 'neutron-dhcp-agent-dnsmasq-lease-update')
def _format_option(self, index, option_name, *args):
if self.version >= self.MINIMUM_VERSION:
@classmethod
def lease_update(cls):
- network_id = os.environ.get(cls.QUANTUM_NETWORK_ID_KEY)
- dhcp_relay_socket = os.environ.get(cls.QUANTUM_RELAY_SOCKET_PATH_KEY)
+ network_id = os.environ.get(cls.NEUTRON_NETWORK_ID_KEY)
+ dhcp_relay_socket = os.environ.get(cls.NEUTRON_RELAY_SOCKET_PATH_KEY)
action = sys.argv[1]
if action not in ('add', 'del', 'old'):
from oslo.config import cfg
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.openstack.common import log as logging
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class ProcessManager(object):
- """An external process manager for Quantum spawned processes.
+ """An external process manager for Neutron spawned processes.
Note: The manager expects uuid to be in cmdline.
"""
import netaddr
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import ovs_lib
-from quantum.agent.linux import utils
-from quantum.common import exceptions
-from quantum.extensions.flavor import (FLAVOR_NETWORK)
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
+from neutron.agent.common import config
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import ovs_lib
+from neutron.agent.linux import utils
+from neutron.common import exceptions
+from neutron.extensions.flavor import (FLAVOR_NETWORK)
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class MetaInterfaceDriver(LinuxInterfaceDriver):
def __init__(self, conf):
super(MetaInterfaceDriver, self).__init__(conf)
- from quantumclient.v2_0 import client
- self.quantum = client.Client(
+ from neutronclient.v2_0 import client
+ self.neutron = client.Client(
username=self.conf.admin_user,
password=self.conf.admin_password,
tenant_name=self.conf.admin_tenant_name,
self.flavor_driver_map[flavor] = self._load_driver(driver_name)
def _get_flavor_by_network_id(self, network_id):
- network = self.quantum.show_network(network_id)
+ network = self.neutron.show_network(network_id)
return network['network'][FLAVOR_NETWORK]
def _get_driver_by_network_id(self, network_id):
import netaddr
from oslo.config import cfg
-from quantum.agent.linux import utils
-from quantum.common import exceptions
+from neutron.agent.linux import utils
+from neutron.common import exceptions
OPTS = [
import netaddr
from oslo.config import cfg
-from quantum.agent import firewall
-from quantum.agent.linux import iptables_manager
-from quantum.common import constants
-from quantum.openstack.common import log as logging
+from neutron.agent import firewall
+from neutron.agent.linux import iptables_manager
+from neutron.common import constants
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
import inspect
import os
-from quantum.agent.linux import utils as linux_utils
-from quantum.common import utils
-from quantum.openstack.common import log as logging
+from neutron.agent.linux import utils as linux_utils
+from neutron.common import utils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
# NOTE(vish): Iptables supports chain names of up to 28 characters, and we
A number of chains are set up to begin with.
- First, quantum-filter-top. It's added at the top of FORWARD and OUTPUT. Its
+ First, neutron-filter-top. It's added at the top of FORWARD and OUTPUT. Its
name is not wrapped, so it's shared between the various nova workers. It's
intended for rules that need to live at the top of the FORWARD and OUTPUT
chains. It's in both the ipv4 and ipv6 set of tables.
For ipv4 and ipv6, the built-in INPUT, OUTPUT, and FORWARD filter chains
are wrapped, meaning that the "real" INPUT chain has a rule that jumps to
the wrapped INPUT chain, etc. Additionally, there's a wrapped chain named
- "local" which is jumped to from quantum-filter-top.
+ "local" which is jumped to from neutron-filter-top.
For ipv4, the built-in PREROUTING, OUTPUT, and POSTROUTING nat chains are
wrapped in the same was as the built-in filter chains. Additionally,
self.ipv4 = {'filter': IptablesTable()}
self.ipv6 = {'filter': IptablesTable()}
- # Add a quantum-filter-top chain. It's intended to be shared
+ # Add a neutron-filter-top chain. It's intended to be shared
# among the various nova components. It sits at the very top
# of FORWARD and OUTPUT.
for tables in [self.ipv4, self.ipv6]:
- tables['filter'].add_chain('quantum-filter-top', wrap=False)
- tables['filter'].add_rule('FORWARD', '-j quantum-filter-top',
+ tables['filter'].add_chain('neutron-filter-top', wrap=False)
+ tables['filter'].add_rule('FORWARD', '-j neutron-filter-top',
wrap=False, top=True)
- tables['filter'].add_rule('OUTPUT', '-j quantum-filter-top',
+ tables['filter'].add_rule('OUTPUT', '-j neutron-filter-top',
wrap=False, top=True)
tables['filter'].add_chain('local')
- tables['filter'].add_rule('quantum-filter-top', '-j $local',
+ tables['filter'].add_rule('neutron-filter-top', '-j $local',
wrap=False)
# Wrap the built-in chains
(chain), wrap=False)
if not state_less:
- # Add a quantum-postrouting-bottom chain. It's intended to be
+ # Add a neutron-postrouting-bottom chain. It's intended to be
# shared among the various nova components. We set it as the last
# chain of POSTROUTING chain.
- self.ipv4['nat'].add_chain('quantum-postrouting-bottom',
+ self.ipv4['nat'].add_chain('neutron-postrouting-bottom',
wrap=False)
self.ipv4['nat'].add_rule('POSTROUTING',
- '-j quantum-postrouting-bottom',
+ '-j neutron-postrouting-bottom',
wrap=False)
- # We add a snat chain to the shared quantum-postrouting-bottom
+ # We add a snat chain to the shared neutron-postrouting-bottom
# chain so that it's applied last.
self.ipv4['nat'].add_chain('snat')
- self.ipv4['nat'].add_rule('quantum-postrouting-bottom',
+ self.ipv4['nat'].add_rule('neutron-postrouting-bottom',
'-j $snat', wrap=False)
# And then we add a float-snat chain and jump to first thing in
import re
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.plugins.openvswitch.common import constants
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.plugins.openvswitch.common import constants
LOG = logging.getLogger(__name__)
from eventlet.green import subprocess
-from quantum.common import utils
-from quantum.openstack.common import log as logging
+from neutron.common import utils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
import eventlet
import httplib2
+from neutronclient.v2_0 import client
from oslo.config import cfg
-from quantumclient.v2_0 import client
import webob
-from quantum.common import config
-from quantum.common import utils
-from quantum.openstack.common import log as logging
-from quantum import wsgi
+from neutron.common import config
+from neutron.common import utils
+from neutron.openstack.common import log as logging
+from neutron import wsgi
LOG = logging.getLogger(__name__)
self.conf = conf
self.auth_info = {}
- def _get_quantum_client(self):
+ def _get_neutron_client(self):
qclient = client.Client(
username=self.conf.admin_user,
password=self.conf.admin_password,
return webob.exc.HTTPInternalServerError(explanation=unicode(msg))
def _get_instance_id(self, req):
- qclient = self._get_quantum_client()
+ qclient = self._get_neutron_client()
remote_address = req.headers.get('X-Forwarded-For')
- network_id = req.headers.get('X-Quantum-Network-ID')
- router_id = req.headers.get('X-Quantum-Router-ID')
+ network_id = req.headers.get('X-Neutron-Network-ID')
+ router_id = req.headers.get('X-Neutron-Router-ID')
if network_id:
networks = [network_id]
os.makedirs(dirname, 0o755)
def run(self):
- server = UnixDomainWSGIServer('quantum-metadata-agent')
+ server = UnixDomainWSGIServer('neutron-metadata-agent')
server.start(MetadataProxyHandler(self.conf),
self.conf.metadata_proxy_socket)
server.wait()
eventlet.monkey_patch()
cfg.CONF.register_opts(UnixDomainMetadataProxy.OPTS)
cfg.CONF.register_opts(MetadataProxyHandler.OPTS)
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
config.setup_logging(cfg.CONF)
utils.log_opt_values(LOG)
proxy = UnixDomainMetadataProxy(cfg.CONF)
from oslo.config import cfg
import webob
-from quantum.agent.linux import daemon
-from quantum.common import config
-from quantum.common import utils
-from quantum.openstack.common import log as logging
-from quantum import wsgi
+from neutron.agent.linux import daemon
+from neutron.common import config
+from neutron.common import utils
+from neutron.openstack.common import log as logging
+from neutron import wsgi
proxy_socket = cfg.StrOpt('metadata_proxy_socket',
default='$state_path/metadata_proxy',
}
if self.router_id:
- headers['X-Quantum-Router-ID'] = self.router_id
+ headers['X-Neutron-Router-ID'] = self.router_id
else:
- headers['X-Quantum-Network-ID'] = self.network_id
+ headers['X-Neutron-Network-ID'] = self.network_id
url = urlparse.urlunsplit((
'http',
handler = NetworkMetadataProxyHandler(
self.network_id,
self.router_id)
- proxy = wsgi.Server('quantum-network-metadata-proxy')
+ proxy = wsgi.Server('neutron-network-metadata-proxy')
proxy.start(handler, self.port)
proxy.wait()
cfg.CONF.register_cli_opts(opts)
# Don't get the default configuration file
- cfg.CONF(project='quantum', default_config_files=[])
+ cfg.CONF(project='neutron', default_config_files=[])
config.setup_logging(cfg.CONF)
utils.log_opt_values(LOG)
proxy = ProxyDaemon(cfg.CONF.pid_file,
import eventlet
from oslo.config import cfg
-from quantum.agent.common import config as agent_config
-from quantum.agent import dhcp_agent
-from quantum.agent import l3_agent
-from quantum.agent.linux import dhcp
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import ovs_lib
-from quantum.api.v2 import attributes
-from quantum.common import config
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
+from neutron.agent.common import config as agent_config
+from neutron.agent import dhcp_agent
+from neutron.agent import l3_agent
+from neutron.agent.linux import dhcp
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import ovs_lib
+from neutron.api.v2 import attributes
+from neutron.common import config
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
opts = [
cfg.StrOpt('dhcp_driver',
- default='quantum.agent.linux.dhcp.Dnsmasq',
+ default='neutron.agent.linux.dhcp.Dnsmasq',
help=_("The driver used to manage the DHCP server.")),
]
will re-confirm the namespace is empty.
The utility is designed to clean-up after the forced or unexpected
- termination of Quantum agents.
+ termination of Neutron agents.
The --force flag should only be used as part of the cleanup of a devstack
installation as it will blindly purge namespaces and their devices. This
from oslo.config import cfg
-from quantum.agent.common import config as agent_config
-from quantum.agent import l3_agent
-from quantum.agent.linux import interface
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import ovs_lib
-from quantum.common import config
-from quantum.openstack.common import log as logging
+from neutron.agent.common import config as agent_config
+from neutron.agent import l3_agent
+from neutron.agent.linux import interface
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import ovs_lib
+from neutron.common import config
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
default=False,
help=_('True to delete all ports on all the OpenvSwitch '
'bridges. False to delete ports created by '
- 'Quantum on integration and external network '
+ 'Neutron on integration and external network '
'bridges.'))
]
return conf
-def collect_quantum_ports(bridges, root_helper):
- """Collect ports created by Quantum from OVS."""
+def collect_neutron_ports(bridges, root_helper):
+ """Collect ports created by Neutron from OVS."""
ports = []
for bridge in bridges:
ovs = ovs_lib.OVSBridge(bridge, root_helper)
return ports
-def delete_quantum_ports(ports, root_helper):
- """Delete non-internal ports created by Quantum
+def delete_neutron_ports(ports, root_helper):
+ """Delete non-internal ports created by Neutron
Non-internal OVS ports need to be removed manually.
"""
def main():
"""Main method for cleaning up OVS bridges.
- The utility cleans up the integration bridges used by Quantum.
+ The utility cleans up the integration bridges used by Neutron.
"""
conf = setup_conf()
else:
bridges = available_configuration_bridges
- # Collect existing ports created by Quantum on configuration bridges.
+ # Collect existing ports created by Neutron on configuration bridges.
# After deleting ports from OVS bridges, we cannot determine which
- # ports were created by Quantum, so port information is collected now.
- ports = collect_quantum_ports(available_configuration_bridges,
+ # ports were created by Neutron, so port information is collected now.
+ ports = collect_neutron_ports(available_configuration_bridges,
conf.AGENT.root_helper)
for bridge in bridges:
ovs = ovs_lib.OVSBridge(bridge, conf.AGENT.root_helper)
ovs.delete_ports(all_ports=conf.ovs_all_ports)
- # Remove remaining ports created by Quantum (usually veth pair)
- delete_quantum_ports(ports, conf.AGENT.root_helper)
+ # Remove remaining ports created by Neutron (usually veth pair)
+ delete_neutron_ports(ports, conf.AGENT.root_helper)
LOG.info(_("OVS cleanup completed successfully"))
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.common import topics
+from neutron.common import topics
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import proxy
-from quantum.openstack.common import timeutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import proxy
+from neutron.openstack.common import timeutils
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.common import topics
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
+from neutron.common import topics
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
SG_RPC_VERSION = "1.1"
security_group_opts = [
cfg.StrOpt(
'firewall_driver',
- default='quantum.agent.firewall.NoopFirewallDriver')
+ default='neutron.agent.firewall.NoopFirewallDriver')
]
cfg.CONF.register_opts(security_group_opts, 'SECURITYGROUP')
def is_firewall_enabled():
return (cfg.CONF.SECURITYGROUP.firewall_driver !=
- 'quantum.agent.firewall.NoopFirewallDriver')
+ 'neutron.agent.firewall.NoopFirewallDriver')
def disable_security_group_extension_if_noop_driver(
from oslo.config import cfg
from webob import exc
-from quantum.common import constants
-from quantum.common import exceptions
-from quantum.openstack.common import log as logging
+from neutron.common import constants
+from neutron.common import exceptions
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
pass
-class QuantumController(object):
- """Base controller class for Quantum API."""
+class NeutronController(object):
+ """Base controller class for Neutron API."""
# _resource_name will be redefined in sub concrete controller
_resource_name = None
def __init__(self, plugin):
self._plugin = plugin
- super(QuantumController, self).__init__()
+ super(NeutronController, self).__init__()
def _prepare_request_body(self, body, params):
"""Verifies required parameters are in request body.
import webob.dec
import webob.exc
-from quantum.api.v2 import attributes
-from quantum.common import exceptions
-import quantum.extensions
-from quantum.manager import QuantumManager
-from quantum.openstack.common import log as logging
-from quantum import wsgi
+from neutron.api.v2 import attributes
+from neutron.common import exceptions
+import neutron.extensions
+from neutron.manager import NeutronManager
+from neutron.openstack.common import log as logging
+from neutron import wsgi
-LOG = logging.getLogger('quantum.api.extensions')
+LOG = logging.getLogger('neutron.api.extensions')
class PluginInterface(object):
def get_instance(cls):
if cls._instance is None:
cls._instance = cls(get_extensions_path(),
- QuantumManager.get_service_plugins())
+ NeutronManager.get_service_plugins())
return cls._instance
class RequestExtension(object):
- """Extend requests and responses of core Quantum OpenStack API controllers.
+ """Extend requests and responses of core Neutron OpenStack API controllers.
Provide a way to add data to responses and handle custom request data
- that is sent to core Quantum OpenStack API controllers.
+ that is sent to core Neutron OpenStack API controllers.
"""
def __init__(self, method, url_route, handler):
class ActionExtension(object):
- """Add custom actions to core Quantum OpenStack API controllers."""
+ """Add custom actions to core Neutron OpenStack API controllers."""
def __init__(self, collection, action_name, handler):
self.collection = collection
class ResourceExtension(object):
- """Add top level resources to the OpenStack API in Quantum."""
+ """Add top level resources to the OpenStack API in Neutron."""
def __init__(self, collection, controller, parent=None, path_prefix="",
collection_actions={}, member_actions={}, attr_map={}):
# Returns the extention paths from a config entry and the __path__
-# of quantum.extensions
+# of neutron.extensions
def get_extensions_path():
- paths = ':'.join(quantum.extensions.__path__)
+ paths = ':'.join(neutron.extensions.__path__)
if cfg.CONF.api_extensions_path:
paths = ':'.join([cfg.CONF.api_extensions_path, paths])
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.common import constants
-from quantum.common import topics
-from quantum.common import utils
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import proxy
+from neutron.common import constants
+from neutron.common import topics
+from neutron.common import utils
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import proxy
LOG = logging.getLogger(__name__)
topic=topic, default_version=self.BASE_RPC_API_VERSION)
def _get_dhcp_agents(self, context, network_id):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
dhcp_agents = plugin.get_dhcp_agents_hosting_networks(
context, [network_id], active=True)
return [(dhcp_agent.host, dhcp_agent.topic) for
def _notification(self, context, method, payload, network_id):
"""Notify all the agents that are hosting the network."""
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
if (method != 'network_delete_end' and utils.is_extension_supported(
plugin, constants.AGENT_SCHEDULER_EXT_ALIAS)):
if method == 'port_create_end':
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.common import constants
-from quantum.common import topics
-from quantum.common import utils
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import proxy
+from neutron.common import constants
+from neutron.common import topics
+from neutron.common import utils
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import proxy
LOG = logging.getLogger(__name__)
operation, data):
"""Notify changed routers to hosting l3 agents."""
adminContext = context.is_admin and context or context.elevated()
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
for router in routers:
l3_agents = plugin.get_l3_agents_hosting_routers(
adminContext, [router['id']],
def _notification(self, context, method, routers, operation, data):
"""Notify all the agents that are hosting the routers."""
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
if utils.is_extension_supported(
plugin, constants.AGENT_SCHEDULER_EXT_ALIAS):
adminContext = (context.is_admin and
import netaddr
import re
-from quantum.common import constants
-from quantum.common import exceptions as q_exc
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import uuidutils
+from neutron.common import constants
+from neutron.common import exceptions as q_exc
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import uuidutils
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.api import api_common
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.api.v2 import resource as wsgi_resource
-from quantum.common import exceptions
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.notifier import api as notifier_api
-from quantum import policy
-from quantum import quota
+from neutron.api import api_common
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.api.v2 import resource as wsgi_resource
+from neutron.common import exceptions
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.notifier import api as notifier_api
+from neutron import policy
+from neutron import quota
LOG = logging.getLogger(__name__)
import webob.dec
import webob.exc
-from quantum.api.v2 import attributes
-from quantum.common import exceptions
-from quantum.openstack.common import log as logging
-from quantum import wsgi
+from neutron.api.v2 import attributes
+from neutron.common import exceptions
+from neutron.openstack.common import log as logging
+from neutron import wsgi
LOG = logging.getLogger(__name__)
method = getattr(controller, action)
result = method(request=request, **args)
- except (exceptions.QuantumException,
+ except (exceptions.NeutronException,
netaddr.AddrFormatError) as e:
LOG.exception(_('%s failed'), action)
- body = serializer.serialize({'QuantumError': e})
+ body = serializer.serialize({'NeutronError': e})
kwargs = {'body': body, 'content_type': content_type}
for fault in faults:
if isinstance(e, fault):
raise webob.exc.HTTPInternalServerError(**kwargs)
except webob.exc.HTTPException as e:
LOG.exception(_('%s failed'), action)
- e.body = serializer.serialize({'QuantumError': e})
+ e.body = serializer.serialize({'NeutronError': e})
e.content_type = content_type
raise
except NotImplementedError as e:
# Do not expose details of 500 error to clients.
msg = _('Request Failed: internal server error while '
'processing your request.')
- body = serializer.serialize({'QuantumError': msg})
+ body = serializer.serialize({'NeutronError': msg})
kwargs = {'body': body, 'content_type': content_type}
raise webob.exc.HTTPInternalServerError(**kwargs)
import webob.dec
import webob.exc
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.api.v2 import base
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum import wsgi
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.api.v2 import base
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron import wsgi
LOG = logging.getLogger(__name__)
def __init__(self, **local_config):
mapper = routes_mapper.Mapper()
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
ext_mgr.extend_resources("2.0", attributes.RESOURCE_ATTRIBUTE_MAP)
import webob.dec
-from quantum.api.views import versions as versions_view
-from quantum.openstack.common import log as logging
-from quantum import wsgi
+from neutron.api.views import versions as versions_view
+from neutron.openstack.common import log as logging
+from neutron import wsgi
LOG = logging.getLogger(__name__)
@webob.dec.wsgify(RequestClass=wsgi.Request)
def __call__(self, req):
- """Respond to a request for all Quantum API versions."""
+ """Respond to a request for all Neutron API versions."""
version_objs = [
{
"id": "v2.0",
--- /dev/null
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack Foundation
+#
+# 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 oslo.config import cfg
+import webob.dec
+import webob.exc
+
+from neutron import context
+from neutron.openstack.common import log as logging
+from neutron import wsgi
+
+LOG = logging.getLogger(__name__)
+
+
+class NeutronKeystoneContext(wsgi.Middleware):
+ """Make a request context from keystone headers."""
+
+ @webob.dec.wsgify
+ def __call__(self, req):
+ # Determine the user ID
+ user_id = req.headers.get('X_USER_ID', req.headers.get('X_USER'))
+ if not user_id:
+ LOG.debug(_("Neither X_USER_ID nor X_USER found in request"))
+ return webob.exc.HTTPUnauthorized()
+
+ # Determine the tenant
+ tenant_id = req.headers.get('X_TENANT_ID', req.headers.get('X_TENANT'))
+
+ # Suck out the roles
+ roles = [r.strip() for r in req.headers.get('X_ROLE', '').split(',')]
+
+ # Create a context with the authentication data
+ ctx = context.Context(user_id, tenant_id, roles=roles)
+
+ # Inject the context...
+ req.environ['neutron.context'] = ctx
+
+ return self.application
+
+
+def pipeline_factory(loader, global_conf, **local_conf):
+ """Create a paste pipeline based on the 'auth_strategy' config option."""
+ pipeline = local_conf[cfg.CONF.auth_strategy]
+ pipeline = pipeline.split()
+ filters = [loader.get_filter(n) for n in pipeline[:-1]]
+ app = loader.get_app(pipeline[-1])
+ filters.reverse()
+ for filter in filters:
+ app = filter(app)
+ return app
# under the License.
"""
-Routines for configuring Quantum
+Routines for configuring Neutron
"""
import os
from oslo.config import cfg
from paste import deploy
-from quantum.api.v2 import attributes
-from quantum.common import utils
-from quantum.openstack.common.db.sqlalchemy import session as db_session
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.version import version_info as quantum_version
+from neutron.api.v2 import attributes
+from neutron.common import legacy
+from neutron.common import utils
+from neutron.openstack.common.db.sqlalchemy import session as db_session
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.version import version_info as neutron_version
LOG = logging.getLogger(__name__)
cfg.StrOpt('auth_strategy', default='keystone',
help=_("The type of authentication to use")),
cfg.StrOpt('core_plugin',
- help=_("The core plugin Quantum will use")),
+ help=_("The core plugin Neutron will use")),
cfg.ListOpt('service_plugins', default=[],
- help=_("The service plugins Quantum will use")),
+ help=_("The service plugins Neutron will use")),
cfg.StrOpt('base_mac', default="fa:16:3e:00:00:00",
- help=_("The base MAC address Quantum will use for VIFs")),
+ help=_("The base MAC address Neutron will use for VIFs")),
cfg.IntOpt('mac_generation_retries', default=16,
- help=_("How many times Quantum will retry MAC generation")),
+ help=_("How many times Neutron will retry MAC generation")),
cfg.BoolOpt('allow_bulk', default=True,
help=_("Allow the usage of the bulk API")),
cfg.BoolOpt('allow_pagination', default=False,
help=_("Allow sending resource operation"
" notification to DHCP agent")),
cfg.BoolOpt('allow_overlapping_ips', default=False,
- help=_("Allow overlapping IP support in Quantum")),
+ help=_("Allow overlapping IP support in Neutron")),
cfg.StrOpt('host', default=utils.get_hostname(),
- help=_("The hostname Quantum is running on")),
+ help=_("The hostname Neutron is running on")),
cfg.BoolOpt('force_gateway_on_subnet', default=False,
help=_("Ensure that configured gateway is on subnet")),
]
core_cli_opts = [
- cfg.StrOpt('state_path', default='/var/lib/quantum'),
+ cfg.StrOpt('state_path', default='/var/lib/neutron'),
]
# Register the configuration options
cfg.CONF.register_cli_opts(core_cli_opts)
# Ensure that the control exchange is set correctly
-rpc.set_defaults(control_exchange='quantum')
+rpc.set_defaults(control_exchange='neutron')
_SQL_CONNECTION_DEFAULT = 'sqlite://'
# Update the default QueuePool parameters. These can be tweaked by the
# configuration variables - max_pool_size, max_overflow and pool_timeout
def parse(args):
- cfg.CONF(args=args, project='quantum',
- version='%%prog %s' % quantum_version.release_string())
+ cfg.CONF(args=args, project='neutron',
+ version='%%prog %s' % neutron_version.release_string())
+
+ legacy.modernize_quantum_config(cfg.CONF)
# Validate that the base_mac is of the correct format
msg = attributes._validate_regex(cfg.CONF.base_mac,
:param conf: a cfg.ConfOpts object
"""
- product_name = "quantum"
+ product_name = "neutron"
logging.setup(product_name)
LOG.info(_("Logging enabled!"))
# under the License.
"""
-Quantum base exception handling.
+Neutron base exception handling.
"""
-from quantum.openstack.common.exception import Error
-from quantum.openstack.common.exception import InvalidContentType # noqa
-from quantum.openstack.common.exception import OpenstackException
+from neutron.openstack.common.exception import Error
+from neutron.openstack.common.exception import InvalidContentType # noqa
+from neutron.openstack.common.exception import OpenstackException
-class QuantumException(OpenstackException):
- """Base Quantum Exception.
+class NeutronException(OpenstackException):
+ """Base Neutron Exception.
To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd
message = _("An unknown exception occurred.")
-class BadRequest(QuantumException):
+class BadRequest(NeutronException):
message = _('Bad %(resource)s request: %(msg)s')
-class NotFound(QuantumException):
+class NotFound(NeutronException):
pass
-class Conflict(QuantumException):
+class Conflict(NeutronException):
pass
-class NotAuthorized(QuantumException):
+class NotAuthorized(NeutronException):
message = _("Not authorized.")
-class ServiceUnavailable(QuantumException):
+class ServiceUnavailable(NeutronException):
message = _("The service is unailable")
message = _("Requested rule:%(rule)s cannot be found")
-class PolicyInitError(QuantumException):
+class PolicyInitError(NeutronException):
message = _("Failed to init policy %(policy)s because %(reason)s")
-class PolicyCheckError(QuantumException):
+class PolicyCheckError(NeutronException):
message = _("Failed to check policy %(policy)s because %(reason)s")
message = _("Unsupported port state: %(port_state)s")
-class InUse(QuantumException):
+class InUse(NeutronException):
message = _("The resource is inuse")
message = _("No more IP addresses available on network %(net_id)s.")
-class BridgeDoesNotExist(QuantumException):
+class BridgeDoesNotExist(NeutronException):
message = _("Bridge %(bridge)s does not exist.")
-class PreexistingDeviceFailure(QuantumException):
+class PreexistingDeviceFailure(NeutronException):
message = _("Creation failed. %(dev_name)s already exists.")
-class SudoRequired(QuantumException):
+class SudoRequired(NeutronException):
message = _("Sudo priviledge is required to run this command.")
"network %(net_id)s.")
-class TooManyExternalNetworks(QuantumException):
+class TooManyExternalNetworks(NeutronException):
message = _("More than one external network exists")
-class InvalidConfigurationOption(QuantumException):
+class InvalidConfigurationOption(NeutronException):
message = _("An invalid value was provided for %(opt_name)s: "
"%(opt_value)s")
"allocation pool %(pool)s")
-class NetworkVlanRangeError(QuantumException):
+class NetworkVlanRangeError(NeutronException):
message = _("Invalid network VLAN range: '%(vlan_range)s' - '%(error)s'")
def __init__(self, **kwargs):
--- /dev/null
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Copyright 2013 New Dream Network, LLC (DreamHost)
+# 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.
+
+# @author Mark McClain (DreamHost)
+
+from neutron.openstack.common import log as logging
+
+LOG = logging.getLogger(__name__)
+
+
+def scrub_class_path(cls_path):
+ """Scrub from Quantum from old class_path references."""
+
+ if isinstance(cls_path, basestring):
+ if cls_path.startswith('quantum'):
+ new_path = cls_path.replace('quantum', 'neutron')
+ new_path = new_path.replace('Quantum', 'Neutron')
+ LOG.warn(
+ _("Old class module path in use. Please change '%(old)s' "
+ "to '%(new)s'."),
+ {'old': cls_path, 'new': new_path}
+ )
+ cls_path = new_path
+ return cls_path
+
+
+def override_config(config, config_keys=None):
+ """Attempt to override config_key with Neutron compatible values."""
+
+ for key in config_keys:
+ group = None
+ if not isinstance(key, basestring):
+ try:
+ group, key = key
+ old_value = getattr(getattr(config, group), key, None)
+ except AttributeError:
+ LOG.error(_('Skipping unknown group key: %s'), key)
+ continue
+ else:
+ old_value = getattr(config, key, None)
+ if not old_value:
+ continue
+ elif isinstance(old_value, list):
+ new_value = [scrub_class_path(v) for v in old_value]
+ else:
+ new_value = scrub_class_path(old_value)
+
+ if new_value != old_value:
+ config.set_override(key, new_value, group=group)
+
+
+def modernize_quantum_config(config):
+ """Updates keys from old Quantum configurations for Neutron."""
+ config_keys = [
+ 'core_plugin',
+ 'device_driver',
+ 'dhcp_driver',
+ 'driver_fqn',
+ 'interface_driver',
+ 'network_scheduler_driver',
+ 'router_scheduler_driver',
+ 'rpc_backend',
+ 'service_plugins',
+ ('QUOTAS', 'quota_driver'),
+ ('SECURITYGROUP', 'firewall_driver'),
+ ]
+
+ override_config(config, config_keys)
# License for the specific language governing permissions and limitations
# under the License.
-from quantum import context
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import dispatcher
+from neutron import context
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import dispatcher
LOG = logging.getLogger(__name__)
class PluginRpcDispatcher(dispatcher.RpcDispatcher):
"""This class is used to convert RPC common context into
- Quantum Context.
+ Neutron Context.
"""
def __init__(self, callbacks):
tenant_id = rpc_ctxt_dict.pop('tenant_id', None)
if not tenant_id:
tenant_id = rpc_ctxt_dict.pop('project_id', None)
- quantum_ctxt = context.Context(user_id, tenant_id, **rpc_ctxt_dict)
+ neutron_ctxt = context.Context(user_id, tenant_id, **rpc_ctxt_dict)
return super(PluginRpcDispatcher, self).dispatch(
- quantum_ctxt, version, method, namespace, **kwargs)
+ neutron_ctxt, version, method, namespace, **kwargs)
from nose import core
from nose import result
-from quantum.common import constants
+from neutron.common import constants
class _AnsiColorizer(object):
self.stream.write(text)
-class QuantumTestResult(result.TextTestResult):
+class NeutronTestResult(result.TextTestResult):
def __init__(self, *args, **kw):
result.TextTestResult.__init__(self, *args, **kw)
self._last_case = None
self.stream.flush()
-class QuantumTestRunner(core.TextTestRunner):
+class NeutronTestRunner(core.TextTestRunner):
def _makeResult(self):
- return QuantumTestResult(self.stream,
+ return NeutronTestResult(self.stream,
self.descriptions,
self.verbosity,
self.config)
if not c:
return True
- runner = QuantumTestRunner(stream=c.stream,
+ runner = NeutronTestRunner(stream=c.stream,
verbosity=c.verbosity,
config=c)
return not core.run(config=c, testRunner=runner)
# describes parameters used by different unit/functional tests
# a plugin-specific testing mechanism should import this dictionary
# and override the values in it if needed (e.g., run_tests.py in
-# quantum/plugins/openvswitch/ )
+# neutron/plugins/openvswitch/ )
test_config = {
"plugin_name": "",
"default_net_op_status": constants.NET_STATUS_ACTIVE,
from eventlet.green import subprocess
from oslo.config import cfg
-from quantum.common import constants as q_const
-from quantum.openstack.common import lockutils
-from quantum.openstack.common import log as logging
+from neutron.common import constants as q_const
+from neutron.openstack.common import lockutils
+from neutron.openstack.common import log as logging
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
LOG = logging.getLogger(__name__)
-synchronized = lockutils.synchronized_with_prefix('quantum-')
+synchronized = lockutils.synchronized_with_prefix('neutron-')
def read_cached_file(filename, cache_info, reload_func=None):
root = os.path.join(dir_to_common, '..', '..', '..', '..')
# Handle standard directory search for the config file
config_file_dirs = [fix_path(os.path.join(os.getcwd(), 'etc')),
- fix_path(os.path.join('~', '.quantum-venv', 'etc',
- 'quantum')),
+ fix_path(os.path.join('~', '.neutron-venv', 'etc',
+ 'neutron')),
fix_path('~'),
os.path.join(cfg.CONF.state_path, 'etc'),
- os.path.join(cfg.CONF.state_path, 'etc', 'quantum'),
+ os.path.join(cfg.CONF.state_path, 'etc', 'neutron'),
fix_path(os.path.join('~', '.local',
- 'etc', 'quantum')),
+ 'etc', 'neutron')),
+ '/usr/etc/neutron',
+ '/usr/local/etc/neutron',
+ '/etc/neutron/',
+ # TODO(markmcclain) remove in Icehouse
'/usr/etc/quantum',
'/usr/local/etc/quantum',
'/etc/quantum/',
if 'plugin' in options:
config_file_dirs = [
- os.path.join(x, 'quantum', 'plugins', options['plugin'])
+ os.path.join(x, 'neutron', 'plugins', options['plugin'])
for x in config_file_dirs
]
from datetime import datetime
-from quantum.db import api as db_api
-from quantum.openstack.common import context as common_context
-from quantum.openstack.common import log as logging
-from quantum import policy
+from neutron.db import api as db_api
+from neutron.openstack.common import context as common_context
+from neutron.openstack.common import log as logging
+from neutron import policy
LOG = logging.getLogger(__name__)
import sqlalchemy as sa
from sqlalchemy.orm import exc
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.extensions import agent as ext_agent
-from quantum import manager
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import timeutils
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.extensions import agent as ext_agent
+from neutron import manager
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import timeutils
LOG = logging.getLogger(__name__)
cfg.CONF.register_opt(
class Agent(model_base.BASEV2, models_v2.HasId):
- """Represents agents running in quantum deployments."""
+ """Represents agents running in neutron deployments."""
# L3 agent, DHCP agent, OVS agent, LinuxBridge
agent_type = sa.Column(sa.String(255), nullable=False)
LOG.debug(_("Message with invalid timestamp received"))
return
agent_state = kwargs['agent_state']['agent_state']
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
plugin.create_or_update_agent(context, agent_state)
from sqlalchemy.orm import exc
from sqlalchemy.orm import joinedload
-from quantum.common import constants
-from quantum.db import agents_db
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.extensions import agentscheduler
-from quantum.openstack.common import log as logging
+from neutron.common import constants
+from neutron.db import agents_db
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.extensions import agentscheduler
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class NetworkDhcpAgentBinding(model_base.BASEV2):
- """Represents binding between quantum networks and DHCP agents."""
+ """Represents binding between neutron networks and DHCP agents."""
network_id = sa.Column(sa.String(36),
sa.ForeignKey("networks.id", ondelete='CASCADE'),
class RouterL3AgentBinding(model_base.BASEV2, models_v2.HasId):
- """Represents binding between quantum routers and L3 agents."""
+ """Represents binding between neutron routers and L3 agents."""
router_id = sa.Column(sa.String(36),
sa.ForeignKey("routers.id", ondelete='CASCADE'))
import sqlalchemy as sql
-from quantum.db import model_base
-from quantum.openstack.common.db.sqlalchemy import session
-from quantum.openstack.common import log as logging
+from neutron.db import model_base
+from neutron.openstack.common.db.sqlalchemy import session
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from sqlalchemy import orm
from sqlalchemy.orm import exc
-from quantum.api.v2 import attributes
-from quantum.common import constants
-from quantum.common import exceptions as q_exc
-from quantum.db import api as db
-from quantum.db import models_v2
-from quantum.db import sqlalchemyutils
-from quantum.openstack.common import excutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import timeutils
-from quantum.openstack.common import uuidutils
-from quantum import quantum_plugin_base_v2
+from neutron.api.v2 import attributes
+from neutron.common import constants
+from neutron.common import exceptions as q_exc
+from neutron.db import api as db
+from neutron.db import models_v2
+from neutron.db import sqlalchemyutils
+from neutron import neutron_plugin_base_v2
+from neutron.openstack.common import excutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import timeutils
+from neutron.openstack.common import uuidutils
LOG = logging.getLogger(__name__)
return self._get_collection_query(context, model, filters).count()
-class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2,
+class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
CommonDbMixin):
- """V2 Quantum plugin interface implementation using SQLAlchemy models.
+ """V2 Neutron plugin interface implementation using SQLAlchemy models.
Whenever a non-read call happens the plugin will call an event handler
class method (e.g., network_created()). The result is that this class
if base_mac[3] != '00':
mac[3] = int(base_mac[3], 16)
mac_address = ':'.join(map(lambda x: "%02x" % x, mac))
- if QuantumDbPluginV2._check_unique_mac(context, network_id,
+ if NeutronDbPluginV2._check_unique_mac(context, network_id,
mac_address):
LOG.debug(_("Generated mac for network %(network_id)s "
"is %(mac_address)s"),
return
if allocated.expiration < timeutils.utcnow():
# immediately delete expired allocations
- QuantumDbPluginV2._recycle_ip(
+ NeutronDbPluginV2._recycle_ip(
context, network_id, subnet_id, ip_address)
else:
LOG.debug(_("Hold allocated IP %(ip_address)s "
models_v2.IPAllocation.expiration <= timeutils.utcnow())
for expired in expired_qry:
- QuantumDbPluginV2._recycle_ip(context,
+ NeutronDbPluginV2._recycle_ip(context,
network_id,
expired['subnet_id'],
expired['ip_address'])
context.session.add(ip_range)
LOG.debug(_("Recycle: created new %(first_ip)s-%(last_ip)s"),
{'first_ip': ip_address, 'last_ip': ip_address})
- QuantumDbPluginV2._delete_ip_allocation(context, network_id, subnet_id,
+ NeutronDbPluginV2._delete_ip_allocation(context, network_id, subnet_id,
ip_address)
@staticmethod
filter = {'network_id': [network_id]}
subnets = self.get_subnets(context, filters=filter)
for subnet in subnets:
- if QuantumDbPluginV2._check_subnet_ip(subnet['cidr'],
+ if NeutronDbPluginV2._check_subnet_ip(subnet['cidr'],
fixed['ip_address']):
found = True
subnet_id = subnet['id']
if 'ip_address' in fixed:
# Ensure that the IP's are unique
- if not QuantumDbPluginV2._check_unique_ip(context, network_id,
+ if not NeutronDbPluginV2._check_unique_ip(context, network_id,
subnet_id,
fixed['ip_address']):
raise q_exc.IpAddressInUse(net_id=network_id,
# Ensure that the IP is valid on the subnet
if (not found and
- not QuantumDbPluginV2._check_subnet_ip(
+ not NeutronDbPluginV2._check_subnet_ip(
subnet['cidr'], fixed['ip_address'])):
msg = _('IP address %s is not a valid IP for the defined '
'subnet') % fixed['ip_address']
for fixed in fixed_ips:
if 'ip_address' in fixed:
# Remove the IP address from the allocation pool
- QuantumDbPluginV2._allocate_specific_ip(
+ NeutronDbPluginV2._allocate_specific_ip(
context, fixed['subnet_id'], fixed['ip_address'])
ips.append({'ip_address': fixed['ip_address'],
'subnet_id': fixed['subnet_id']})
to_add = self._test_fixed_ips_for_port(context, network_id, new_ips)
for ip in original_ips:
LOG.debug(_("Port update. Hold %s"), ip)
- QuantumDbPluginV2._hold_ip(context,
+ NeutronDbPluginV2._hold_ip(context,
network_id,
ip['subnet_id'],
port_id,
version_subnets = [v4, v6]
for subnets in version_subnets:
if subnets:
- result = QuantumDbPluginV2._generate_ip(context, subnets)
+ result = NeutronDbPluginV2._generate_ip(context, subnets)
ips.append({'ip_address': result['ip_address'],
'subnet_id': result['subnet_id']})
return ips
if attributes.is_attr_set(s.get('gateway_ip')):
self._validate_ip_version(ip_ver, s['gateway_ip'], 'gateway_ip')
if (cfg.CONF.force_gateway_on_subnet and
- not QuantumDbPluginV2._check_subnet_ip(s['cidr'],
+ not NeutronDbPluginV2._check_subnet_ip(s['cidr'],
s['gateway_ip'])):
error_message = _("Gateway is not valid on subnet")
raise q_exc.InvalidInput(error_message=error_message)
# Ensure that a MAC address is defined and it is unique on the
# network
if mac_address is attributes.ATTR_NOT_SPECIFIED:
- mac_address = QuantumDbPluginV2._generate_mac(context,
+ mac_address = NeutronDbPluginV2._generate_mac(context,
network_id)
else:
# Ensure that the mac on the network is unique
- if not QuantumDbPluginV2._check_unique_mac(context,
+ if not NeutronDbPluginV2._check_unique_mac(context,
network_id,
mac_address):
raise q_exc.MacAddressInUse(net_id=network_id,
for a in allocated:
subnet = self._get_subnet(context, a['subnet_id'])
# Check if IP was allocated from allocation pool
- if QuantumDbPluginV2._check_ip_in_allocation_pool(
+ if NeutronDbPluginV2._check_ip_in_allocation_pool(
context, a['subnet_id'], subnet['gateway_ip'],
a['ip_address']):
- QuantumDbPluginV2._hold_ip(context,
+ NeutronDbPluginV2._hold_ip(context,
a['network_id'],
a['subnet_id'],
id,
else:
# IPs out of allocation pool will not be recycled, but
# we do need to delete the allocation from the DB
- QuantumDbPluginV2._delete_ip_allocation(
+ NeutronDbPluginV2._delete_ip_allocation(
context, a['network_id'],
a['subnet_id'], a['ip_address'])
msg_dict = {'address': a['ip_address'],
from oslo.config import cfg
from sqlalchemy.orm import exc
-from quantum.api.v2 import attributes
-from quantum.common import constants
-from quantum.common import utils
-from quantum import manager
-from quantum.openstack.common import log as logging
+from neutron.api.v2 import attributes
+from neutron.common import constants
+from neutron.common import utils
+from neutron import manager
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
"""Retrieve and return a list of the active network ids."""
host = kwargs.get('host')
LOG.debug(_('Network list requested from %s'), host)
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
if utils.is_extension_supported(
plugin, constants.AGENT_SCHEDULER_EXT_ALIAS):
if cfg.CONF.network_auto_schedule:
LOG.debug(_('Network %(network_id)s requested from '
'%(host)s'), {'network_id': network_id,
'host': host})
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
network = plugin.get_network(context, network_id)
filters = dict(network_id=[network_id])
'%(host)s'), {'device_id': device_id,
'network_id': network_id,
'host': host})
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
retval = None
filters = dict(network_id=[network_id])
LOG.debug(_('DHCP port deletion for %(network_id)s request from '
'%(host)s'),
{'network_id': network_id, 'host': host})
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
filters = dict(network_id=[network_id], device_id=[device_id])
ports = plugin.get_ports(context, filters=filters)
LOG.debug(_('DHCP port remove fixed_ip for %(subnet_id)s request '
'from %(host)s'),
{'subnet_id': subnet_id, 'host': host})
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
filters = dict(network_id=[network_id], device_id=[device_id])
ports = plugin.get_ports(context, filters=filters)
{'ip_address': ip_address,
'network_id': network_id,
'host': host})
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
plugin.update_fixed_ip_lease_expiration(context, network_id,
ip_address, lease_remaining)
import sqlalchemy as sa
from sqlalchemy import orm
-from quantum.common import utils
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_db
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.extensions import extraroute
-from quantum.extensions import l3
-from quantum.openstack.common import log as logging
+from neutron.common import utils
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_db
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.extensions import extraroute
+from neutron.extensions import l3
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
router_db['route_list']
))
- db_base_plugin_v2.QuantumDbPluginV2.register_dict_extend_funcs(
+ db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
l3.ROUTERS, [_extend_router_dict_extraroute])
def update_router(self, context, id, router):
from sqlalchemy.orm import exc
from sqlalchemy.sql import expression as expr
-from quantum.api.rpc.agentnotifiers import l3_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.common import constants as l3_constants
-from quantum.common import exceptions as q_exc
-from quantum.db import db_base_plugin_v2
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.extensions import l3
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.notifier import api as notifier_api
-from quantum.openstack.common import uuidutils
+from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.common import constants as l3_constants
+from neutron.common import exceptions as q_exc
+from neutron.db import db_base_plugin_v2
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.extensions import l3
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.notifier import api as notifier_api
+from neutron.openstack.common import uuidutils
LOG = logging.getLogger(__name__)
class Router(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
- """Represents a v2 quantum router."""
+ """Represents a v2 neutron router."""
name = sa.Column(sa.String(255))
status = sa.Column(sa.String(16))
# TODO(salvatore-orlando): Perform this operation without explicitly
# referring to db_base_plugin_v2, as plugins that do not extend from it
# might exist in the future
- db_base_plugin_v2.QuantumDbPluginV2.register_model_query_hook(
+ db_base_plugin_v2.NeutronDbPluginV2.register_model_query_hook(
models_v2.Network,
"external_net",
_network_model_hook,
return network_res
# Register dict extend functions for networks
- db_base_plugin_v2.QuantumDbPluginV2.register_dict_extend_funcs(
+ db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
attributes.NETWORKS, [_extend_network_dict_l3])
def _process_l3_create(self, context, net_data, req_data):
import sqlalchemy as sa
-from quantum.db import l3_db
-from quantum.extensions import l3
-from quantum.openstack.common import log as logging
+from neutron.db import l3_db
+from neutron.extensions import l3
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.common import constants
-from quantum.common import utils
-from quantum import context as quantum_context
-from quantum import manager
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
+from neutron.common import constants
+from neutron.common import utils
+from neutron import context as neutron_context
+from neutron import manager
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
"""
router_id = kwargs.get('router_id')
host = kwargs.get('host')
- context = quantum_context.get_admin_context()
- plugin = manager.QuantumManager.get_plugin()
+ context = neutron_context.get_admin_context()
+ plugin = manager.NeutronManager.get_plugin()
if utils.is_extension_supported(
plugin, constants.AGENT_SCHEDULER_EXT_ALIAS):
if cfg.CONF.router_auto_schedule:
l3 agent expects only on external network when it performs
this query.
"""
- context = quantum_context.get_admin_context()
- plugin = manager.QuantumManager.get_plugin()
+ context = neutron_context.get_admin_context()
+ plugin = manager.NeutronManager.get_plugin()
net_id = plugin.get_external_network_id(context)
LOG.debug(_("External network ID returned to l3 agent: %s"),
net_id)
from sqlalchemy.orm import exc
from sqlalchemy.orm import validates
-from quantum.api.v2 import attributes
-from quantum.common import exceptions as q_exc
-from quantum.db import db_base_plugin_v2 as base_db
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.extensions import loadbalancer
-from quantum.extensions.loadbalancer import LoadBalancerPluginBase
-from quantum import manager
-from quantum.openstack.common.db import exception
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import uuidutils
-from quantum.plugins.common import constants
+from neutron.api.v2 import attributes
+from neutron.common import exceptions as q_exc
+from neutron.db import db_base_plugin_v2 as base_db
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.extensions import loadbalancer
+from neutron.extensions.loadbalancer import LoadBalancerPluginBase
+from neutron import manager
+from neutron.openstack.common.db import exception
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import uuidutils
+from neutron.plugins.common import constants
LOG = logging.getLogger(__name__)
class Vip(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
- """Represents a v2 quantum loadbalancer vip."""
+ """Represents a v2 neutron loadbalancer vip."""
name = sa.Column(sa.String(255))
description = sa.Column(sa.String(255))
class Member(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
- """Represents a v2 quantum loadbalancer member."""
+ """Represents a v2 neutron loadbalancer member."""
pool_id = sa.Column(sa.String(36), sa.ForeignKey("pools.id"),
nullable=False)
class Pool(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
- """Represents a v2 quantum loadbalancer pool."""
+ """Represents a v2 neutron loadbalancer pool."""
vip_id = sa.Column(sa.String(36), sa.ForeignKey("vips.id"))
name = sa.Column(sa.String(255))
class HealthMonitor(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
- """Represents a v2 quantum loadbalancer healthmonitor."""
+ """Represents a v2 neutron loadbalancer healthmonitor."""
type = sa.Column(sa.Enum("PING", "TCP", "HTTP", "HTTPS",
name="healthmontiors_type"),
base_db.CommonDbMixin):
"""Wraps loadbalancer with SQLAlchemy models.
- A class that wraps the implementation of the Quantum loadbalancer
+ A class that wraps the implementation of the Neutron loadbalancer
plugin database access interface using SQLAlchemy models.
"""
@property
def _core_plugin(self):
- return manager.QuantumManager.get_plugin()
+ return manager.NeutronManager.get_plugin()
def update_status(self, context, model, id, status):
with context.session.begin(subtransactions=True):
pool.update({"vip_id": None})
context.session.delete(vip)
- if vip.port: # this is a Quantum port
+ if vip.port: # this is a Neutron port
self._core_plugin.delete_port(context, vip.port.id)
def get_vip(self, context, id, fields=None):
# @author Mark McClain (DreamHost)
The migrations in the alembic/versions contain the changes needed to migrate
-from older Quantum releases to newer versions. A migration occurs by executing
+from older Neutron releases to newer versions. A migration occurs by executing
a script that details the changes needed to upgrade/downgrade the database. The
migration scripts are ordered so that multiple scripts can run sequentially to
-update the database. The scripts are executed by Quantum's migration wrapper
-which uses the Alembic library to manage the migration. Quantum supports
+update the database. The scripts are executed by Neutron's migration wrapper
+which uses the Alembic library to manage the migration. Neutron supports
migration from Folsom or later.
If you are a deployer or developer and want to migrate from Folsom to Grizzly
or later you must first add version tracking to the database:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini stamp folsom
You can then upgrade to the latest database version via:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini upgrade head
To check the current database version:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini current
To create a script to run the migration offline:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini upgrade head --sql
To run the offline migration between specific migration versions:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini upgrade \
<start version>:<end version> --sql
Upgrade the database incrementally:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini upgrade --delta <# of revs>
Downgrade the database by a certain number of revisions:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini downgrade --delta <# of revs>
DEVELOPERS:
-A database migration script is required when you submit a change to Quantum
+A database migration script is required when you submit a change to Neutron
that alters the database model definition. The migration script is a special
python file that includes code to update/downgrade the database to match the
changes in the model definition. Alembic will execute these scripts in order to
-provide a linear migration path between revision. The quantum-db-manage command
+provide a linear migration path between revision. The neutron-db-manage command
can be used to generate migration template for you to complete. The operations
in the template are those supported by the Alembic migration library.
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini revision \
-m "description of revision" \
--autogenerate
and manually author the changes necessary for an upgrade/downgrade. You can
create a blank file via:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini revision \
-m "description of revision"
The migration timeline should remain linear so that there is a clear path when
upgrading/downgrading. To verify that the timeline does branch, you can run
this command:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini check_migration
If the migration path does branch, you can find the branch point via:
-$ quantum-db-manage --config-file /path/to/quantum.conf \
+$ neutron-db-manage --config-file /path/to/neutron.conf \
--config-file /path/to/plugin/config.ini history
# the 'revision' command, regardless of autogenerate
# revision_environment = false
-# default to an empty string because the Quantum migration cli will
+# default to an empty string because the Neutron migration cli will
# extract the correct value and set it programatically before alemic is fully
# invoked.
sqlalchemy.url =
from alembic import context
from sqlalchemy import create_engine, pool
-from quantum.db import model_base
-from quantum.openstack.common import importutils
+from neutron.db import model_base
+from neutron.openstack.common import importutils
-DATABASE_QUOTA_DRIVER = 'quantum.extensions._quotav2_driver.DbQuotaDriver'
+DATABASE_QUOTA_DRIVER = 'neutron.extensions._quotav2_driver.DbQuotaDriver'
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
-quantum_config = config.quantum_config
+neutron_config = config.neutron_config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
-plugin_klass = importutils.import_class(quantum_config.core_plugin)
+plugin_class_path = neutron_config.core_plugin
+
+plugin_klass = importutils.import_class(plugin_class_path)
# set the target for 'autogenerate' support
target_metadata = model_base.BASEV2.metadata
script output.
"""
- context.configure(url=quantum_config.database.connection)
+ context.configure(url=neutron_config.database.connection)
with context.begin_transaction():
- context.run_migrations(active_plugin=quantum_config.core_plugin,
+ context.run_migrations(active_plugin=plugin_class_path,
options=build_options())
"""
engine = create_engine(
- quantum_config.database.connection,
+ neutron_config.database.connection,
poolclass=pool.NullPool)
connection = engine.connect()
try:
with context.begin_transaction():
- context.run_migrations(active_plugin=quantum_config.core_plugin,
+ context.run_migrations(active_plugin=plugin_class_path,
options=build_options())
finally:
connection.close()
def is_db_quota_enabled():
- return quantum_config.QUOTAS.quota_driver == DATABASE_QUOTA_DRIVER
+ return neutron_config.QUOTAS.quota_driver == DATABASE_QUOTA_DRIVER
if context.is_offline_mode():
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- '${config.quantum_config.core_plugin}'
+ '${config.neutron_config.core_plugin}'
]
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2'
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.hyperv.hyperv_quantum_plugin.HyperVQuantumPlugin',
- 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2',
- 'quantum.plugins.metaplugin.meta_quantum_plugin.MetaPluginV2',
- 'quantum.plugins.nec.nec_plugin.NECPluginV2',
- 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2',
- 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2'
+ 'neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin',
+ 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
+ 'neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2',
+ 'neutron.plugins.nec.nec_plugin.NECPluginV2',
+ 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
+ 'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2'
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2',
- 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2',
+ 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
+ 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nec.nec_plugin.NECPluginV2'
+ 'neutron.plugins.nec.nec_plugin.NECPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2',
- 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2',
- 'quantum.plugins.nec.nec_plugin.NECPluginV2',
- 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2',
- 'quantum.plugins.metaplugin.meta_quantum_plugin.MetaPluginV2'
+ 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
+ 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
+ 'neutron.plugins.nec.nec_plugin.NECPluginV2',
+ 'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2',
+ 'neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2'
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.cisco.network_plugin.PluginV2'
+ 'neutron.plugins.cisco.network_plugin.PluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.bigswitch.plugin.QuantumRestProxyV2',
- 'quantum.plugins.hyperv.hyperv_quantum_plugin.HyperVQuantumPlugin',
- 'quantum.plugins.midonet.plugin.MidonetPluginV2',
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2'
+ 'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2',
+ 'neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin',
+ 'neutron.plugins.midonet.plugin.MidonetPluginV2',
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
]
-from quantum.db import migration
-from quantum.db.migration.alembic_migrations import common_ext_ops
+from neutron.db import migration
+from neutron.db.migration.alembic_migrations import common_ext_ops
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2'
+ 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nicira.QuantumPluginV2.NvpPluginV2'
+ 'neutron.plugins.nicira.NeutronPluginV2.NvpPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2'
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
return
op.create_table(
- 'quantum_nvp_port_mapping',
- sa.Column('quantum_id', sa.String(length=36), nullable=False),
+ 'neutron_nvp_port_mapping',
+ sa.Column('neutron_id', sa.String(length=36), nullable=False),
sa.Column('nvp_id', sa.String(length=36), nullable=True),
- sa.ForeignKeyConstraint(['quantum_id'], ['ports.id'],
+ sa.ForeignKeyConstraint(['neutron_id'], ['ports.id'],
ondelete='CASCADE'),
- sa.PrimaryKeyConstraint('quantum_id'))
+ sa.PrimaryKeyConstraint('neutron_id'))
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
- op.drop_table('quantum_nvp_port_mapping')
+ op.drop_table('neutron_nvp_port_mapping')
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nec.nec_plugin.NECPluginV2'
+ 'neutron.plugins.nec.nec_plugin.NECPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.bigswitch.plugin.QuantumRestProxyV2'
+ 'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2',
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2',
- 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2',
- 'quantum.plugins.nec.nec_plugin.NECPluginV2',
- 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2',
+ 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
+ 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
+ 'neutron.plugins.nec.nec_plugin.NECPluginV2',
+ 'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2',
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2'
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2'
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2',
- 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2',
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2',
- 'quantum.plugins.nec.nec_plugin.NECPluginV2',
- 'quantum.plugins.brocade.QuantumPlugin.BrocadePluginV2',
+ 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
+ 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
+ 'neutron.plugins.nec.nec_plugin.NECPluginV2',
+ 'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2'
+ 'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2',
- 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2',
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2',
- 'quantum.plugins.nec.nec_plugin.NECPluginV2',
- 'quantum.plugins.brocade.QuantumPlugin.BrocadePluginV2',
+ 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
+ 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
+ 'neutron.plugins.nec.nec_plugin.NECPluginV2',
+ 'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.bigswitch.plugin.QuantumRestProxyV2'
+ 'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2'
+ 'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
- 'quantum.plugins.ml2.plugin.Ml2Plugin'
+ 'neutron.plugins.ml2.plugin.Ml2Plugin'
]
from alembic import op
import sqlalchemy as sa
-from quantum.db import migration
+from neutron.db import migration
def upgrade(active_plugin=None, options=None):
--- /dev/null
+This directory contains the migration scripts for the Neutron project. Please
+see the README in neutron/db/migration on how to use and generate new
+migrations.
+
+
"""
PLUGINS = {
- 'bigswitch': 'quantum.plugins.bigswitch.plugin.QuantumRestProxyV2',
- 'cisco': 'quantum.plugins.cisco.network_plugin.PluginV2',
- 'lbr': 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2',
- 'meta': 'quantum.plugins.metaplugin.meta_quantum_plugin.MetaPluginV2',
- 'ml2': 'quantum.plugins.ml2.ml2_plugin.Ml2Plugin',
- 'nec': 'quantum.plugins.nec.nec_plugin.NECPluginV2',
- 'nvp': 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2',
- 'ovs': 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2',
- 'ryu': 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2',
+ 'bigswitch': 'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2',
+ 'cisco': 'neutron.plugins.cisco.network_plugin.PluginV2',
+ 'lbr': 'neutron.plugins.linuxbridge.lb_neutronplugin.LinuxBridgePluginV2',
+ 'meta': 'neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2',
+ 'ml2': 'neutron.plugins.ml2.ml2_plugin.Ml2Plugin',
+ 'nec': 'neutron.plugins.nec.nec_plugin.NECPluginV2',
+ 'nvp': 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
+ 'ovs': 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
+ 'ryu': 'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2',
}
L3_CAPABLE = [
from alembic import op
import sqlalchemy as sa
-from quantum.db.migration.alembic_migrations import common_ext_ops
+from neutron.db.migration.alembic_migrations import common_ext_ops
# NOTE: This is a special migration that creates a Folsom compatible database.
from alembic import util as alembic_util
from oslo.config import cfg
+from neutron.common import legacy
+
_core_opts = [
cfg.StrOpt('core_plugin',
default='',
- help=_('Quantum plugin provider module')),
+ help=_('Neutron plugin provider module')),
]
_quota_opts = [
cfg.StrOpt('quota_driver',
default='',
- help=_('Quantum quota driver class')),
+ help=_('Neutron quota driver class')),
]
_db_opts = [
os.path.join(os.path.dirname(__file__), 'alembic.ini')
)
config.set_main_option('script_location',
- 'quantum.db.migration:alembic_migrations')
- # attach the Quantum conf to the Alembic conf
- config.quantum_config = CONF
+ 'neutron.db.migration:alembic_migrations')
+ # attach the Neutron conf to the Alembic conf
+ config.neutron_config = CONF
CONF()
+ legacy.modernize_quantum_config(CONF)
CONF.command.func(config, CONF.command.name)
from sqlalchemy import orm
-class QuantumBase(object):
- """Base class for Quantum Models."""
+class NeutronBase(object):
+ """Base class for Neutron Models."""
__table_args__ = {'mysql_engine': 'InnoDB'}
id(self), ', '.join(items))
-class QuantumBaseV2(QuantumBase):
+class NeutronBaseV2(NeutronBase):
@declarative.declared_attr
def __tablename__(cls):
return cls.__name__.lower() + 's'
-BASEV2 = declarative.declarative_base(cls=QuantumBaseV2)
+BASEV2 = declarative.declarative_base(cls=NeutronBaseV2)
import sqlalchemy as sa
from sqlalchemy import orm
-from quantum.db import model_base
-from quantum.openstack.common import uuidutils
+from neutron.db import model_base
+from neutron.openstack.common import uuidutils
class HasTenant(object):
class IPAvailabilityRange(model_base.BASEV2):
- """Internal representation of available IPs for Quantum subnets.
+ """Internal representation of available IPs for Neutron subnets.
Allocation - first entry from the range will be allocated.
If the first entry is equal to the last entry then this row
class IPAllocationPool(model_base.BASEV2, HasId):
- """Representation of an allocation pool in a Quantum subnet."""
+ """Representation of an allocation pool in a Neutron subnet."""
subnet_id = sa.Column(sa.String(36), sa.ForeignKey('subnets.id',
ondelete="CASCADE"),
class IPAllocation(model_base.BASEV2):
- """Internal representation of allocated IP addresses in a Quantum subnet.
+ """Internal representation of allocated IP addresses in a Neutron subnet.
"""
port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id',
class Port(model_base.BASEV2, HasId, HasTenant):
- """Represents a port on a quantum v2 network."""
+ """Represents a port on a Neutron v2 network."""
name = sa.Column(sa.String(255))
network_id = sa.Column(sa.String(36), sa.ForeignKey("networks.id"),
class Subnet(model_base.BASEV2, HasId, HasTenant):
- """Represents a quantum subnet.
+ """Represents a neutron subnet.
When a subnet is created the first and last entries will be created. These
are used for the IP allocation.
class Network(model_base.BASEV2, HasId, HasTenant):
- """Represents a v2 quantum network."""
+ """Represents a v2 neutron network."""
name = sa.Column(sa.String(255))
ports = orm.relationship(Port, backref='networks')
import sqlalchemy as sa
from sqlalchemy import orm
-from quantum.api.v2 import attributes
-from quantum.db import db_base_plugin_v2
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.extensions import portbindings
-from quantum.openstack.common import log as logging
+from neutron.api.v2 import attributes
+from neutron.db import db_base_plugin_v2
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.extensions import portbindings
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
query = query.filter(PortBindingPort.host.in_(values))
return query
- db_base_plugin_v2.QuantumDbPluginV2.register_model_query_hook(
+ db_base_plugin_v2.NeutronDbPluginV2.register_model_query_hook(
models_v2.Port,
"portbindings_port",
_port_model_hook,
plugin, port_res, host)
# Register dict extend functions for ports
-db_base_plugin_v2.QuantumDbPluginV2.register_dict_extend_funcs(
+db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
attributes.PORTS, [_extend_port_dict_binding])
import sqlalchemy as sa
from sqlalchemy.orm import exc
-from quantum.db import model_base
-from quantum.extensions import portsecurity as psec
-from quantum.openstack.common import log as logging
+from neutron.db import model_base
+from neutron.extensions import portsecurity as psec
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
import sqlalchemy as sa
-from quantum.common import exceptions
-from quantum.db import model_base
-from quantum.db import models_v2
+from neutron.common import exceptions
+from neutron.db import model_base
+from neutron.db import models_v2
class Quota(model_base.BASEV2, models_v2.HasId):
import sqlalchemy as sa
from sqlalchemy import event
-from quantum.common import exceptions as qexception
-from quantum.db import model_base
-from quantum.extensions import routedserviceinsertion as rsi
+from neutron.common import exceptions as qexception
+from neutron.db import model_base
+from neutron.extensions import routedserviceinsertion as rsi
class ServiceRouterBinding(model_base.BASEV2):
nullable=False)
-class AttributeException(qexception.QuantumException):
+class AttributeException(qexception.NeutronException):
message = _("Resource type '%(resource_type)s' is longer "
"than %(maxlen)d characters")
import sqlalchemy as sa
-from quantum.db import model_base
-from quantum.extensions import routerservicetype as rst
+from neutron.db import model_base
+from neutron.extensions import routerservicetype as rst
class RouterServiceTypeBinding(model_base.BASEV2):
from sqlalchemy.orm import exc
from sqlalchemy.orm import scoped_session
-from quantum.api.v2 import attributes as attr
-from quantum.db import db_base_plugin_v2
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import uuidutils
+from neutron.api.v2 import attributes as attr
+from neutron.db import db_base_plugin_v2
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import uuidutils
class SecurityGroup(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
- """Represents a v2 quantum security group."""
+ """Represents a v2 neutron security group."""
name = sa.Column(sa.String(255))
description = sa.Column(sa.String(255))
class SecurityGroupPortBinding(model_base.BASEV2):
- """Represents binding between quantum ports and security profiles."""
+ """Represents binding between neutron ports and security profiles."""
port_id = sa.Column(sa.String(36),
sa.ForeignKey("ports.id",
class SecurityGroupRule(model_base.BASEV2, models_v2.HasId,
models_v2.HasTenant):
- """Represents a v2 quantum security group rule."""
+ """Represents a v2 neutron security group rule."""
security_group_id = sa.Column(sa.String(36),
sa.ForeignKey("securitygroups.id",
return port_res
# Register dict extend functions for ports
- db_base_plugin_v2.QuantumDbPluginV2.register_dict_extend_funcs(
+ db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
attr.PORTS, [_extend_port_dict_security_group])
def _process_port_create_security_group(self, context, port,
import netaddr
-from quantum.common import constants as q_const
-from quantum.common import utils
-from quantum.db import models_v2
-from quantum.db import securitygroups_db as sg_db
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import log as logging
+from neutron.common import constants as q_const
+from neutron.common import utils
+from neutron.db import models_v2
+from neutron.db import securitygroups_db as sg_db
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from sqlalchemy.orm import exc as orm_exc
from sqlalchemy.sql import expression as expr
-from quantum.common import exceptions as q_exc
-from quantum import context
-from quantum.db import api as db
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.openstack.common import log as logging
+from neutron.common import exceptions as q_exc
+from neutron import context
+from neutron.db import api as db
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
opt_value=svc_def_opt)
-class NoDefaultServiceDefinition(q_exc.QuantumException):
+class NoDefaultServiceDefinition(q_exc.NeutronException):
message = _("No default service definition in configuration file. "
"Please add service definitions using the service_definition "
"variable in the [default_servicetype] section")
class ServiceTypeManager(object):
- """Manage service type objects in Quantum database."""
+ """Manage service type objects in Neutron database."""
_instance = None
def_svc_type_db['id'],
def_service_type,
svc_type_db=def_svc_type_db)
- LOG.debug(_("Default service type record updated in Quantum database. "
+ LOG.debug(_("Default service type record updated in Neutron database. "
"identifier is '%s'"), def_svc_type_db['id'])
def _initialize_db(self):
import sqlalchemy
from sqlalchemy.orm.properties import RelationshipProperty
-from quantum.common import exceptions as q_exc
-from quantum.openstack.common import log as logging
+from neutron.common import exceptions as q_exc
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
-Debug Helper Script for Quantum
+Debug Helper Script for Neutron
- Configure
-export QUANTUM_TEST_CONFIG_FILE=/etc/quantum/debug.ini
+export NEUTRON_TEST_CONFIG_FILE=/etc/neutron/debug.ini
or
-export QUANTUM_TEST_CONFIG_FILE=/etc/quantum/l3_agent.ini
+export NEUTRON_TEST_CONFIG_FILE=/etc/neutron/l3_agent.ini
you can also specify config file by --config-file option
- Usage
-quantum-debug commands
+neutron-debug commands
probe-create <net-id>
Create probe port - create port and interface, then plug it in.
The port id is probe id.
We can have multiple probe probes in a network, in order to check connectivity between ports.
- quantum-debug probe-exec probe_id_1 'nc -l 192.168.100.3 22'
- quantum-debug probe-exec probe_id_2 'nc -vz 192.168.100.4 22'
+ neutron-debug probe-exec probe_id_1 'nc -l 192.168.100.3 22'
+ neutron-debug probe-exec probe_id_2 'nc -vz 192.168.100.4 22'
Note: You should use a user and a tenant who has permission to
modify network and subnet if you want to probe. For example, you need to be admin user if you
ping-all is all-in-one command to ping all fixed ip's in all network or a specified network.
In the command probe is automatically created if needed.
-quantum-debug extends the shell of quantumclient, so you can use all the commands of quantum
+neutron-debug extends the shell of neutronclient, so you can use all the commands of neutron
# under the License.
from cliff import lister
-from quantumclient.common import utils
-from quantumclient.quantum.v2_0.port import _format_fixed_ips
-from quantumclient.quantum.v2_0 import QuantumCommand
+from neutronclient.common import utils
+from neutronclient.neutron.v2_0 import NeutronCommand
+from neutronclient.neutron.v2_0.port import _format_fixed_ips
-from quantum.openstack.common import log as logging
+from neutron.openstack.common import log as logging
-class ProbeCommand(QuantumCommand):
+class ProbeCommand(NeutronCommand):
log = logging.getLogger(__name__ + '.ProbeCommand')
def get_debug_agent(self):
self.app.stdout.write(_('Probe %s deleted') % parsed_args.id + '\n')
-class ListProbe(QuantumCommand, lister.Lister):
+class ListProbe(NeutronCommand, lister.Lister):
"""List probes."""
log = logging.getLogger(__name__ + '.ListProbe')
import netaddr
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.dhcp_agent import DictModel
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.openstack.common import log as logging
+from neutron.agent.common import config
+from neutron.agent.dhcp_agent import DictModel
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
DEVICE_OWNER_COMPUTE_PROBE = 'compute:probe'
-class QuantumDebugAgent():
+class NeutronDebugAgent():
OPTS = [
# Needed for drivers
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.linux import interface
-from quantum.debug.debug_agent import QuantumDebugAgent
-from quantum.openstack.common import importutils
-from quantumclient.common import exceptions as exc
-from quantumclient.common import utils
-from quantumclient.shell import env, QuantumShell, QUANTUM_API_VERSION
+from neutron.agent.common import config
+from neutron.agent.linux import interface
+from neutron.common import legacy
+from neutron.debug.debug_agent import NeutronDebugAgent
+from neutron.openstack.common import importutils
+from neutronclient.common import exceptions as exc
+from neutronclient.common import utils
+from neutronclient.shell import env, NeutronShell, NEUTRON_API_VERSION
COMMAND_V2 = {
'probe-create': utils.import_class(
- 'quantum.debug.commands.CreateProbe'),
+ 'neutron.debug.commands.CreateProbe'),
'probe-delete': utils.import_class(
- 'quantum.debug.commands.DeleteProbe'),
+ 'neutron.debug.commands.DeleteProbe'),
'probe-list': utils.import_class(
- 'quantum.debug.commands.ListProbe'),
+ 'neutron.debug.commands.ListProbe'),
'probe-clear': utils.import_class(
- 'quantum.debug.commands.ClearProbe'),
+ 'neutron.debug.commands.ClearProbe'),
'probe-exec': utils.import_class(
- 'quantum.debug.commands.ExecProbe'),
+ 'neutron.debug.commands.ExecProbe'),
'ping-all': utils.import_class(
- 'quantum.debug.commands.PingAll'),
+ 'neutron.debug.commands.PingAll'),
#TODO(nati) ping, netcat , nmap, bench
}
COMMANDS = {'2.0': COMMAND_V2}
-class QuantumDebugShell(QuantumShell):
+class NeutronDebugShell(NeutronShell):
def __init__(self, api_version):
- super(QuantumDebugShell, self).__init__(api_version)
+ super(NeutronDebugShell, self).__init__(api_version)
for k, v in COMMANDS[api_version].items():
self.command_manager.add_command(k, v)
def build_option_parser(self, description, version):
- parser = super(QuantumDebugShell, self).build_option_parser(
+ parser = super(NeutronDebugShell, self).build_option_parser(
description, version)
+ default = (
+ env('NEUTRON_TEST_CONFIG_FILE') or env('QUANTUM_TEST_CONFIG_FILE')
+ )
parser.add_argument(
'--config-file',
- default=env('QUANTUM_TEST_CONFIG_FILE'),
+ default=default,
help=_('Config file for interface driver '
'(You may also use l3_agent.ini)'))
return parser
def initialize_app(self, argv):
- super(QuantumDebugShell, self).initialize_app(argv)
+ super(NeutronDebugShell, self).initialize_app(argv)
if not self.options.config_file:
raise exc.CommandError(
_("You must provide a config file for bridge -"
- " either --config-file or env[QUANTUM_TEST_CONFIG_FILE]"))
- client = self.client_manager.quantum
+ " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
+ client = self.client_manager.neutron
cfg.CONF.register_opts(interface.OPTS)
- cfg.CONF.register_opts(QuantumDebugAgent.OPTS)
+ cfg.CONF.register_opts(NeutronDebugAgent.OPTS)
config.register_root_helper(cfg.CONF)
cfg.CONF(['--config-file', self.options.config_file])
config.setup_logging(cfg.CONF)
+ legacy.modernize_quantum_config(cfg.CONF)
driver = importutils.import_object(cfg.CONF.interface_driver, cfg.CONF)
- self.debug_agent = QuantumDebugAgent(cfg.CONF, client, driver)
+ self.debug_agent = NeutronDebugAgent(cfg.CONF, client, driver)
def main(argv=None):
- return QuantumDebugShell(QUANTUM_API_VERSION).run(argv or sys.argv[1:])
+ return NeutronDebugShell(NEUTRON_API_VERSION).run(argv or sys.argv[1:])
from abc import abstractmethod
-from quantum.api import extensions
-from quantum.api.v2 import attributes as attr
-from quantum.api.v2 import base
-from quantum.common import exceptions
-from quantum import manager
+from neutron.api import extensions
+from neutron.api.v2 import attributes as attr
+from neutron.api.v2 import base
+from neutron.common import exceptions
+from neutron import manager
# Attribute Map
"""Returns Ext Resources."""
my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()]
attr.PLURALS.update(dict(my_plurals))
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
params = RESOURCE_ATTRIBUTE_MAP.get(RESOURCE_NAME + 's')
controller = base.create_resource(RESOURCE_NAME + 's',
RESOURCE_NAME,
from abc import abstractmethod
-from quantum.api import extensions
-from quantum.api.v2 import base
-from quantum.api.v2 import resource
-from quantum.common import constants
-from quantum.common import exceptions
-from quantum.extensions import agent
-from quantum import manager
-from quantum import policy
-from quantum import wsgi
+from neutron.api import extensions
+from neutron.api.v2 import base
+from neutron.api.v2 import resource
+from neutron.common import constants
+from neutron.common import exceptions
+from neutron.extensions import agent
+from neutron import manager
+from neutron import policy
+from neutron import wsgi
DHCP_NET = 'dhcp-network'
DHCP_NETS = DHCP_NET + 's'
class NetworkSchedulerController(wsgi.Controller):
def index(self, request, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"get_%s" % DHCP_NETS,
{})
request.context, kwargs['agent_id'])
def create(self, request, body, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"create_%s" % DHCP_NET,
{})
request.context, kwargs['agent_id'], body['network_id'])
def delete(self, request, id, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"delete_%s" % DHCP_NET,
{})
class RouterSchedulerController(wsgi.Controller):
def index(self, request, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"get_%s" % L3_ROUTERS,
{})
request.context, kwargs['agent_id'])
def create(self, request, body, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"create_%s" % L3_ROUTER,
{})
body['router_id'])
def delete(self, request, id, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"delete_%s" % L3_ROUTER,
{})
class DhcpAgentsHostingNetworkController(wsgi.Controller):
def index(self, request, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"get_%s" % DHCP_AGENTS,
{})
class L3AgentsHostingRouterController(wsgi.Controller):
def index(self, request, **kwargs):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
policy.enforce(request.context,
"get_%s" % L3_AGENTS,
{})
# under the License.
-from quantum.api.v2 import attributes as attr
-from quantum.common import exceptions as qexception
+from neutron.api.v2 import attributes as attr
+from neutron.common import exceptions as qexception
# Extra Routes Exceptions
@classmethod
def get_name(cls):
- return "Quantum Extra Route"
+ return "Neutron Extra Route"
@classmethod
def get_alias(cls):
@classmethod
def get_namespace(cls):
- return "http://docs.openstack.org/ext/quantum/extraroutes/api/v1.0"
+ return "http://docs.openstack.org/ext/neutron/extraroutes/api/v1.0"
@classmethod
def get_updated(cls):
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.openstack.common import log as logging
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.api import extensions
-from quantum.api.v2 import attributes as attr
-from quantum.api.v2 import base
-from quantum.common import exceptions as qexception
-from quantum import manager
-from quantum import quota
+from neutron.api import extensions
+from neutron.api.v2 import attributes as attr
+from neutron.api.v2 import base
+from neutron.common import exceptions as qexception
+from neutron import manager
+from neutron import quota
# L3 Exceptions
@classmethod
def get_name(cls):
- return "Quantum L3 Router"
+ return "Neutron L3 Router"
@classmethod
def get_alias(cls):
@classmethod
def get_description(cls):
return ("Router abstraction for basic L3 forwarding"
- " between L2 Quantum networks and access to external"
+ " between L2 Neutron networks and access to external"
" networks via a NAT gateway.")
@classmethod
def get_namespace(cls):
- return "http://docs.openstack.org/ext/quantum/router/api/v1.0"
+ return "http://docs.openstack.org/ext/neutron/router/api/v1.0"
@classmethod
def get_updated(cls):
my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()]
attr.PLURALS.update(dict(my_plurals))
exts = []
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
for resource_name in ['router', 'floatingip']:
collection_name = resource_name + "s"
params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict())
# @author: Salvatore Orlando, Nicira, Inc
#
-from quantum.api import extensions
-from quantum.common import exceptions as qexception
-from quantum.extensions import l3
+from neutron.api import extensions
+from neutron.common import exceptions as qexception
+from neutron.extensions import l3
class RouterDNatDisabled(qexception.BadRequest):
@classmethod
def get_name(cls):
- return "Quantum L3 Configurable external gateway mode"
+ return "Neutron L3 Configurable external gateway mode"
@classmethod
def get_alias(cls):
@classmethod
def get_namespace(cls):
- return "http://docs.openstack.org/ext/quantum/ext-gw-mode/api/v1.0"
+ return "http://docs.openstack.org/ext/neutron/ext-gw-mode/api/v1.0"
@classmethod
def get_updated(cls):
from oslo.config import cfg
-from quantum.api import extensions
-from quantum.api.v2 import attributes as attr
-from quantum.api.v2 import base
-from quantum.common import exceptions as qexception
-from quantum import manager
-from quantum.plugins.common import constants
-from quantum.services.service_base import ServicePluginBase
+from neutron.api import extensions
+from neutron.api.v2 import attributes as attr
+from neutron.api.v2 import base
+from neutron.common import exceptions as qexception
+from neutron import manager
+from neutron.plugins.common import constants
+from neutron.services.service_base import ServicePluginBase
# Loadbalancer Exceptions
message = _("Vip %(vip_id)s could not be found")
-class VipExists(qexception.QuantumException):
+class VipExists(qexception.NeutronException):
message = _("Another Vip already exists for pool %(pool_id)s")
message = _("Health_monitor %(monitor_id)s could not be found")
-class StateInvalid(qexception.QuantumException):
+class StateInvalid(qexception.NeutronException):
message = _("Invalid state %(state)s of Loadbalancer resource %(id)s")
@classmethod
def get_namespace(cls):
- return "http://wiki.openstack.org/Quantum/LBaaS/API_1.0"
+ return "http://wiki.openstack.org/neutron/LBaaS/API_1.0"
@classmethod
def get_updated(cls):
my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()]
attr.PLURALS.update(dict(my_plurals))
resources = []
- plugin = manager.QuantumManager.get_service_plugins()[
+ plugin = manager.NeutronManager.get_service_plugins()[
constants.LOADBALANCER]
for collection_name in RESOURCE_ATTRIBUTE_MAP:
# Special handling needed for resources with 'y' ending
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.api import extensions
-from quantum.api.v2 import attributes
+from neutron.api import extensions
+from neutron.api.v2 import attributes
# The service will return the vif type for the specific port.
# the plugin.
PROFILE = 'binding:profile'
# The capabilities will be a dictionary that enables pass information about
-# functionalies quantum provides. The following value should be provided.
-# - port_filter : Boolean value indicating Quantum provides port filtering
+# functionalies neutron provides. The following value should be provided.
+# - port_filter : Boolean value indicating Neutron provides port filtering
# features such as security group and anti MAC/IP spoofing
CAPABILITIES = 'binding:capabilities'
CAP_PORT_FILTER = 'port_filter'
class Portbindings(extensions.ExtensionDescriptor):
"""Extension class supporting port bindings.
- This class is used by quantum's extension framework to make
+ This class is used by neutron's extension framework to make
metadata about the port bindings available to external applications.
With admin rights one will be able to update and read the values.
# @author: Aaron Rosen, Nicira, Inc
-from quantum.api.v2 import attributes
-from quantum.common import exceptions as qexception
+from neutron.api.v2 import attributes
+from neutron.common import exceptions as qexception
class PortSecurityPortHasSecurityGroup(qexception.InUse):
# License for the specific language governing permissions and limitations
# under the License.
-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
NETWORK_TYPE = 'provider:network_type'
class Providernet(extensions.ExtensionDescriptor):
"""Extension class supporting provider networks.
- This class is used by quantum's extension framework to make
+ This class is used by neutron's extension framework to make
metadata about the provider network extension available to
clients. No new resources are defined by this extension. Instead,
the existing network resource's request and response messages are
from oslo.config import cfg
import webob
-from quantum.api import extensions
-from quantum.api.v2.attributes import convert_to_int
-from quantum.api.v2 import base
-from quantum.api.v2 import resource
-from quantum.common import exceptions as q_exc
-from quantum.manager import QuantumManager
-from quantum.openstack.common import importutils
-from quantum import quota
-from quantum import wsgi
+from neutron.api import extensions
+from neutron.api.v2.attributes import convert_to_int
+from neutron.api.v2 import base
+from neutron.api.v2 import resource
+from neutron.common import exceptions as q_exc
+from neutron.manager import NeutronManager
+from neutron.openstack.common import importutils
+from neutron import quota
+from neutron import wsgi
RESOURCE_NAME = 'quota'
RESOURCE_COLLECTION = RESOURCE_NAME + "s"
QUOTAS = quota.QUOTAS
-DB_QUOTA_DRIVER = 'quantum.db.quota_db.DbQuotaDriver'
+DB_QUOTA_DRIVER = 'neutron.db.quota_db.DbQuotaDriver'
EXTENDED_ATTRIBUTES_2_0 = {
RESOURCE_COLLECTION: {}
}
def __init__(self, plugin):
self._resource_name = RESOURCE_NAME
self._plugin = plugin
- self._driver = importutils.import_class(cfg.CONF.QUOTAS.quota_driver)
+ self._driver = importutils.import_class(
+ cfg.CONF.QUOTAS.quota_driver
+ )
self._update_extended_attributes = True
def _update_attributes(self):
def get_resources(cls):
"""Returns Ext Resources."""
controller = resource.Resource(
- QuotaSetsController(QuantumManager.get_plugin()),
+ QuotaSetsController(NeutronManager.get_plugin()),
faults=base.FAULT_MAP)
return [extensions.ResourceExtension(
Quotasv2.get_alias(),
from oslo.config import cfg
-from quantum.api import extensions
-from quantum.api.v2 import attributes as attr
-from quantum.api.v2 import base
-from quantum.common import exceptions as qexception
-from quantum import manager
-from quantum.openstack.common import uuidutils
-from quantum import quota
+from neutron.api import extensions
+from neutron.api.v2 import attributes as attr
+from neutron.api.v2 import base
+from neutron.common import exceptions as qexception
+from neutron import manager
+from neutron.openstack.common import uuidutils
+from neutron import quota
# Security group Exceptions
my_plurals = [(key, key[:-1]) for key in RESOURCE_ATTRIBUTE_MAP.keys()]
attr.PLURALS.update(dict(my_plurals))
exts = []
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
for resource_name in ['security_group', 'security_group_rule']:
collection_name = resource_name.replace('_', '-') + "s"
params = RESOURCE_ATTRIBUTE_MAP.get(resource_name + "s", dict())
# @author: Salvatore Orlando, VMware
#
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.api.v2 import base
-from quantum import context
-from quantum.db import servicetype_db
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum.plugins.common import constants
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.api.v2 import base
+from neutron import context
+from neutron.db import servicetype_db
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron.plugins.common import constants
LOG = logging.getLogger(__name__)
return msg
# TODO(salvatore-orlando): This code will need to change when
# multiple plugins for each adv service will be supported
- svc_plugin = manager.QuantumManager.get_service_plugins().get(
+ svc_plugin = manager.NeutronManager.get_service_plugins().get(
svc_name)
if not svc_plugin:
msg = _("No plugin for service '%s'") % svc_name
@classmethod
def get_name(cls):
- return _("Quantum Service Type Management")
+ return _("Neutron Service Type Management")
@classmethod
def get_alias(cls):
@classmethod
def get_description(cls):
return _("API for retrieving and managing service types for "
- "Quantum advanced services")
+ "Neutron advanced services")
@classmethod
def get_namespace(cls):
- return "http://docs.openstack.org/ext/quantum/service-type/api/v1.0"
+ return "http://docs.openstack.org/ext/neutron/service-type/api/v1.0"
@classmethod
def get_updated(cls):
from oslo.config import cfg
-from quantum.common import utils
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import periodic_task
-from quantum.plugins.common import constants
+from neutron.common import utils
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import periodic_task
+from neutron.plugins.common import constants
LOG = logging.getLogger(__name__)
message. If all is OK then it will return None.
"""
if cfg.CONF.core_plugin is None:
- msg = _('Quantum core_plugin not configured!')
+ msg = _('Neutron core_plugin not configured!')
return msg
-class QuantumManager(object):
- """Quantum's Manager class.
+class NeutronManager(object):
+ """Neutron's Manager class.
- Quantum's Manager class is responsible for parsing a config file and
+ Neutron's Manager class is responsible for parsing a config file and
instantiating the correct plugin that concretely implement
- quantum_plugin_base class.
- The caller should make sure that QuantumManager is a singleton.
+ neutron_plugin_base class.
+ The caller should make sure that NeutronManager is a singleton.
"""
_instance = None
plugin_klass = importutils.import_class(plugin_provider)
except ImportError:
LOG.exception(_("Error loading plugin"))
- raise Exception(_("Plugin not found. You can install a "
- "plugin with: pip install <plugin-name>\n"
- "Example: pip install quantum-sample-plugin"))
+ raise Exception(_("Plugin not found. "))
self.plugin = plugin_klass()
msg = validate_post_plugin_load()
# @author: Dan Wendlandt, Nicira, Inc.
"""
-v2 Quantum Plug-in API specification.
+v2 Neutron Plug-in API specification.
-:class:`QuantumPluginBaseV2` provides the definition of minimum set of
-methods that needs to be implemented by a v2 Quantum Plug-in.
+:class:`NeutronPluginBaseV2` provides the definition of minimum set of
+methods that needs to be implemented by a v2 Neutron Plug-in.
"""
from abc import ABCMeta, abstractmethod
-from quantum.common import exceptions
+from neutron.common import exceptions
-class QuantumPluginBaseV2(object):
+class NeutronPluginBaseV2(object):
__metaclass__ = ABCMeta
Create a subnet, which represents a range of IP addresses
that can be allocated to devices
- :param context: quantum api request context
+ :param context: neutron api request context
:param subnet: dictionary describing the subnet, with keys
as listed in the :obj:`RESOURCE_ATTRIBUTE_MAP` object
- in :file:`quantum/api/v2/attributes.py`. All keys will
+ in :file:`neutron/api/v2/attributes.py`. All keys will
be populated.
"""
pass
def update_subnet(self, context, id, subnet):
"""Update values of a subnet.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the subnet to update.
:param subnet: dictionary with keys indicating fields to update.
valid keys are those that have a value of True for
'allow_put' as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`.
+ :file:`neutron/api/v2/attributes.py`.
"""
pass
def get_subnet(self, context, id, fields=None):
"""Retrieve a subnet.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the subnet to fetch.
:param fields: a list of strings that are valid keys in a
subnet dictionary as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Only these fields
+ :file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
the identity of the user making the request (as indicated by the
context) as well as any filters.
- :param context: quantum api request context
+ :param context: neutron api request context
:param filters: a dictionary with keys that are valid keys for
a subnet as listed in the :obj:`RESOURCE_ATTRIBUTE_MAP`
- object in :file:`quantum/api/v2/attributes.py`.
+ object in :file:`neutron/api/v2/attributes.py`.
Values in this dictiontary are an iterable containing
values that will be used for an exact match comparison
for that value. Each result returned by this
:param fields: a list of strings that are valid keys in a
subnet dictionary as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Only these fields
+ :file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
the user making the request (as indicated by the context) as well as
any filters.
- :param context: quantum api request context
+ :param context: neutron api request context
:param filters: a dictionary with keys that are valid keys for
a network as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Values in this
+ :file:`neutron/api/v2/attributes.py`. Values in this
dictiontary are an iterable containing values that
will be used for an exact match comparison for that
value. Each result returned by this function will
def delete_subnet(self, context, id):
"""Delete a subnet.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the subnet to delete.
"""
pass
Create a network, which represents an L2 network segment which
can have a set of subnets and ports associated with it.
- :param context: quantum api request context
+ :param context: neutron api request context
:param network: dictionary describing the network, with keys
as listed in the :obj:`RESOURCE_ATTRIBUTE_MAP` object
- in :file:`quantum/api/v2/attributes.py`. All keys will
+ in :file:`neutron/api/v2/attributes.py`. All keys will
be populated.
"""
def update_network(self, context, id, network):
"""Update values of a network.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the network to update.
:param network: dictionary with keys indicating fields to update.
valid keys are those that have a value of True for
'allow_put' as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`.
+ :file:`neutron/api/v2/attributes.py`.
"""
pass
def get_network(self, context, id, fields=None):
"""Retrieve a network.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the network to fetch.
:param fields: a list of strings that are valid keys in a
network dictionary as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Only these fields
+ :file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
the identity of the user making the request (as indicated by the
context) as well as any filters.
- :param context: quantum api request context
+ :param context: neutron api request context
:param filters: a dictionary with keys that are valid keys for
a network as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Values in this
+ :file:`neutron/api/v2/attributes.py`. Values in this
dictiontary are an iterable containing values that will
be used for an exact match comparison for that value.
Each result returned by this function will have matched
:param fields: a list of strings that are valid keys in a
network dictionary as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Only these fields
+ :file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
of the user making the request (as indicated by the context) as well
as any filters.
- :param context: quantum api request context
+ :param context: neutron api request context
:param filters: a dictionary with keys that are valid keys for
a network as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object
- in :file:`quantum/api/v2/attributes.py`. Values in
+ in :file:`neutron/api/v2/attributes.py`. Values in
this dictiontary are an iterable containing values that
will be used for an exact match comparison for that
value. Each result returned by this function will have
def delete_network(self, context, id):
"""Delete a network.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the network to delete.
"""
pass
"""Create a port.
Create a port, which is a connection point of a device (e.g., a VM
- NIC) to attach to a L2 Quantum network.
+ NIC) to attach to a L2 neutron network.
- :param context: quantum api request context
+ :param context: neutron api request context
:param port: dictionary describing the port, with keys as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. All keys will be
+ :file:`neutron/api/v2/attributes.py`. All keys will be
populated.
"""
pass
def update_port(self, context, id, port):
"""Update values of a port.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the port to update.
:param port: dictionary with keys indicating fields to update.
valid keys are those that have a value of True for
'allow_put' as listed in the :obj:`RESOURCE_ATTRIBUTE_MAP`
- object in :file:`quantum/api/v2/attributes.py`.
+ object in :file:`neutron/api/v2/attributes.py`.
"""
pass
def get_port(self, context, id, fields=None):
"""Retrieve a port.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the port to fetch.
:param fields: a list of strings that are valid keys in a port
dictionary as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Only these fields
+ :file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
The contents of the list depends on the identity of the user making
the request (as indicated by the context) as well as any filters.
- :param context: quantum api request context
+ :param context: neutron api request context
:param filters: a dictionary with keys that are valid keys for
a port as listed in the :obj:`RESOURCE_ATTRIBUTE_MAP`
- object in :file:`quantum/api/v2/attributes.py`. Values
+ object in :file:`neutron/api/v2/attributes.py`. Values
in this dictiontary are an iterable containing values
that will be used for an exact match comparison for
that value. Each result returned by this function will
:param fields: a list of strings that are valid keys in a
port dictionary as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Only these fields
+ :file:`neutron/api/v2/attributes.py`. Only these fields
will be returned.
"""
pass
The result depends on the identity of the user making the request
(as indicated by the context) as well as any filters.
- :param context: quantum api request context
+ :param context: neutron api request context
:param filters: a dictionary with keys that are valid keys for
a network as listed in the
:obj:`RESOURCE_ATTRIBUTE_MAP` object in
- :file:`quantum/api/v2/attributes.py`. Values in this
+ :file:`neutron/api/v2/attributes.py`. Values in this
dictiontary are an iterable containing values that will
be used for an exact match comparison for that value.
Each result returned by this function will have matched
def delete_port(self, context, id):
"""Delete a port.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the port to delete.
"""
pass
import itertools
-from quantum.openstack.common import uuidutils
+from neutron.openstack.common import uuidutils
def generate_request_id():
from oslo.config import cfg
-from quantum.openstack.common import importutils
-from quantum.openstack.common import lockutils
+from neutron.openstack.common import importutils
+from neutron.openstack.common import lockutils
db_opts = [
self.__backend = None
self.__backend_mapping = backend_mapping
- @lockutils.synchronized('dbapi_backend', 'quantum-')
+ @lockutils.synchronized('dbapi_backend', 'neutron-')
def __get_backend(self):
"""Get the actual backend. May be a module or an instance of
a class. Doesn't matter to us. We do this synchronized as it's
"""DB related custom exceptions."""
-from quantum.openstack.common.gettextutils import _
+from neutron.openstack.common.gettextutils import _
class DBError(Exception):
from sqlalchemy import DateTime
from sqlalchemy.orm import object_mapper
-from quantum.openstack.common.db.sqlalchemy.session import get_session
-from quantum.openstack.common import timeutils
+from neutron.openstack.common.db.sqlalchemy.session import get_session
+from neutron.openstack.common import timeutils
class ModelBase(object):
Example:
session.set_defaults(
- sql_connection="sqlite:///var/lib/quantum/sqlite.db",
- sqlite_db="/var/lib/quantum/sqlite.db")
+ sql_connection="sqlite:///var/lib/neutron/sqlite.db",
+ sqlite_db="/var/lib/neutron/sqlite.db")
Recommended ways to use sessions within this framework:
from sqlalchemy.pool import NullPool, StaticPool
from sqlalchemy.sql.expression import literal_column
-from quantum.openstack.common.db import exception
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import timeutils
+from neutron.openstack.common.db import exception
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import timeutils
DEFAULT = 'DEFAULT'
sqlite_db_opts = [
cfg.StrOpt('sqlite_db',
- default='quantum.sqlite',
+ default='neutron.sqlite',
help='the filename to use with sqlite'),
cfg.BoolOpt('sqlite_synchronous',
default=True,
# db/api is just a wrapper around db/sqlalchemy/api
if file.endswith('db/api.py'):
continue
- # only trace inside quantum
- index = file.rfind('quantum')
+ # only trace inside neutron
+ index = file.rfind('neutron')
if index == -1:
continue
stack += "File:%s:%s Method:%s() Line:%s | " \
import sqlalchemy
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
import logging
-from quantum.openstack.common.gettextutils import _
+from neutron.openstack.common.gettextutils import _
_FATAL_EXCEPTION_FORMAT_ERRORS = False
import sys
import traceback
-from quantum.openstack.common.gettextutils import _
+from neutron.openstack.common.gettextutils import _
@contextlib.contextmanager
import errno
import os
-from quantum.openstack.common import excutils
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
+from neutron.openstack.common import excutils
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
Usual usage in an openstack.common module:
- from quantum.openstack.common.gettextutils import _
+ from neutron.openstack.common.gettextutils import _
"""
import copy
import os
import UserString
-_localedir = os.environ.get('quantum'.upper() + '_LOCALEDIR')
-_t = gettext.translation('quantum', localedir=_localedir, fallback=True)
+_localedir = os.environ.get('neutron'.upper() + '_LOCALEDIR')
+_t = gettext.translation('neutron', localedir=_localedir, fallback=True)
def _(msg):
import six
-from quantum.openstack.common import timeutils
+from neutron.openstack.common import timeutils
_nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod,
from eventlet import semaphore
from oslo.config import cfg
-from quantum.openstack.common import fileutils
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import local
-from quantum.openstack.common import log as logging
+from neutron.openstack.common import fileutils
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import local
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import importutils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import local
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import importutils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import local
_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
if CONF.publish_errors:
handler = importutils.import_object(
- "quantum.openstack.common.log_handler.PublishErrorsHandler",
+ "neutron.openstack.common.log_handler.PublishErrorsHandler",
logging.ERROR)
log_root.addHandler(handler)
from eventlet import event
from eventlet import greenthread
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import timeutils
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import timeutils
LOG = logging.getLogger(__name__)
Network-related utilities and helper functions.
"""
-from quantum.openstack.common import log as logging
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common import context
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import importutils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import timeutils
+from neutron.openstack.common import context
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import importutils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import timeutils
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
CONF = cfg.CONF
CONF.default_notification_level)
priority = priority.lower()
logger = logging.getLogger(
- 'quantum.openstack.common.notification.%s' %
+ 'neutron.openstack.common.notification.%s' %
message['event_type'])
getattr(logger, priority)(jsonutils.dumps(message))
# under the License.
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.notifier import rpc_notifier
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.notifier import rpc_notifier
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common import context as req_context
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
+from neutron.openstack.common import context as req_context
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common import context as req_context
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
+from neutron.openstack.common import context as req_context
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import timeutils
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import timeutils
periodic_opts = [
import six
import urllib2
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from eventlet.green import subprocess
from eventlet import greenthread
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import importutils
-from quantum.openstack.common import local
-from quantum.openstack.common import log as logging
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import importutils
+from neutron.openstack.common import local
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
help='Seconds to wait before a cast expires (TTL). '
'Only supported by impl_zmq.'),
cfg.ListOpt('allowed_rpc_exception_modules',
- default=['quantum.openstack.common.exception',
+ default=['neutron.openstack.common.exception',
'nova.exception',
'cinder.exception',
'exceptions',
from eventlet import queue
from eventlet import semaphore
-from quantum.openstack.common import excutils
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import local
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common import excutils
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import local
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import common as rpc_common
UNIQUE_ID = '_unique_id'
from oslo.config import cfg
import six
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import importutils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import local
-from quantum.openstack.common import log as logging
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import importutils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import local
+from neutron.openstack.common import log as logging
CONF = cfg.CONF
minimum version that supports the new parameter should be specified.
"""
-from quantum.openstack.common.rpc import common as rpc_common
-from quantum.openstack.common.rpc import serializer as rpc_serializer
+from neutron.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.rpc import serializer as rpc_serializer
class RpcDispatcher(object):
import eventlet
-from quantum.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.rpc import common as rpc_common
CONSUMERS = {}
import kombu.messaging
from oslo.config import cfg
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import network_utils
-from quantum.openstack.common.rpc import amqp as rpc_amqp
-from quantum.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import network_utils
+from neutron.openstack.common.rpc import amqp as rpc_amqp
+from neutron.openstack.common.rpc import common as rpc_common
kombu_opts = [
cfg.StrOpt('kombu_ssl_version',
import greenlet
from oslo.config import cfg
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import importutils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import amqp as rpc_amqp
-from quantum.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import importutils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import amqp as rpc_amqp
+from neutron.openstack.common.rpc import common as rpc_common
qpid_codec = importutils.try_import("qpid.codec010")
qpid_messaging = importutils.try_import("qpid.messaging")
import greenlet
from oslo.config import cfg
-from quantum.openstack.common import excutils
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import importutils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common import excutils
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import importutils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common.rpc import common as rpc_common
zmq = importutils.try_import('eventlet.green.zmq')
# The module.Class to use for matchmaking.
cfg.StrOpt(
'rpc_zmq_matchmaker',
- default=('quantum.openstack.common.rpc.'
+ default=('neutron.openstack.common.rpc.'
'matchmaker.MatchMakerLocalhost'),
help='MatchMaker driver',
),
import eventlet
from oslo.config import cfg
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
matchmaker_opts = [
from oslo.config import cfg
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import matchmaker as mm_common
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import matchmaker as mm_common
redis = importutils.try_import('redis')
from oslo.config import cfg
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import matchmaker as mm
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import matchmaker as mm
matchmaker_opts = [
"""
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import common as rpc_common
-from quantum.openstack.common.rpc import serializer as rpc_serializer
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.rpc import serializer as rpc_serializer
class RpcProxy(object):
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import dispatcher as rpc_dispatcher
-from quantum.openstack.common import service
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import dispatcher as rpc_dispatcher
+from neutron.openstack.common import service
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import impl_zmq
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import impl_zmq
CONF = cfg.CONF
CONF.register_opts(rpc.rpc_opts)
import logging as std_logging
from oslo.config import cfg
-from quantum.openstack.common import eventlet_backdoor
-from quantum.openstack.common.gettextutils import _
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import threadgroup
+from neutron.openstack.common import eventlet_backdoor
+from neutron.openstack.common.gettextutils import _
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import threadgroup
-rpc = importutils.try_import('quantum.openstack.common.rpc')
+rpc = importutils.try_import('neutron.openstack.common.rpc')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
from eventlet import greenpool
from eventlet import greenthread
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
LOG = logging.getLogger(__name__)
# catch an import error if nicira is not the configured plugin
try:
- from quantum.plugins import nicira
+ from neutron.plugins import nicira
# Provide a mapping for the nicira_nvp_plugin package to ensure
# backwards compatibility for configuration.
- sys.modules['quantum.plugins.nicira.nicira_nvp_plugin'] = nicira
+ sys.modules['neutron.plugins.nicira.nicira_nvp_plugin'] = nicira
except ImportError:
pass
-# Quantum REST Proxy Plug-in for Big Switch and FloodLight Controllers
+# Neuron REST Proxy Plug-in for Big Switch and FloodLight Controllers
-This module provides a generic quantum plugin 'QuantumRestProxy' that
-translates quantum function calls to authenticated REST requests (JSON supported)
+This module provides a generic neutron plugin 'NeutronRestProxy' that
+translates neutron function calls to authenticated REST requests (JSON supported)
to a set of redundant external network controllers.
-It also keeps a local persistent store of quantum state that has been
+It also keeps a local persistent store of neutron state that has been
setup using that API.
Currently the FloodLight Openflow Controller or the Big Switch Networks Controller
can be configured as external network controllers for this plugin.
For more details on this plugin, please refer to the following link:
-http://www.openflowhub.org/display/floodlightcontroller/Quantum+REST+Proxy+Plugin
+http://www.openflowhub.org/display/floodlightcontroller/Neutron+REST+Proxy+Plugin
import sqlalchemy as sa
-from quantum.api.v2 import attributes
-from quantum.db import model_base
-from quantum.openstack.common import log as logging
+from neutron.api.v2 import attributes
+from neutron.db import model_base
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
#
# @author: Kevin Benton, Big Switch Networks, Inc.
-from quantum.api.v2 import attributes as attr
-from quantum.common import exceptions as qexception
-from quantum.openstack.common import log as logging
+from neutron.api.v2 import attributes as attr
+from neutron.common import exceptions as qexception
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
@classmethod
def get_name(cls):
- return "Quantum Router Rule"
+ return "Neutron Router Rule"
@classmethod
def get_alias(cls):
@classmethod
def get_namespace(cls):
- return "http://docs.openstack.org/ext/quantum/routerrules/api/v1.0"
+ return "http://docs.openstack.org/ext/neutron/routerrules/api/v1.0"
@classmethod
def get_updated(cls):
# @author: Sumit Naiksatam, sumitnaiksatam@gmail.com, Big Switch Networks, Inc.
"""
-Quantum REST Proxy Plug-in for Big Switch and FloodLight Controllers.
+Neutron REST Proxy Plug-in for Big Switch and FloodLight Controllers.
-QuantumRestProxy provides a generic quantum plugin that translates all plugin
+NeutronRestProxy provides a generic neutron plugin that translates all plugin
function calls to equivalent authenticated REST calls to a set of redundant
-external network controllers. It also keeps persistent store for all quantum
+external network controllers. It also keeps persistent store for all neutron
state to allow for re-sync of the external controller(s), if required.
The local state on the plugin also allows for local response and fast-fail
to reside on the controller itself (via the REST interface).
This allows for:
- - independent authentication and redundancy schemes between quantum and the
+ - independent authentication and redundancy schemes between neutron and the
network controller
- - independent upgrade/development cycles between quantum and the controller
- as it limits the proxy code upgrade requirement to quantum release cycle
+ - independent upgrade/development cycles between neutron and the controller
+ as it limits the proxy code upgrade requirement to neutron release cycle
and the controller specific code upgrade requirement to controller code
- - ability to sync the controller with quantum for independent recovery/reset
+ - ability to sync the controller with neutron for independent recovery/reset
-External REST API used by proxy is the same API as defined for quantum (JSON
+External REST API used by proxy is the same API as defined for neutron (JSON
subset) with some additional parameters (gateway on network-create and macaddr
on port-attach) on an additional PUT to do a bulk dump of all persistent data.
"""
from oslo.config import cfg
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.common import constants as const
-from quantum.common import exceptions
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.common import utils
-from quantum import context as qcontext
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import dhcp_rpc_base
-from quantum.db import l3_db
-from quantum.extensions import l3
-from quantum.extensions import portbindings
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.plugins.bigswitch.db import porttracker_db
-from quantum.plugins.bigswitch import routerrule_db
-from quantum.plugins.bigswitch.version import version_string_with_vcs
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.common import constants as const
+from neutron.common import exceptions
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.common import utils
+from neutron import context as qcontext
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import dhcp_rpc_base
+from neutron.db import l3_db
+from neutron.extensions import l3
+from neutron.extensions import portbindings
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.plugins.bigswitch.db import porttracker_db
+from neutron.plugins.bigswitch import routerrule_db
+from neutron.plugins.bigswitch.version import version_string_with_vcs
LOG = logging.getLogger(__name__)
cfg.IntOpt('server_timeout', default=10,
help=_("Maximum number of seconds to wait for proxy request "
"to connect and complete.")),
- cfg.StrOpt('quantum_id', default='Quantum-' + utils.get_hostname(),
- help=_("User defined identifier for this Quantum deployment")),
+ cfg.StrOpt('neutron_id', default='neutron-' + utils.get_hostname(),
+ deprecated_name='quantum_id',
+ help=_("User defined identifier for this Neutron deployment")),
cfg.BoolOpt('add_meta_server_route', default=True,
help=_("Flag to decide if a route to the metadata server "
"should be injected into the VM")),
504, 505]
SYNTAX_ERROR_MESSAGE = 'Syntax error in server config file, aborting plugin'
BASE_URI = '/networkService/v1.1'
-ORCHESTRATION_SERVICE_ID = 'Quantum v2.0'
+ORCHESTRATION_SERVICE_ID = 'Neutron v2.0'
METADATA_SERVER_IP = '169.254.169.254'
-class RemoteRestError(exceptions.QuantumException):
+class RemoteRestError(exceptions.NeutronException):
def __init__(self, message):
if message is None:
class ServerProxy(object):
"""REST server proxy to a network controller."""
- def __init__(self, server, port, ssl, auth, quantum_id, timeout,
+ def __init__(self, server, port, ssl, auth, neutron_id, timeout,
base_uri, name):
self.server = server
self.port = port
self.name = name
self.success_codes = SUCCESS_CODES
self.auth = None
- self.quantum_id = quantum_id
+ self.neutron_id = neutron_id
if auth:
self.auth = 'Basic ' + base64.encodestring(auth).strip()
headers = {}
headers['Content-type'] = 'application/json'
headers['Accept'] = 'application/json'
- headers['QuantumProxy-Agent'] = self.name
- headers['Instance-ID'] = self.quantum_id
+ headers['NeutronProxy-Agent'] = self.name
+ headers['Instance-ID'] = self.neutron_id
headers['Orchestration-Service-ID'] = ORCHESTRATION_SERVICE_ID
if self.auth:
headers['Authorization'] = self.auth
class ServerPool(object):
- def __init__(self, servers, ssl, auth, quantum_id, timeout=10,
- base_uri='/quantum/v1.0', name='QuantumRestProxy'):
+ def __init__(self, servers, ssl, auth, neutron_id, timeout=10,
+ base_uri='/quantum/v1.0', name='NeutronRestProxy'):
self.base_uri = base_uri
self.timeout = timeout
self.name = name
self.auth = auth
self.ssl = ssl
- self.quantum_id = quantum_id
+ self.neutron_id = neutron_id
self.servers = []
for server_port in servers:
self.servers.append(self.server_proxy_for(*server_port))
def server_proxy_for(self, server, port):
- return ServerProxy(server, port, self.ssl, self.auth, self.quantum_id,
+ return ServerProxy(server, port, self.ssl, self.auth, self.neutron_id,
self.timeout, self.base_uri, self.name)
def server_failure(self, resp):
return q_rpc.PluginRpcDispatcher([self])
-class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2,
+class NeutronRestProxyV2(db_base_plugin_v2.NeutronDbPluginV2,
routerrule_db.RouterRule_db_mixin):
supported_extension_aliases = ["router", "binding", "router_rules"]
def __init__(self, server_timeout=None):
- LOG.info(_('QuantumRestProxy: Starting plugin. Version=%s'),
+ LOG.info(_('NeutronRestProxy: Starting plugin. Version=%s'),
version_string_with_vcs())
# init DB, proxy's persistent store defaults to in-memory sql-lite DB
server_auth = cfg.CONF.RESTPROXY.server_auth
server_ssl = cfg.CONF.RESTPROXY.server_ssl
sync_data = cfg.CONF.RESTPROXY.sync_data
- quantum_id = cfg.CONF.RESTPROXY.quantum_id
+ neutron_id = cfg.CONF.RESTPROXY.neutron_id
self.add_meta_server_route = cfg.CONF.RESTPROXY.add_meta_server_route
timeout = cfg.CONF.RESTPROXY.server_timeout
if server_timeout is not None:
assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE
# init network ctrl connections
- self.servers = ServerPool(servers, server_ssl, server_auth, quantum_id,
+ self.servers = ServerPool(servers, server_ssl, server_auth, neutron_id,
timeout, BASE_URI)
# init dhcp support
self._send_all_data()
self._dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
- LOG.debug(_("QuantumRestProxyV2: initialization done"))
+ LOG.debug(_("NeutronRestProxyV2: initialization done"))
def create_network(self, context, network):
"""Create a network.
Network represents an L2 network segment which can have a set of
subnets and ports associated with it.
- :param context: quantum api request context
+ :param context: neutron api request context
:param network: dictionary describing the network
:returns: a sequence of mappings with the following signature:
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2: create_network() called"))
+ LOG.debug(_("NeutronRestProxyV2: create_network() called"))
self._warn_on_state_status(network['network'])
session = context.session
with session.begin(subtransactions=True):
# create network in DB
- new_net = super(QuantumRestProxyV2, self).create_network(context,
+ new_net = super(NeutronRestProxyV2, self).create_network(context,
network)
self._process_l3_create(context, new_net, network['network'])
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2:Unable to create remote "
+ LOG.error(_("NeutronRestProxyV2:Unable to create remote "
"network: %s"), e.message)
- super(QuantumRestProxyV2, self).delete_network(context,
+ super(NeutronRestProxyV2, self).delete_network(context,
new_net['id'])
raise
def update_network(self, context, net_id, network):
"""Updates the properties of a particular Virtual Network.
- :param context: quantum api request context
+ :param context: neutron api request context
:param net_id: uuid of the network to update
:param network: dictionary describing the updates
:raises: exceptions.NetworkNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2.update_network() called"))
+ LOG.debug(_("NeutronRestProxyV2.update_network() called"))
self._warn_on_state_status(network['network'])
session = context.session
with session.begin(subtransactions=True):
- orig_net = super(QuantumRestProxyV2, self).get_network(context,
+ orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id)
- new_net = super(QuantumRestProxyV2, self).update_network(context,
+ new_net = super(NeutronRestProxyV2, self).update_network(context,
net_id,
network)
self._process_l3_update(context, new_net, network['network'])
try:
self._send_update_network(new_net)
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to update remote "
+ LOG.error(_("NeutronRestProxyV2: Unable to update remote "
"network: %s"), e.message)
# reset network to original state
- super(QuantumRestProxyV2, self).update_network(context, id,
+ super(NeutronRestProxyV2, self).update_network(context, id,
orig_net)
raise
def delete_network(self, context, net_id):
"""Delete a network.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the network to delete.
:returns: None
:raises: exceptions.NetworkNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2: delete_network() called"))
+ LOG.debug(_("NeutronRestProxyV2: delete_network() called"))
# Validate args
- orig_net = super(QuantumRestProxyV2, self).get_network(context, net_id)
+ orig_net = super(NeutronRestProxyV2, self).get_network(context, net_id)
tenant_id = orig_net["tenant_id"]
filter = {'network_id': [net_id]}
ret = self.servers.delete(resource)
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
- ret_val = super(QuantumRestProxyV2, self).delete_network(context,
+ ret_val = super(NeutronRestProxyV2, self).delete_network(context,
net_id)
return ret_val
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to update remote "
+ LOG.error(_("NeutronRestProxyV2: Unable to update remote "
"network: %s"), e.message)
raise
def create_port(self, context, port):
"""Create a port, which is a connection point of a device
- (e.g., a VM NIC) to attach to a L2 Quantum network.
- :param context: quantum api request context
+ (e.g., a VM NIC) to attach to a L2 Neutron network.
+ :param context: neutron api request context
:param port: dictionary describing the port
:returns:
:raises: exceptions.StateInvalid
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2: create_port() called"))
+ LOG.debug(_("NeutronRestProxyV2: create_port() called"))
# Update DB
port["port"]["admin_state_up"] = False
and 'device_id' in port['port']):
porttracker_db.put_port_hostid(context, port['port']['device_id'],
port['port'][portbindings.HOST_ID])
- new_port = super(QuantumRestProxyV2, self).create_port(context, port)
- net = super(QuantumRestProxyV2,
+ new_port = super(NeutronRestProxyV2, self).create_port(context, port)
+ net = super(NeutronRestProxyV2,
self).get_network(context, new_port["network_id"])
if self.add_meta_server_route:
net["tenant_id"], net["id"],
new_port["id"], device_id)
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to create remote port: "
+ LOG.error(_("NeutronRestProxyV2: Unable to create remote port: "
"%s"), e.message)
- super(QuantumRestProxyV2, self).delete_port(context,
+ super(NeutronRestProxyV2, self).delete_port(context,
new_port["id"])
raise
# Set port state up and return that port
port_update = {"port": {"admin_state_up": True}}
- new_port = super(QuantumRestProxyV2, self).update_port(context,
+ new_port = super(NeutronRestProxyV2, self).update_port(context,
new_port["id"],
port_update)
return self._extend_port_dict_binding(context, new_port)
def get_port(self, context, id, fields=None):
with context.session.begin(subtransactions=True):
- port = super(QuantumRestProxyV2, self).get_port(context, id,
+ port = super(NeutronRestProxyV2, self).get_port(context, id,
fields)
self._extend_port_dict_binding(context, port)
return self._fields(port, fields)
def get_ports(self, context, filters=None, fields=None):
with context.session.begin(subtransactions=True):
- ports = super(QuantumRestProxyV2, self).get_ports(context, filters,
+ ports = super(NeutronRestProxyV2, self).get_ports(context, filters,
fields)
for port in ports:
self._extend_port_dict_binding(context, port)
def update_port(self, context, port_id, port):
"""Update values of a port.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the port to update.
:param port: dictionary with keys indicating fields to update.
:raises: exceptions.PortNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2: update_port() called"))
+ LOG.debug(_("NeutronRestProxyV2: update_port() called"))
self._warn_on_state_status(port['port'])
# Validate Args
- orig_port = super(QuantumRestProxyV2, self).get_port(context, port_id)
+ orig_port = super(NeutronRestProxyV2, self).get_port(context, port_id)
# Update DB
- new_port = super(QuantumRestProxyV2, self).update_port(context,
+ new_port = super(NeutronRestProxyV2, self).update_port(context,
port_id, port)
if (portbindings.HOST_ID in port['port']
and 'device_id' in port['port']):
new_port["id"], device_id)
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to create remote port: "
+ LOG.error(_("NeutronRestProxyV2: Unable to create remote port: "
"%s"), e.message)
# reset port to original state
- super(QuantumRestProxyV2, self).update_port(context, port_id,
+ super(NeutronRestProxyV2, self).update_port(context, port_id,
orig_port)
raise
def delete_port(self, context, port_id, l3_port_check=True):
"""Delete a port.
- :param context: quantum api request context
+ :param context: neutron api request context
:param id: UUID representing the port to delete.
:raises: exceptions.PortInUse
:raises: exceptions.NetworkNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2: delete_port() called"))
+ LOG.debug(_("NeutronRestProxyV2: delete_port() called"))
# if needed, check to see if this is a port owned by
# and l3-router. If so, we should prevent deletion.
self.prevent_l3_port_deletion(context, port_id)
self.disassociate_floatingips(context, port_id)
- super(QuantumRestProxyV2, self).delete_port(context, port_id)
+ super(NeutronRestProxyV2, self).delete_port(context, port_id)
def _delete_port(self, context, port_id):
# Delete from DB
- port = super(QuantumRestProxyV2, self).get_port(context, port_id)
+ port = super(NeutronRestProxyV2, self).get_port(context, port_id)
tenant_id = port['tenant_id']
if tenant_id == '':
- net = super(QuantumRestProxyV2,
+ net = super(NeutronRestProxyV2,
self).get_network(context, port['network_id'])
tenant_id = net['tenant_id']
if port.get("device_id"):
self._unplug_interface(context, tenant_id,
port["network_id"], port["id"])
- ret_val = super(QuantumRestProxyV2, self)._delete_port(context,
+ ret_val = super(NeutronRestProxyV2, self)._delete_port(context,
port_id)
return ret_val
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to update remote port: "
+ LOG.error(_("NeutronRestProxyV2: Unable to update remote port: "
"%s"), e.message)
raise
:raises: exceptions.PortNotFound
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2: _plug_interface() called"))
+ LOG.debug(_("NeutronRestProxyV2: _plug_interface() called"))
# update attachment on network controller
try:
- port = super(QuantumRestProxyV2, self).get_port(context, port_id)
+ port = super(NeutronRestProxyV2, self).get_port(context, port_id)
mac = port["mac_address"]
if mac is not None:
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2:Unable to update remote network: "
+ LOG.error(_("NeutronRestProxyV2:Unable to update remote network: "
"%s"), e.message)
raise
:raises: RemoteRestError
"""
- LOG.debug(_("QuantumRestProxyV2: _unplug_interface() called"))
+ LOG.debug(_("NeutronRestProxyV2: _unplug_interface() called"))
# delete from network ctrl. Remote error on delete is ignored
try:
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to update remote port: "
+ LOG.error(_("NeutronRestProxyV2: Unable to update remote port: "
"%s"), e.message)
def create_subnet(self, context, subnet):
- LOG.debug(_("QuantumRestProxyV2: create_subnet() called"))
+ LOG.debug(_("NeutronRestProxyV2: create_subnet() called"))
self._warn_on_state_status(subnet['subnet'])
# create subnet in DB
- new_subnet = super(QuantumRestProxyV2, self).create_subnet(context,
+ new_subnet = super(NeutronRestProxyV2, self).create_subnet(context,
subnet)
net_id = new_subnet['network_id']
- orig_net = super(QuantumRestProxyV2, self).get_network(context,
+ orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id)
# update network on network controller
try:
self._send_update_network(orig_net)
except RemoteRestError:
# rollback creation of subnet
- super(QuantumRestProxyV2, self).delete_subnet(context,
+ super(NeutronRestProxyV2, self).delete_subnet(context,
subnet['id'])
raise
return new_subnet
def update_subnet(self, context, id, subnet):
- LOG.debug(_("QuantumRestProxyV2: update_subnet() called"))
+ LOG.debug(_("NeutronRestProxyV2: update_subnet() called"))
self._warn_on_state_status(subnet['subnet'])
- orig_subnet = super(QuantumRestProxyV2, self)._get_subnet(context, id)
+ orig_subnet = super(NeutronRestProxyV2, self)._get_subnet(context, id)
# update subnet in DB
- new_subnet = super(QuantumRestProxyV2, self).update_subnet(context, id,
+ new_subnet = super(NeutronRestProxyV2, self).update_subnet(context, id,
subnet)
net_id = new_subnet['network_id']
- orig_net = super(QuantumRestProxyV2, self).get_network(context,
+ orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id)
# update network on network controller
try:
self._send_update_network(orig_net)
except RemoteRestError:
# rollback updation of subnet
- super(QuantumRestProxyV2, self).update_subnet(context, id,
+ super(NeutronRestProxyV2, self).update_subnet(context, id,
orig_subnet)
raise
return new_subnet
def delete_subnet(self, context, id):
- LOG.debug(_("QuantumRestProxyV2: delete_subnet() called"))
- orig_subnet = super(QuantumRestProxyV2, self).get_subnet(context, id)
+ LOG.debug(_("NeutronRestProxyV2: delete_subnet() called"))
+ orig_subnet = super(NeutronRestProxyV2, self).get_subnet(context, id)
net_id = orig_subnet['network_id']
# delete subnet in DB
- super(QuantumRestProxyV2, self).delete_subnet(context, id)
- orig_net = super(QuantumRestProxyV2, self).get_network(context,
+ super(NeutronRestProxyV2, self).delete_subnet(context, id)
+ orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id)
# update network on network controller
try:
return defaultset
def create_router(self, context, router):
- LOG.debug(_("QuantumRestProxyV2: create_router() called"))
+ LOG.debug(_("NeutronRestProxyV2: create_router() called"))
self._warn_on_state_status(router['router'])
router['router']['router_rules'] = rules
# create router in DB
- new_router = super(QuantumRestProxyV2, self).create_router(context,
+ new_router = super(NeutronRestProxyV2, self).create_router(context,
router)
# create router on the network controller
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to create remote router: "
+ LOG.error(_("NeutronRestProxyV2: Unable to create remote router: "
"%s"), e.message)
- super(QuantumRestProxyV2, self).delete_router(context,
+ super(NeutronRestProxyV2, self).delete_router(context,
new_router['id'])
raise
def update_router(self, context, router_id, router):
- LOG.debug(_("QuantumRestProxyV2.update_router() called"))
+ LOG.debug(_("NeutronRestProxyV2.update_router() called"))
self._warn_on_state_status(router['router'])
- orig_router = super(QuantumRestProxyV2, self).get_router(context,
+ orig_router = super(NeutronRestProxyV2, self).get_router(context,
router_id)
tenant_id = orig_router["tenant_id"]
- new_router = super(QuantumRestProxyV2, self).update_router(context,
+ new_router = super(NeutronRestProxyV2, self).update_router(context,
router_id,
router)
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to update remote router: "
+ LOG.error(_("NeutronRestProxyV2: Unable to update remote router: "
"%s"), e.message)
# reset router to original state
- super(QuantumRestProxyV2, self).update_router(context,
+ super(NeutronRestProxyV2, self).update_router(context,
router_id,
orig_router)
raise
return new_router
def delete_router(self, context, router_id):
- LOG.debug(_("QuantumRestProxyV2: delete_router() called"))
+ LOG.debug(_("NeutronRestProxyV2: delete_router() called"))
with context.session.begin(subtransactions=True):
orig_router = self._get_router(context, router_id)
ret = self.servers.delete(resource)
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
- ret_val = super(QuantumRestProxyV2, self).delete_router(context,
+ ret_val = super(NeutronRestProxyV2, self).delete_router(context,
router_id)
return ret_val
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to delete remote router: "
+ LOG.error(_("NeutronRestProxyV2: Unable to delete remote router: "
"%s"), e.message)
raise
def add_router_interface(self, context, router_id, interface_info):
- LOG.debug(_("QuantumRestProxyV2: add_router_interface() called"))
+ LOG.debug(_("NeutronRestProxyV2: add_router_interface() called"))
# Validate args
router = self._get_router(context, router_id)
tenant_id = router['tenant_id']
# create interface in DB
- new_interface_info = super(QuantumRestProxyV2,
+ new_interface_info = super(NeutronRestProxyV2,
self).add_router_interface(context,
router_id,
interface_info)
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to create interface: "
+ LOG.error(_("NeutronRestProxyV2: Unable to create interface: "
"%s"), e.message)
- super(QuantumRestProxyV2,
+ super(NeutronRestProxyV2,
self).remove_router_interface(context, router_id,
interface_info)
raise
def remove_router_interface(self, context, router_id, interface_info):
- LOG.debug(_("QuantumRestProxyV2: remove_router_interface() called"))
+ LOG.debug(_("NeutronRestProxyV2: remove_router_interface() called"))
# Validate args
router = self._get_router(context, router_id)
raise exceptions.BadRequest(resource='router', msg=msg)
# remove router in DB
- del_intf_info = super(QuantumRestProxyV2,
+ del_intf_info = super(NeutronRestProxyV2,
self).remove_router_interface(context,
router_id,
interface_info)
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2:Unable to delete remote intf: "
+ LOG.error(_("NeutronRestProxyV2:Unable to delete remote intf: "
"%s"), e.message)
raise
return del_intf_info
def create_floatingip(self, context, floatingip):
- LOG.debug(_("QuantumRestProxyV2: create_floatingip() called"))
+ LOG.debug(_("NeutronRestProxyV2: create_floatingip() called"))
# create floatingip in DB
- new_fl_ip = super(QuantumRestProxyV2,
+ new_fl_ip = super(NeutronRestProxyV2,
self).create_floatingip(context, floatingip)
net_id = new_fl_ip['floating_network_id']
- orig_net = super(QuantumRestProxyV2, self).get_network(context,
+ orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id)
# create floatingip on the network controller
try:
self._send_update_network(orig_net)
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to create remote "
+ LOG.error(_("NeutronRestProxyV2: Unable to create remote "
"floatin IP: %s"), e.message)
- super(QuantumRestProxyV2, self).delete_floatingip(context,
+ super(NeutronRestProxyV2, self).delete_floatingip(context,
floatingip)
raise
return new_fl_ip
def update_floatingip(self, context, id, floatingip):
- LOG.debug(_("QuantumRestProxyV2: update_floatingip() called"))
+ LOG.debug(_("NeutronRestProxyV2: update_floatingip() called"))
- orig_fl_ip = super(QuantumRestProxyV2, self).get_floatingip(context,
+ orig_fl_ip = super(NeutronRestProxyV2, self).get_floatingip(context,
id)
# update floatingip in DB
- new_fl_ip = super(QuantumRestProxyV2,
+ new_fl_ip = super(NeutronRestProxyV2,
self).update_floatingip(context, id, floatingip)
net_id = new_fl_ip['floating_network_id']
- orig_net = super(QuantumRestProxyV2, self).get_network(context,
+ orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id)
# update network on network controller
try:
self._send_update_network(orig_net)
except RemoteRestError:
# rollback updation of subnet
- super(QuantumRestProxyV2, self).update_floatingip(context, id,
+ super(NeutronRestProxyV2, self).update_floatingip(context, id,
orig_fl_ip)
raise
return new_fl_ip
def delete_floatingip(self, context, id):
- LOG.debug(_("QuantumRestProxyV2: delete_floatingip() called"))
+ LOG.debug(_("NeutronRestProxyV2: delete_floatingip() called"))
- orig_fl_ip = super(QuantumRestProxyV2, self).get_floatingip(context,
+ orig_fl_ip = super(NeutronRestProxyV2, self).get_floatingip(context,
id)
# delete floating IP in DB
net_id = orig_fl_ip['floating_network_id']
- super(QuantumRestProxyV2, self).delete_floatingip(context, id)
+ super(NeutronRestProxyV2, self).delete_floatingip(context, id)
- orig_net = super(QuantumRestProxyV2, self).get_network(context,
+ orig_net = super(NeutronRestProxyV2, self).get_network(context,
net_id)
# update network on network controller
try:
"""Pushes all data to network ctrl (networks/ports, ports/attachments).
This gives the controller an option to re-sync it's persistent store
- with quantum's current view of that data.
+ with neutron's current view of that data.
"""
admin_context = qcontext.get_admin_context()
networks = []
routers = []
- all_networks = super(QuantumRestProxyV2,
+ all_networks = super(NeutronRestProxyV2,
self).get_networks(admin_context) or []
for net in all_networks:
mapped_network = self._get_mapped_network_with_subnets(net)
ports = []
net_filter = {'network_id': [net.get('id')]}
- net_ports = super(QuantumRestProxyV2,
+ net_ports = super(NeutronRestProxyV2,
self).get_ports(admin_context,
filters=net_filter) or []
for port in net_ports:
networks.append(net_fl_ips)
- all_routers = super(QuantumRestProxyV2,
+ all_routers = super(NeutronRestProxyV2,
self).get_routers(admin_context) or []
for router in all_routers:
interfaces = []
'device_owner': ["network:router_interface"],
'device_id': [router.get('id')]
}
- router_ports = super(QuantumRestProxyV2,
+ router_ports = super(NeutronRestProxyV2,
self).get_ports(admin_context,
filters=router_filter) or []
for port in router_ports:
raise RemoteRestError(ret[2])
return ret
except RemoteRestError as e:
- LOG.error(_('QuantumRestProxy: Unable to update remote '
+ LOG.error(_('NeutronRestProxy: Unable to update remote '
'topology: %s'), e.message)
raise
net_id = network['id']
net_filter = {'floating_network_id': [net_id]}
- fl_ips = super(QuantumRestProxyV2,
+ fl_ips = super(NeutronRestProxyV2,
self).get_floatingips(admin_context,
filters=net_filter) or []
network['floatingips'] = fl_ips
if not self.servers.action_success(ret):
raise RemoteRestError(ret[2])
except RemoteRestError as e:
- LOG.error(_("QuantumRestProxyV2: Unable to update remote "
+ LOG.error(_("NeutronRestProxyV2: Unable to update remote "
"network: %s"), e.message)
raise
# we will use the network id as interface's id
net_id = intf_id
- network = super(QuantumRestProxyV2, self).get_network(context,
+ network = super(NeutronRestProxyV2, self).get_network(context,
net_id)
- subnet = super(QuantumRestProxyV2, self).get_subnet(context,
+ subnet = super(NeutronRestProxyV2, self).get_subnet(context,
subnet_id)
mapped_network = self._get_mapped_network_with_subnets(network)
mapped_subnet = self._map_state_and_status(subnet)
import sqlalchemy as sa
from sqlalchemy import orm
-from quantum.db import l3_db
-from quantum.db import model_base
-from quantum.openstack.common import log as logging
-from quantum.plugins.bigswitch.extensions import routerrule
+from neutron.db import l3_db
+from neutron.db import model_base
+from neutron.openstack.common import log as logging
+from neutron.plugins.bigswitch.extensions import routerrule
LOG = logging.getLogger(__name__)
"""Test server mocking a REST based network ctrl.
-Used for QuantumRestProxy tests
+Used for NeutronRestProxy tests
"""
import json
#
# @author: Sumit Naiksatam, sumitnaiksatam@gmail.com
#
-version_info = {'branch_nick': u'quantum/trunk',
+version_info = {'branch_nick': u'neutron/trunk',
'revision_id': u'1',
'revno': 0}
-QUANTUMRESTPROXY_VERSION = ['2013', '1', None]
+NEUTRONRESTPROXY_VERSION = ['2013', '1', None]
FINAL = False # This becomes true at Release Candidate time
# Based on openstack generic code
# @author: Mandeep Dhami, Big Switch Networks, Inc.
-"""Determine version of QuantumRestProxy plugin"""
+"""Determine version of NeutronRestProxy plugin"""
# if vcsversion exists, use it. Else, use LOCALBRANCH:LOCALREVISION
try:
- from quantum.plugins.bigswitch.vcsversion import version_info
+ from neutron.plugins.bigswitch.vcsversion import version_info
except ImportError:
version_info = {'branch_nick': u'LOCALBRANCH',
'revision_id': u'LOCALREVISION',
'revno': 0}
try:
- from quantum.plugins.bigswitch.vcsversion import QUANTUMRESTPROXY_VERSION
+ from neutron.plugins.bigswitch.vcsversion import NeutronRestPROXY_VERSION
except ImportError:
- QUANTUMRESTPROXY_VERSION = ['2013', '1', None]
+ NeutronRestPROXY_VERSION = ['2013', '1', None]
try:
- from quantum.plugins.bigswitch.vcsversion import FINAL
+ from neutron.plugins.bigswitch.vcsversion import FINAL
except ImportError:
FINAL = False # This becomes true at Release Candidate time
-YEAR, COUNT, REVISION = QUANTUMRESTPROXY_VERSION
+YEAR, COUNT, REVISION = NeutronRestPROXY_VERSION
def canonical_version_string():
- return '.'.join(filter(None, QUANTUMRESTPROXY_VERSION))
+ return '.'.join(filter(None, NeutronRestPROXY_VERSION))
def version_string():
# TODO(shiv) need support for security groups
-"""Implentation of Brocade Quantum Plugin."""
+"""Implentation of Brocade Neutron Plugin."""
from oslo.config import cfg
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.rpc.agentnotifiers import l3_rpc_agent_api
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.common import utils
-from quantum.db import agents_db
-from quantum.db import agentschedulers_db
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import dhcp_rpc_base
-from quantum.db import extraroute_db
-from quantum.db import l3_rpc_base
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.extensions import portbindings
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import context
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.brocade.db import models as brocade_db
-from quantum.plugins.brocade import vlanbm as vbm
-from quantum import scheduler
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.common import utils
+from neutron.db import agents_db
+from neutron.db import agentschedulers_db
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import dhcp_rpc_base
+from neutron.db import extraroute_db
+from neutron.db import l3_rpc_base
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.extensions import portbindings
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import context
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.brocade.db import models as brocade_db
+from neutron.plugins.brocade import vlanbm as vbm
+from neutron import scheduler
LOG = logging.getLogger(__name__)
PLUGIN_VERSION = 0.88
AGENT_OWNER_PREFIX = "network:"
-NOS_DRIVER = 'quantum.plugins.brocade.nos.nosdriver.NOSdriver'
+NOS_DRIVER = 'neutron.plugins.brocade.nos.nosdriver.NOSdriver'
SWITCH_OPTS = [cfg.StrOpt('address', default=''),
cfg.StrOpt('username', default=''),
# an argument to this function;
#
# need to be fixed in:
- # file: quantum/db/securtygroups_rpc_base.py
+ # file: neutron/db/securtygroups_rpc_base.py
# function: securitygroup_rules_for_devices()
# which needs to pass context to us
topic=self.topic_port_update)
-class BrocadePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
extraroute_db.ExtraRoute_db_mixin,
sg_db_rpc.SecurityGroupServerRpcMixin,
agentschedulers_db.AgentSchedulerDbMixin):
- """BrocadePluginV2 is a Quantum plugin.
+ """BrocadePluginV2 is a Neutron plugin.
Provides L2 Virtual Network functionality using VDX. Upper
layer driver class that interfaces to NETCONF layer below.
self._vlan_bitmap = vbm.VlanBitmap(self.ctxt)
self._setup_rpc()
self.network_scheduler = importutils.import_object(
- cfg.CONF.network_scheduler_driver)
+ cfg.CONF.network_scheduler_driver
+ )
self.router_scheduler = importutils.import_object(
- cfg.CONF.router_scheduler_driver)
+ cfg.CONF.router_scheduler_driver
+ )
self.brocade_init()
def brocade_init(self):
def _setup_rpc(self):
# RPC support
self.topic = topics.PLUGIN
- self.rpc_context = context.RequestContext('quantum', 'quantum',
+ self.rpc_context = context.RequestContext('neutron', 'neutron',
is_admin=False)
self.conn = rpc.create_connection(new=True)
self.callbacks = BridgeRpcCallbacks()
bnet = brocade_db.get_network(context, network_id)
vlan_id = bnet['vlan']
- quantum_port = super(BrocadePluginV2, self).create_port(context,
+ neutron_port = super(BrocadePluginV2, self).create_port(context,
port)
- interface_mac = quantum_port['mac_address']
- port_id = quantum_port['id']
+ interface_mac = neutron_port['mac_address']
+ port_id = neutron_port['id']
switch = self._switch
vlan_id, tenant_id, admin_state_up)
# apply any extensions
- return self._extend_port_dict_binding(context, quantum_port)
+ return self._extend_port_dict_binding(context, neutron_port)
def delete_port(self, context, port_id):
with context.session.begin(subtransactions=True):
-Brocade Openstack Quantum Plugin
+Brocade Openstack Neutron Plugin
================================
* up-to-date version of these instructions are located at:
- http://wiki.openstack.org/brocade-quantum-plugin
+ http://wiki.openstack.org/brocade-neutron-plugin
* N.B.: Please see Prerequisites section regarding ncclient (netconf client library)
* Supports VCS (Virtual Cluster of Switches)
-Openstack Brocade Quantum Plugin implements the Quantum v2.0 API.
+Openstack Brocade Neutron Plugin implements the Neutron v2.0 API.
This plugin is meant to orchestrate Brocade VCS switches running NOS, examples of these are:
1. VDX 67xx series of switches
2. VDX 87xx series of switches
-Brocade Quantum plugin implements the Quantum v2.0 API. It uses NETCONF at the backend
+Brocade Neutron plugin implements the Neutron v2.0 API. It uses NETCONF at the backend
to configure the Brocade switch.
+------------+ +------------+ +-------------+
| | | | | |
| | | | | Brocade |
| Openstack | v2.0 | Brocade | NETCONF | VCS Switch |
- | Quantum +--------+ Quantum +----------+ |
+ | Neutron +--------+ Neutron +----------+ |
| | | Plugin | | VDX 67xx |
| | | | | VDX 87xx |
| | | | | |
/opt/stack/nova/
/opt/stack/horizon/
...
- /opt/stack/quantum/quantum/plugins/
+ /opt/stack/neutron/neutron/plugins/
Within this structure, Brocade plugin resides at:
- /opt/stack/quantum/quantum/plugins/brocade
+ /opt/stack/neutron/neutron/plugins/brocade
Prerequsites
Configuration
=============
-1. Specify to Quantum that you will be using the Brocade Plugin - this is done
-by setting the parameter core_plugin in Quantum:
+1. Specify to Neutron that you will be using the Brocade Plugin - this is done
+by setting the parameter core_plugin in Neutron:
- core_plugin = quantum.plugins.brocade.QuantumPlugin.BrocadePluginV2
+ core_plugin = neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2
2. Physical switch configuration parameters and Brocade specific database configuration is specified in
the configuration file specified in the brocade.ini files:
- % cat /etc/quantum/plugins/brocade/brocade.ini
+ % cat /etc/neutron/plugins/brocade/brocade.ini
[SWITCH]
username = admin
password = password
ostype = NOS
[database]
- connection = mysql://root:pass@localhost/brocade_quantum?charset=utf8
+ connection = mysql://root:pass@localhost/brocade_neutron?charset=utf8
(please see list of more configuration parameters in the brocade.ini file)
================
Running setup.py with appropriate permissions will copy the default configuration
-file to /etc/quantum/plugins/brocade/brocade.ini. This file MUST be edited to
+file to /etc/neutron/plugins/brocade/brocade.ini. This file MUST be edited to
suit your setup/environment.
- % cd /opt/stack/quantum/quantum/plugins/brocade
+ % cd /opt/stack/neutron/neutron/plugins/brocade
% python setup.py
========
Please see special notes for devstack at:
-http://wiki.openstack.org/brocade-quantum-plugin
+http://wiki.openstack.org/brocade-neutron-plugin
-In order to use Brocade Quantum Plugin, add the following lines in localrc, if localrc file doe
+In order to use Brocade Neutron Plugin, add the following lines in localrc, if localrc file doe
not exist create one:
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,quantum,q-svc,q-agt
As part of running devstack/stack.sh, the configuration files is copied as:
- % cp /opt/stack/quantum/etc/quantum/plugins/brocade/brocade.ini /etc/quantum/plugins/brocade/brocade.ini
+ % cp /opt/stack/neutron/etc/neutron/plugins/brocade/brocade.ini /etc/neutron/plugins/brocade/brocade.ini
(hence it is important to make any changes to the configuration in:
-/opt/stack/quantum/etc/quantum/plugins/brocade/brocade.ini)
+/opt/stack/neutron/etc/neutron/plugins/brocade/brocade.ini)
import sqlalchemy as sa
-from quantum.db import model_base
-from quantum.db import models_v2
+from neutron.db import model_base
+from neutron.db import models_v2
class BrocadeNetwork(model_base.BASEV2, models_v2.HasId):
"""FAKE DRIVER, for unit tests purposes.
Brocade NOS Driver implements NETCONF over SSHv2 for
-Quantum network life-cycle management.
+Neutron network life-cycle management.
"""
class NOSdriver():
- """NOS NETCONF interface driver for Quantum network.
+ """NOS NETCONF interface driver for Neutron network.
- Fake: Handles life-cycle management of Quantum network,
+ Fake: Handles life-cycle management of Neutron network,
leverages AMPP on NOS
(for use by unit tests, avoids touching any hardware)
"""
# Constants
#
-# Port profile naming convention for Quantum networks
+# Port profile naming convention for Neutron networks
OS_PORT_PROFILE_NAME = "openstack-profile-{id}"
# Port profile filter expressions
"""Brocade NOS Driver implements NETCONF over SSHv2 for
-Quantum network life-cycle management.
+Neutron network life-cycle management.
"""
from ncclient import manager
-from quantum.openstack.common import log as logging
-from quantum.plugins.brocade.nos import nctemplates as template
+from neutron.openstack.common import log as logging
+from neutron.plugins.brocade.nos import nctemplates as template
LOG = logging.getLogger(__name__)
class NOSdriver():
- """NOS NETCONF interface driver for Quantum network.
+ """NOS NETCONF interface driver for Neutron network.
- Handles life-cycle management of Quantum network (leverages AMPP on NOS)
+ Handles life-cycle management of Neutron network (leverages AMPP on NOS)
"""
def __init__(self):
-Start the quantum-server with IP address of switch configured in brocade.ini:
+Start the neutron-server with IP address of switch configured in brocade.ini:
(for configuration instruction please see README.md in the above directory)
nostest.py:
This tests two things:
- 1. Creates port-profile on the physical switch when a quantum 'network' is created
+ 1. Creates port-profile on the physical switch when a neutron 'network' is created
2. Associates the MAC address with the created port-profile
noscli.py:
import argparse
-from quantum.openstack.common import log as logging
-from quantum.plugins.brocade.nos import nosdriver as nos
+from neutron.openstack.common import log as logging
+from neutron.plugins.brocade.nos import nosdriver as nos
LOG = logging.getLogger(__name__)
"""Brocade NOS Driver Test."""
import sys
-from quantum.plugins.brocade.nos import nosdriver as nos
+from neutron.plugins.brocade.nos import nosdriver as nos
def nostest(host, username, password):
# Driver
driver = nos.NOSdriver()
- # Quantum operations
+ # Neutron operations
vlan = 1001
mac = '0050.56bf.0001'
driver.create_network(host, username, password, vlan)
"""A Vlan Bitmap class to handle allocation/de-allocation of vlan ids."""
-from quantum.common import constants
-from quantum.plugins.brocade.db import models as brocade_db
+from neutron.common import constants
+from neutron.plugins.brocade.db import models as brocade_db
MIN_VLAN = constants.MIN_VLAN_TAG + 1
--- /dev/null
+Cisco Neutron Virtual Network Plugin
+
+This plugin implements Neutron v2 APIs and helps configure
+topologies consisting of virtual and physical switches.
+
+For more details on use please refer to:
+http://wiki.openstack.org/cisco-neutron
import logging as LOG
-from quantum.plugins.cisco.common import cisco_constants as const
-from quantum.plugins.cisco.common import cisco_exceptions as cexc
-from quantum.plugins.cisco.common import config
-from quantum.plugins.cisco.db import network_db_v2 as cdb
+from neutron.plugins.cisco.common import cisco_constants as const
+from neutron.plugins.cisco.common import cisco_exceptions as cexc
+from neutron.plugins.cisco.common import config
+from neutron.plugins.cisco.db import network_db_v2 as cdb
LOG.basicConfig(level=LOG.WARN)
"""Exceptions used by the Cisco plugin."""
-from quantum.common import exceptions
+from neutron.common import exceptions
-class NetworkSegmentIDNotFound(exceptions.QuantumException):
+class NetworkSegmentIDNotFound(exceptions.NeutronException):
"""Segmentation ID for network is not found."""
message = _("Segmentation ID for network %(net_id)s is not found.")
-class NoMoreNics(exceptions.QuantumException):
+class NoMoreNics(exceptions.NeutronException):
"""No more dynamic nics are available in the system."""
message = _("Unable to complete operation. No more dynamic nics are "
"available in the system.")
-class NetworkVlanBindingAlreadyExists(exceptions.QuantumException):
+class NetworkVlanBindingAlreadyExists(exceptions.NeutronException):
"""Binding cannot be created, since it already exists."""
message = _("NetworkVlanBinding for %(vlan_id)s and network "
"%(network_id)s already exists")
-class VlanIDNotFound(exceptions.QuantumException):
+class VlanIDNotFound(exceptions.NeutronException):
"""VLAN ID cannot be found."""
message = _("Vlan ID %(vlan_id)s not found")
-class VlanIDNotAvailable(exceptions.QuantumException):
+class VlanIDNotAvailable(exceptions.NeutronException):
"""No VLAN ID available."""
message = _("No Vlan ID available")
-class QosNotFound(exceptions.QuantumException):
+class QosNotFound(exceptions.NeutronException):
"""QoS level with this ID cannot be found."""
message = _("QoS level %(qos_id)s could not be found "
"for tenant %(tenant_id)s")
-class QosNameAlreadyExists(exceptions.QuantumException):
+class QosNameAlreadyExists(exceptions.NeutronException):
"""QoS Name already exists."""
message = _("QoS level with name %(qos_name)s already exists "
"for tenant %(tenant_id)s")
-class CredentialNotFound(exceptions.QuantumException):
+class CredentialNotFound(exceptions.NeutronException):
"""Credential with this ID cannot be found."""
message = _("Credential %(credential_id)s could not be found "
"for tenant %(tenant_id)s")
-class CredentialNameNotFound(exceptions.QuantumException):
+class CredentialNameNotFound(exceptions.NeutronException):
"""Credential Name could not be found."""
message = _("Credential %(credential_name)s could not be found "
"for tenant %(tenant_id)s")
-class CredentialAlreadyExists(exceptions.QuantumException):
+class CredentialAlreadyExists(exceptions.NeutronException):
"""Credential ID already exists."""
message = _("Credential %(credential_id)s already exists "
"for tenant %(tenant_id)s")
-class NexusComputeHostNotConfigured(exceptions.QuantumException):
+class NexusComputeHostNotConfigured(exceptions.NeutronException):
"""Connection to compute host is not configured."""
message = _("Connection to %(host)s is not configured.")
-class NexusConnectFailed(exceptions.QuantumException):
+class NexusConnectFailed(exceptions.NeutronException):
"""Failed to connect to Nexus switch."""
message = _("Unable to connect to Nexus %(nexus_host)s. Reason: %(exc)s.")
-class NexusConfigFailed(exceptions.QuantumException):
+class NexusConfigFailed(exceptions.NeutronException):
"""Failed to configure Nexus switch."""
message = _("Failed to configure Nexus: %(config)s. Reason: %(exc)s.")
-class NexusPortBindingNotFound(exceptions.QuantumException):
+class NexusPortBindingNotFound(exceptions.NeutronException):
"""NexusPort Binding is not present."""
message = _("Nexus Port Binding (%(filters)s) is not present")
super(NexusPortBindingNotFound, self).__init__(filters=filters)
-class NoNexusSviSwitch(exceptions.QuantumException):
+class NoNexusSviSwitch(exceptions.NeutronException):
"""No usable nexus switch found."""
message = _("No usable Nexus switch found to create SVI interface")
-class PortVnicBindingAlreadyExists(exceptions.QuantumException):
+class PortVnicBindingAlreadyExists(exceptions.NeutronException):
"""PortVnic Binding already exists."""
message = _("PortVnic Binding %(port_id)s already exists")
-class PortVnicNotFound(exceptions.QuantumException):
+class PortVnicNotFound(exceptions.NeutronException):
"""PortVnic Binding is not present."""
message = _("PortVnic Binding %(port_id)s is not present")
-class SubnetNotSpecified(exceptions.QuantumException):
+class SubnetNotSpecified(exceptions.NeutronException):
"""Subnet id not specified."""
message = _("No subnet_id specified for router gateway")
-class SubnetInterfacePresent(exceptions.QuantumException):
+class SubnetInterfacePresent(exceptions.NeutronException):
"""Subnet SVI interface already exists."""
message = _("Subnet %(subnet_id)s has an interface on %(router_id)s")
-class PortIdForNexusSvi(exceptions.QuantumException):
+class PortIdForNexusSvi(exceptions.NeutronException):
"""Port Id specified for Nexus SVI."""
message = _('Nexus hardware router gateway only uses Subnet Ids')
import webob.dec
-from quantum import wsgi
+from neutron import wsgi
class Fault(webob.exc.HTTPException):
"""
# Replace the body with fault details.
code = self.wrapped_exc.status_int
- fault_name = self._fault_names.get(code, "quantumServiceFault")
+ fault_name = self._fault_names.get(code, "neutronServiceFault")
fault_data = {
fault_name: {
'code': code,
import hashlib
import logging
-from quantum.plugins.cisco.common import cisco_constants as const
+from neutron.plugins.cisco.common import cisco_constants as const
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.agent.common import config
+from neutron.agent.common import config
cisco_plugins_opts = [
cfg.StrOpt('vswitch_plugin',
- default='quantum.plugins.openvswitch.ovs_quantum_plugin.'
- 'OVSQuantumPluginV2',
+ default='neutron.plugins.openvswitch.ovs_neutron_plugin.'
+ 'OVSNeutronPluginV2',
help=_("Virtual Switch to use")),
cfg.StrOpt('nexus_plugin',
- default='quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.'
+ default='neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.'
'NexusPlugin',
help=_("Nexus Switch to use")),
]
cfg.BoolOpt('svi_round_robin', default=False,
help=_("Distribute SVI interfaces over all switches")),
cfg.StrOpt('model_class',
- default='quantum.plugins.cisco.models.virt_phy_sw_v2.'
+ default='neutron.plugins.cisco.models.virt_phy_sw_v2.'
'VirtualPhysicalSwitchModelV2',
help=_("Model Class")),
cfg.StrOpt('manager_class',
- default='quantum.plugins.cisco.segmentation.'
+ default='neutron.plugins.cisco.segmentation.'
'l2network_vlan_mgr_v2.L2NetworkVLANMgr',
help=_("Manager Class")),
cfg.StrOpt('nexus_driver',
- default='quantum.plugins.cisco.test.nexus.'
+ default='neutron.plugins.cisco.test.nexus.'
'fake_nexus_driver.CiscoNEXUSFakeDriver',
help=_("Nexus Driver Name")),
]
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, exc, joinedload
-from quantum.common import constants
-from quantum.common import exceptions as q_exc
-from quantum.plugins.cisco.db import models
+from neutron.common import constants
+from neutron.common import exceptions as q_exc
+from neutron.plugins.cisco.db import models
_ENGINE = None
_MAKER = None
from sqlalchemy.orm import exc
-from quantum.common import exceptions as q_exc
-from quantum.openstack.common import log as logging
-from quantum.plugins.cisco.common import cisco_exceptions as c_exc
-from quantum.plugins.cisco.common import config
-from quantum.plugins.cisco.db import l2network_models
+from neutron.common import exceptions as q_exc
+from neutron.openstack.common import log as logging
+from neutron.plugins.cisco.common import cisco_exceptions as c_exc
+from neutron.plugins.cisco.common import config
+from neutron.plugins.cisco.db import l2network_models
-import quantum.plugins.cisco.db.api as db
+import neutron.plugins.cisco.db.api as db
LOG = logging.getLogger(__name__)
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.orm import object_mapper
-from quantum.openstack.common import uuidutils
-from quantum.plugins.cisco.db.models import BASE
+from neutron.openstack.common import uuidutils
+from neutron.plugins.cisco.db.models import BASE
class L2NetworkBase(object):
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relation, object_mapper
-from quantum.openstack.common import uuidutils
+from neutron.openstack.common import uuidutils
BASE = declarative_base()
-class QuantumBase(object):
- """Base class for Quantum Models."""
+class NeutronBase(object):
+ """Base class for Neutron Models."""
__table_args__ = {'mysql_engine': 'InnoDB'}
return local.iteritems()
-class Port(BASE, QuantumBase):
- """Represents a port on a quantum network."""
+class Port(BASE, NeutronBase):
+ """Represents a port on a neutron network."""
__tablename__ = 'ports'
self.state, self.interface_id)
-class Network(BASE, QuantumBase):
- """Represents a quantum network."""
+class Network(BASE, NeutronBase):
+ """Represents a neutron network."""
__tablename__ = 'networks'
from sqlalchemy.orm import exc
-from quantum.db import api as db
-from quantum.openstack.common import log as logging
-from quantum.plugins.cisco.common import cisco_exceptions as c_exc
-from quantum.plugins.cisco.common import config
-from quantum.plugins.cisco.db import network_models_v2
-from quantum.plugins.cisco.db import nexus_models_v2 # noqa
-from quantum.plugins.openvswitch import ovs_models_v2
+from neutron.db import api as db
+from neutron.openstack.common import log as logging
+from neutron.plugins.cisco.common import cisco_exceptions as c_exc
+from neutron.plugins.cisco.common import config
+from neutron.plugins.cisco.db import network_models_v2
+from neutron.plugins.cisco.db import nexus_models_v2 # noqa
+from neutron.plugins.openvswitch import ovs_models_v2
LOG = logging.getLogger(__name__)
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.orm import object_mapper
-from quantum.db import model_base
-from quantum.db import models_v2 as models # noqa
-from quantum.openstack.common import uuidutils
+from neutron.db import model_base
+from neutron.db import models_v2 as models # noqa
+from neutron.openstack.common import uuidutils
class L2NetworkBase(object):
from sqlalchemy.orm import exc
-import quantum.db.api as db
-from quantum.openstack.common import log as logging
-from quantum.plugins.cisco.common import cisco_exceptions as c_exc
-from quantum.plugins.cisco.db import nexus_models_v2
+import neutron.db.api as db
+from neutron.openstack.common import log as logging
+from neutron.plugins.cisco.common import cisco_exceptions as c_exc
+from neutron.plugins.cisco.db import nexus_models_v2
LOG = logging.getLogger(__name__)
from sqlalchemy import Column, Integer, String
-from quantum.db import model_base
-from quantum.plugins.cisco.db.l2network_models import L2NetworkBase
+from neutron.db import model_base
+from neutron.plugins.cisco.db.l2network_models import L2NetworkBase
class NexusPortBinding(model_base.BASEV2, L2NetworkBase):
class ViewBuilder(object):
- """ViewBuilder for Credential, derived from quantum.views.networks."""
+ """ViewBuilder for Credential, derived from neutron.views.networks."""
def __init__(self, base_url):
"""Initialize builder.
class ViewBuilder(object):
- """ViewBuilder for QoS, derived from quantum.views.networks."""
+ """ViewBuilder for QoS, derived from neutron.views.networks."""
def __init__(self, base_url):
"""Initialize builder.
from webob import exc
-from quantum.api import api_common as common
-from quantum.api import extensions
-from quantum.manager import QuantumManager
-from quantum.plugins.cisco.common import cisco_exceptions as exception
-from quantum.plugins.cisco.common import cisco_faults as faults
-from quantum.plugins.cisco.extensions import (_credential_view as
+from neutron.api import api_common as common
+from neutron.api import extensions
+from neutron.manager import NeutronManager
+from neutron.plugins.cisco.common import cisco_exceptions as exception
+from neutron.plugins.cisco.common import cisco_faults as faults
+from neutron.plugins.cisco.extensions import (_credential_view as
credential_view)
-from quantum import wsgi
+from neutron import wsgi
class Credential(extensions.ExtensionDescriptor):
"""Returns Ext Resources."""
parent_resource = dict(member_name="tenant",
collection_name="extensions/csco/tenants")
- controller = CredentialController(QuantumManager.get_plugin())
+ controller = CredentialController(NeutronManager.get_plugin())
return [extensions.ResourceExtension('credentials', controller,
parent=parent_resource)]
-class CredentialController(common.QuantumController, wsgi.Controller):
- """Credential API controller based on QuantumController."""
+class CredentialController(common.NeutronController, wsgi.Controller):
+ """Credential API controller based on NeutronController."""
_credential_ops_param_list = [
{'param-name': 'credential_name', 'required': True},
from webob import exc
-from quantum.api import api_common as common
-from quantum.api import extensions
-from quantum.manager import QuantumManager
-from quantum.plugins.cisco.common import cisco_exceptions as exception
-from quantum.plugins.cisco.common import cisco_faults as faults
-from quantum.plugins.cisco.extensions import _qos_view as qos_view
-from quantum import wsgi
+from neutron.api import api_common as common
+from neutron.api import extensions
+from neutron.manager import NeutronManager
+from neutron.plugins.cisco.common import cisco_exceptions as exception
+from neutron.plugins.cisco.common import cisco_faults as faults
+from neutron.plugins.cisco.extensions import _qos_view as qos_view
+from neutron import wsgi
class Qos(extensions.ExtensionDescriptor):
parent_resource = dict(member_name="tenant",
collection_name="extensions/csco/tenants")
- controller = QosController(QuantumManager.get_plugin())
+ controller = QosController(NeutronManager.get_plugin())
return [extensions.ResourceExtension('qoss', controller,
parent=parent_resource)]
-class QosController(common.QuantumController, wsgi.Controller):
- """qos API controller based on QuantumController."""
+class QosController(common.NeutronController, wsgi.Controller):
+ """qos API controller based on NeutronController."""
_qos_ops_param_list = [
{'param-name': 'qos_name', 'required': True},
from novaclient.v1_1 import client as nova_client
from oslo.config import cfg
-from quantum.db import api as db_api
-from quantum.openstack.common import importutils
-from quantum.plugins.cisco.common import cisco_constants as const
-from quantum.plugins.cisco.common import cisco_credentials_v2 as cred
-from quantum.plugins.cisco.common import cisco_exceptions as cexc
-from quantum.plugins.cisco.common import config as conf
-from quantum.plugins.cisco.db import network_db_v2 as cdb
-from quantum.plugins.openvswitch import ovs_db_v2 as odb
-from quantum import quantum_plugin_base_v2
+from neutron.db import api as db_api
+from neutron import neutron_plugin_base_v2
+from neutron.openstack.common import importutils
+from neutron.plugins.cisco.common import cisco_constants as const
+from neutron.plugins.cisco.common import cisco_credentials_v2 as cred
+from neutron.plugins.cisco.common import cisco_exceptions as cexc
+from neutron.plugins.cisco.common import config as conf
+from neutron.plugins.cisco.db import network_db_v2 as cdb
+from neutron.plugins.openvswitch import ovs_db_v2 as odb
LOG = logging.getLogger(__name__)
-class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
+class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
"""Virtual Physical Switch Model.
This implementation works with OVS and Nexus plugin for the
from sqlalchemy import orm
import webob.exc as wexc
-from quantum.api.v2 import base
-from quantum.common import exceptions as exc
-from quantum.db import db_base_plugin_v2
-from quantum.db import models_v2
-from quantum.openstack.common import importutils
-from quantum.plugins.cisco.common import cisco_constants as const
-from quantum.plugins.cisco.common import cisco_exceptions as cexc
-from quantum.plugins.cisco.common import config # noqa
-from quantum.plugins.cisco.db import network_db_v2 as cdb
+from neutron.api.v2 import base
+from neutron.common import exceptions as exc
+from neutron.db import db_base_plugin_v2
+from neutron.db import models_v2
+from neutron.openstack.common import importutils
+from neutron.plugins.cisco.common import cisco_constants as const
+from neutron.plugins.cisco.common import cisco_exceptions as cexc
+from neutron.plugins.cisco.common import config # noqa
+from neutron.plugins.cisco.db import network_db_v2 as cdb
LOG = logging.getLogger(__name__)
-class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
+class PluginV2(db_base_plugin_v2.NeutronDbPluginV2):
"""Meta-Plugin with v2 API support for multiple sub-plugins."""
supported_extension_aliases = ["Cisco Credential", "Cisco qos"]
(self._model, name))
def _extend_fault_map(self):
- """Extend the Quantum Fault Map for Cisco exceptions.
+ """Extend the Neutron Fault Map for Cisco exceptions.
Map exceptions which are specific to the Cisco Plugin
to standard HTTP exceptions.
from ncclient import manager
-from quantum.openstack.common import excutils
-from quantum.plugins.cisco.common import cisco_exceptions as cexc
-from quantum.plugins.cisco.db import network_db_v2 as cdb
-from quantum.plugins.cisco.db import nexus_db_v2
-from quantum.plugins.cisco.nexus import cisco_nexus_snippets as snipp
+from neutron.openstack.common import excutils
+from neutron.plugins.cisco.common import cisco_exceptions as cexc
+from neutron.plugins.cisco.db import network_db_v2 as cdb
+from neutron.plugins.cisco.db import nexus_db_v2
+from neutron.plugins.cisco.nexus import cisco_nexus_snippets as snipp
LOG = logging.getLogger(__name__)
if exc_str in str(e):
break
else:
- # Raise a Quantum exception. Include a description of
+ # Raise a Neutron exception. Include a description of
# the original ncclient exception.
raise cexc.NexusConfigFailed(config=config, exc=e)
password=nexus_password)
self.connections[nexus_host] = man
except Exception as e:
- # Raise a Quantum exception. Include a description of
+ # Raise a Neutron exception. Include a description of
# the original ncclient exception.
raise cexc.NexusConnectFailed(nexus_host=nexus_host, exc=e)
import logging
-from quantum.common import exceptions as exc
-from quantum.openstack.common import excutils
-from quantum.openstack.common import importutils
-from quantum.plugins.cisco.common import cisco_constants as const
-from quantum.plugins.cisco.common import cisco_credentials_v2 as cred
-from quantum.plugins.cisco.common import cisco_exceptions as cisco_exc
-from quantum.plugins.cisco.common import config as conf
-from quantum.plugins.cisco.db import nexus_db_v2 as nxos_db
-from quantum.plugins.cisco.l2device_plugin_base import L2DevicePluginBase
+from neutron.common import exceptions as exc
+from neutron.openstack.common import excutils
+from neutron.openstack.common import importutils
+from neutron.plugins.cisco.common import cisco_constants as const
+from neutron.plugins.cisco.common import cisco_credentials_v2 as cred
+from neutron.plugins.cisco.common import cisco_exceptions as cisco_exc
+from neutron.plugins.cisco.common import config as conf
+from neutron.plugins.cisco.db import nexus_db_v2 as nxos_db
+from neutron.plugins.cisco.l2device_plugin_base import L2DevicePluginBase
LOG = logging.getLogger(__name__)
Common utilities and helper functions for Openstack Networking Plugins.
"""
-from quantum.common import exceptions as q_exc
-from quantum.common import utils
+from neutron.common import exceptions as q_exc
+from neutron.common import utils
def verify_vlan_range(vlan_range):
from oslo.config import cfg
-from quantum.agent import rpc as agent_rpc
-from quantum.common import config as logging_config
-from quantum.common import topics
-from quantum import context
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import dispatcher
-from quantum.plugins.hyperv.agent import utils
-from quantum.plugins.hyperv.common import constants
+from neutron.agent import rpc as agent_rpc
+from neutron.common import config as logging_config
+from neutron.common import topics
+from neutron import context
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import dispatcher
+from neutron.plugins.hyperv.agent import utils
+from neutron.plugins.hyperv.common import constants
LOG = logging.getLogger(__name__)
CONF.register_opts(agent_opts, "AGENT")
-class HyperVQuantumAgent(object):
+class HyperVNeutronAgent(object):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'
def main():
eventlet.monkey_patch()
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
logging_config.setup_logging(cfg.CONF)
- plugin = HyperVQuantumAgent()
+ plugin = HyperVNeutronAgent()
# Start everything.
LOG.info(_("Agent initialized successfully, now running... "))
from oslo.config import cfg
-from quantum.common import exceptions as q_exc
-from quantum.openstack.common import log as logging
+from neutron.common import exceptions as q_exc
+from neutron.openstack.common import log as logging
# Check needed for unit testing on Unix
if sys.platform == 'win32':
LOG = logging.getLogger(__name__)
-class HyperVException(q_exc.QuantumException):
+class HyperVException(q_exc.NeutronException):
message = _('HyperVException: %(msg)s')
WMI_JOB_STATE_RUNNING = 4
# under the License.
# @author: Alessandro Pilotti, Cloudbase Solutions Srl
-from quantum.common import topics
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.hyperv.common import constants
+from neutron.common import topics
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.hyperv.common import constants
LOG = logging.getLogger(__name__)
from sqlalchemy.orm import exc
-from quantum.common import exceptions as q_exc
-import quantum.db.api as db_api
-from quantum.db import models_v2
-from quantum.openstack.common import log as logging
-from quantum.plugins.hyperv.common import constants
-from quantum.plugins.hyperv import model as hyperv_model
+from neutron.common import exceptions as q_exc
+import neutron.db.api as db_api
+from neutron.db import models_v2
+from neutron.openstack.common import log as logging
+from neutron.plugins.hyperv.common import constants
+from neutron.plugins.hyperv import model as hyperv_model
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.api.v2 import attributes
-from quantum.common import exceptions as q_exc
-from quantum.common import topics
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_gwmode_db
-from quantum.db import quota_db # noqa
-from quantum.extensions import portbindings
-from quantum.extensions import providernet as provider
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.plugins.common import utils as plugin_utils
-from quantum.plugins.hyperv import agent_notifier_api
-from quantum.plugins.hyperv.common import constants
-from quantum.plugins.hyperv import db as hyperv_db
-from quantum.plugins.hyperv import rpc_callbacks
+from neutron.api.v2 import attributes
+from neutron.common import exceptions as q_exc
+from neutron.common import topics
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_gwmode_db
+from neutron.db import quota_db # noqa
+from neutron.extensions import portbindings
+from neutron.extensions import providernet as provider
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.plugins.common import utils as plugin_utils
+from neutron.plugins.hyperv import agent_notifier_api
+from neutron.plugins.hyperv.common import constants
+from neutron.plugins.hyperv import db as hyperv_db
+from neutron.plugins.hyperv import rpc_callbacks
DEFAULT_VLAN_RANGES = []
network[provider.SEGMENTATION_ID] = binding.segmentation_id
-class HyperVQuantumPlugin(db_base_plugin_v2.QuantumDbPluginV2,
+class HyperVNeutronPlugin(db_base_plugin_v2.NeutronDbPluginV2,
l3_gwmode_db.L3_NAT_db_mixin):
# This attribute specifies whether the plugin supports or not
network_attrs = network['network']
self._process_provider_create(context, session, network_attrs)
- net = super(HyperVQuantumPlugin, self).create_network(
+ net = super(HyperVNeutronPlugin, self).create_network(
context, network)
network_type = network_attrs[provider.NETWORK_TYPE]
session = context.session
with session.begin(subtransactions=True):
- net = super(HyperVQuantumPlugin, self).update_network(context, id,
+ net = super(HyperVNeutronPlugin, self).update_network(context, id,
network)
self._process_l3_update(context, net, network['network'])
self._extend_network_dict_provider(context, net)
session = context.session
with session.begin(subtransactions=True):
binding = self._db.get_network_binding(session, id)
- super(HyperVQuantumPlugin, self).delete_network(context, id)
+ super(HyperVNeutronPlugin, self).delete_network(context, id)
p = self._network_providers_map[binding.network_type]
p.delete_network(session, binding)
# the network_binding record is deleted via cascade from
self.notifier.network_delete(context, id)
def get_network(self, context, id, fields=None):
- net = super(HyperVQuantumPlugin, self).get_network(context, id, None)
+ net = super(HyperVNeutronPlugin, self).get_network(context, id, None)
self._extend_network_dict_provider(context, net)
return self._fields(net, fields)
def get_networks(self, context, filters=None, fields=None):
- nets = super(HyperVQuantumPlugin, self).get_networks(
+ nets = super(HyperVNeutronPlugin, self).get_networks(
context, filters, None)
for net in nets:
self._extend_network_dict_provider(context, net)
return port
def create_port(self, context, port):
- port = super(HyperVQuantumPlugin, self).create_port(context, port)
+ port = super(HyperVNeutronPlugin, self).create_port(context, port)
return self._extend_port_dict_binding(context, port)
def get_port(self, context, id, fields=None):
- port = super(HyperVQuantumPlugin, self).get_port(context, id, fields)
+ port = super(HyperVNeutronPlugin, self).get_port(context, id, fields)
return self._fields(self._extend_port_dict_binding(context, port),
fields)
def get_ports(self, context, filters=None, fields=None):
- ports = super(HyperVQuantumPlugin, self).get_ports(
+ ports = super(HyperVNeutronPlugin, self).get_ports(
context, filters, fields)
return [self._fields(self._extend_port_dict_binding(context, port),
fields) for port in ports]
def update_port(self, context, id, port):
- original_port = super(HyperVQuantumPlugin, self).get_port(
+ original_port = super(HyperVNeutronPlugin, self).get_port(
context, id)
- port = super(HyperVQuantumPlugin, self).update_port(context, id, port)
+ port = super(HyperVNeutronPlugin, self).update_port(context, id, port)
if original_port['admin_state_up'] != port['admin_state_up']:
binding = self._db.get_network_binding(
None, port['network_id'])
self.prevent_l3_port_deletion(context, id)
self.disassociate_floatingips(context, id)
- super(HyperVQuantumPlugin, self).delete_port(context, id)
+ super(HyperVNeutronPlugin, self).delete_port(context, id)
self.notifier.port_delete(context, id)
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
-from quantum.db.models_v2 import model_base
+from neutron.db.models_v2 import model_base
class VlanAllocation(model_base.BASEV2):
# under the License.
# @author: Alessandro Pilotti, Cloudbase Solutions Srl
-from quantum.common import constants as q_const
-from quantum.common import rpc as q_rpc
-from quantum.db import dhcp_rpc_base
-from quantum.db import l3_rpc_base
-from quantum.openstack.common import log as logging
-from quantum.plugins.hyperv import db as hyperv_db
+from neutron.common import constants as q_const
+from neutron.common import rpc as q_rpc
+from neutron.db import dhcp_rpc_base
+from neutron.db import l3_rpc_base
+from neutron.openstack.common import log as logging
+from neutron.plugins.hyperv import db as hyperv_db
LOG = logging.getLogger(__name__)
# -- Background
-The Quantum Linux Bridge plugin is a plugin that allows you to manage
+The Neutron Linux Bridge plugin is a plugin that allows you to manage
connectivity between VMs on hosts that are capable of running a Linux Bridge.
-The Quantum Linux Bridge plugin consists of three components:
+The Neutron Linux Bridge plugin consists of three components:
1) The plugin itself: The plugin uses a database backend (mysql for
now) to store configuration and mappings that are used by the
agent. The mysql server runs on a central server (often the same
host as nova itself).
-2) The quantum service host which will be running quantum. This can
+2) The neutron service host which will be running neutron. This can
be run on the server running nova.
3) An agent which runs on the host and communicates with the host operating
system. The agent gathers the configuration and mappings from
- the mysql database running on the quantum host.
+ the mysql database running on the neutron host.
-The sections below describe how to configure and run the quantum
+The sections below describe how to configure and run the neutron
service with the Linux Bridge plugin.
# -- Python library dependencies
- Make sure you have the following package(s) installedi on quantum server
+ Make sure you have the following package(s) installedi on neutron server
host as well as any hosts which run the agent:
python-configobj
bridge-utils
# -- Nova configuration (controller node)
-1) Ensure that the quantum network manager is configured in the
+1) Ensure that the neutron network manager is configured in the
nova.conf on the node that will be running nova-network.
-network_manager=nova.network.quantum.manager.QuantumManager
+network_manager=nova.network.neutron.manager.NeutronManager
# -- Nova configuration (compute node(s))
connection_type=libvirt
libvirt_type=qemu
libvirt_vif_type=ethernet
-libvirt_vif_driver=nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver
-linuxnet_interface_driver=nova.network.linux_net.QuantumLinuxBridgeInterfaceDriver
+libvirt_vif_driver=nova.virt.libvirt.vif.NeutronLinuxBridgeVIFDriver
+linuxnet_interface_driver=nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
2) If you want a DHCP server to be run for the VMs to acquire IPs,
add the following flag to your nova.conf file:
-quantum_use_dhcp=true
+neutron_use_dhcp=true
-(Note: For more details on how to work with Quantum using Nova, i.e. how to create networks and such,
- please refer to the top level Quantum README which points to the relevant documentation.)
+(Note: For more details on how to work with Neutron using Nova, i.e. how to create networks and such,
+ please refer to the top level Neutron README which points to the relevant documentation.)
-# -- Quantum configuration
+# -- Neutron configuration
-Make the Linux Bridge plugin the current quantum plugin
+Make the Linux Bridge plugin the current neutron plugin
-- edit quantum.conf and change the core_plugin
+- edit neutron.conf and change the core_plugin
-core_plugin = quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2
+core_plugin = neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2
# -- Database config.
(Note: The plugin ships with a default SQLite in-memory database configuration,
and can be used to run tests without performing the suggested DB config below.)
-The Linux Bridge quantum plugin requires access to a mysql database in order
+The Linux Bridge neutron plugin requires access to a mysql database in order
to store configuration and mappings that will be used by the agent. Here is
-how to set up the database on the host that you will be running the quantum
+how to set up the database on the host that you will be running the neutron
service on.
MySQL should be installed on the host, and all plugins and clients
To prep mysql, run:
-$ mysql -u root -p -e "create database quantum_linux_bridge"
+$ mysql -u root -p -e "create database neutron_linux_bridge"
# log in to mysql service
$ mysql -u root -p
-# The Linux Bridge Quantum agent running on each compute node must be able to
+# The Linux Bridge Neutron agent running on each compute node must be able to
# make a mysql connection back to the main database server.
mysql> GRANT USAGE ON *.* to root@'yourremotehost' IDENTIFIED BY 'newpassword';
# force update of authorization changes
# -- Plugin configuration
- Edit the configuration file:
- etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini
+ etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini
Make sure it matches your mysql configuration. This file must be updated
with the addresses and credentials to access the database.
- Note: debug and logging information should be updated in etc/quantum.conf
+ Note: debug and logging information should be updated in etc/neutron.conf
Note: When running the tests, set the connection type to sqlite, and when
actually running the server set it to mysql. At any given time, only one
of these should be active in the conf file (you can comment out the other).
-- On the quantum server, network_vlan_ranges must be configured in
+- On the neutron server, network_vlan_ranges must be configured in
linuxbridge_conf.ini to specify the names of the physical networks
managed by the linuxbridge plugin, along with the ranges of VLAN IDs
available on each physical network for allocation to virtual
# -- Agent configuration
- Edit the configuration file:
- etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini
+ etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini
-- Copy quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py
- and etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini
+- Copy neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py
+ and etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini
to the compute node.
-- Copy the quantum.conf file to the compute node
+- Copy the neutron.conf file to the compute node
- Note: debug and logging information should be updated in etc/quantum.conf
+ Note: debug and logging information should be updated in etc/neutron.conf
- On each compute node, the network_interface_mappings must be
configured in linuxbridge_conf.ini to map each physical network name
$ Run the following:
- python linuxbridge_quantum_agent.py --config-file quantum.conf
+ python linuxbridge_neutron_agent.py --config-file neutron.conf
--config-file linuxbridge_conf.ini
Note that the the user running the agent must have sudo priviliges
to run various networking commands. Also, the agent can be
- configured to use quantum-rootwrap, limiting what commands it can
+ configured to use neutron-rootwrap, limiting what commands it can
run via sudo. See http://wiki.openstack.org/Packager/Rootwrap for
details on rootwrap.
- As an alternative to coping the agent python file, if quantum is
+ As an alternative to coping the agent python file, if neutron is
installed on the compute node, the agent can be run as
- bin/quantum-linuxbridge-agent.
+ bin/neutron-linuxbridge-agent.
# under the License.
#
#
-# Performs per host Linux Bridge configuration for Quantum.
+# Performs per host Linux Bridge configuration for Neutron.
# Based on the structure of the OpenVSwitch agent in the
-# Quantum OpenVSwitch Plugin.
+# Neutron OpenVSwitch Plugin.
# @author: Sumit Naiksatam, Cisco Systems, Inc.
import os
from oslo.config import cfg
import pyudev
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.agent import rpc as agent_rpc
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.common import config as logging_config
-from quantum.common import constants
-from quantum.common import topics
-from quantum.common import utils as q_utils
-from quantum import context
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
-from quantum.openstack.common.rpc import common as rpc_common
-from quantum.openstack.common.rpc import dispatcher
-from quantum.plugins.linuxbridge.common import config # noqa
-from quantum.plugins.linuxbridge.common import constants as lconst
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.agent import rpc as agent_rpc
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.common import config as logging_config
+from neutron.common import constants
+from neutron.common import topics
+from neutron.common import utils as q_utils
+from neutron import context
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
+from neutron.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.rpc import dispatcher
+from neutron.plugins.linuxbridge.common import config # noqa
+from neutron.plugins.linuxbridge.common import constants as lconst
LOG = logging.getLogger(__name__)
tap_device_name = TAP_INTERFACE_PREFIX + interface_id[0:11]
return tap_device_name
- def get_all_quantum_bridges(self):
- quantum_bridge_list = []
+ def get_all_neutron_bridges(self):
+ neutron_bridge_list = []
bridge_list = os.listdir(BRIDGE_FS)
for bridge in bridge_list:
if bridge.startswith(BRIDGE_NAME_PREFIX):
- quantum_bridge_list.append(bridge)
- return quantum_bridge_list
+ neutron_bridge_list.append(bridge)
+ return neutron_bridge_list
def get_interfaces_on_bridge(self, bridge_name):
if self.device_exists(bridge_name):
return os.listdir(bridge_interface_path)
def get_bridge_for_tap_device(self, tap_device_name):
- bridges = self.get_all_quantum_bridges()
+ bridges = self.get_all_neutron_bridges()
for bridge in bridges:
interfaces = self.get_interfaces_on_bridge(bridge)
if tap_device_name in interfaces:
pass
-class LinuxBridgeQuantumAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin):
+class LinuxBridgeNeutronAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin):
def __init__(self, interface_mappings, polling_interval,
root_helper):
self.root_helper = root_helper
self.setup_linux_bridge(interface_mappings)
self.agent_state = {
- 'binary': 'quantum-linuxbridge-agent',
+ 'binary': 'neutron-linuxbridge-agent',
'host': cfg.CONF.host,
'topic': constants.L2_AGENT_TOPIC,
'configurations': interface_mappings,
def main():
eventlet.monkey_patch()
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
logging_config.setup_logging(cfg.CONF)
try:
polling_interval = cfg.CONF.AGENT.polling_interval
root_helper = cfg.CONF.AGENT.root_helper
- plugin = LinuxBridgeQuantumAgentRPC(interface_mappings,
+ plugin = LinuxBridgeNeutronAgentRPC(interface_mappings,
polling_interval,
root_helper)
LOG.info(_("Agent initialized successfully, now running... "))
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum import scheduler
+from neutron.agent.common import config
+from neutron import scheduler
DEFAULT_VLAN_RANGES = []
DEFAULT_INTERFACE_MAPPINGS = []
from sqlalchemy.orm import exc
-from quantum.common import exceptions as q_exc
-import quantum.db.api as db
-from quantum.db import models_v2
-from quantum.db import securitygroups_db as sg_db
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum.plugins.linuxbridge.common import config # noqa
-from quantum.plugins.linuxbridge.common import constants
-from quantum.plugins.linuxbridge.db import l2network_models_v2
+from neutron.common import exceptions as q_exc
+import neutron.db.api as db
+from neutron.db import models_v2
+from neutron.db import securitygroups_db as sg_db
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron.plugins.linuxbridge.common import config # noqa
+from neutron.plugins.linuxbridge.common import constants
+from neutron.plugins.linuxbridge.db import l2network_models_v2
LOG = logging.getLogger(__name__)
if not port_and_sgs:
return
port = port_and_sgs[0][0]
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin._make_port_dict(port)
port_dict['security_groups'] = []
for port_in_db, sg_id in port_and_sgs:
import sqlalchemy as sa
-from quantum.db import model_base
+from neutron.db import model_base
class NetworkState(model_base.BASEV2):
from oslo.config import cfg
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.rpc.agentnotifiers import l3_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.common import constants as q_const
-from quantum.common import exceptions as q_exc
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.common import utils
-from quantum.db import agents_db
-from quantum.db import agentschedulers_db
-from quantum.db import api as db_api
-from quantum.db import db_base_plugin_v2
-from quantum.db import dhcp_rpc_base
-from quantum.db import extraroute_db
-from quantum.db import l3_gwmode_db
-from quantum.db import l3_rpc_base
-from quantum.db import portbindings_db
-from quantum.db import quota_db # noqa
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.extensions import portbindings
-from quantum.extensions import providernet as provider
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.common import utils as plugin_utils
-from quantum.plugins.linuxbridge.common import constants
-from quantum.plugins.linuxbridge.db import l2network_db_v2 as db
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.common import constants as q_const
+from neutron.common import exceptions as q_exc
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.common import utils
+from neutron.db import agents_db
+from neutron.db import agentschedulers_db
+from neutron.db import api as db_api
+from neutron.db import db_base_plugin_v2
+from neutron.db import dhcp_rpc_base
+from neutron.db import extraroute_db
+from neutron.db import l3_gwmode_db
+from neutron.db import l3_rpc_base
+from neutron.db import portbindings_db
+from neutron.db import quota_db # noqa
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.extensions import portbindings
+from neutron.extensions import providernet as provider
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.common import utils as plugin_utils
+from neutron.plugins.linuxbridge.common import constants
+from neutron.plugins.linuxbridge.db import l2network_db_v2 as db
LOG = logging.getLogger(__name__)
topic=self.topic_port_update)
-class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class LinuxBridgePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
extraroute_db.ExtraRoute_db_mixin,
l3_gwmode_db.L3_NAT_db_mixin,
sg_db_rpc.SecurityGroupServerRpcMixin,
agentschedulers_db.AgentSchedulerDbMixin,
portbindings_db.PortBindingMixin):
- """Implement the Quantum abstractions using Linux bridging.
+ """Implement the Neutron abstractions using Linux bridging.
A new VLAN is created for each network. An agent is relied upon
to perform the actual Linux bridge configuration on each host.
The provider extension is also supported. As discussed in
- https://bugs.launchpad.net/quantum/+bug/1023156, this class could
+ https://bugs.launchpad.net/neutron/+bug/1023156, this class could
be simplified, and filtering on extended attributes could be
handled, by adding support for extended attributes to the
- QuantumDbPluginV2 base class. When that occurs, this class should
+ NeutronDbPluginV2 base class. When that occurs, this class should
be updated to take advantage of it.
The port binding extension enables an external application relay
sys.exit(1)
self._setup_rpc()
self.network_scheduler = importutils.import_object(
- cfg.CONF.network_scheduler_driver)
+ cfg.CONF.network_scheduler_driver
+ )
self.router_scheduler = importutils.import_object(
- cfg.CONF.router_scheduler_driver)
+ cfg.CONF.router_scheduler_driver
+ )
LOG.debug(_("Linux Bridge Plugin initialization complete"))
def _setup_rpc(self):
[database]
# This line MUST be changed to actually run the plugin.
# Example:
-# connection = mysql://root:nova@127.0.0.1:3306/ovs_quantum
+# connection = mysql://root:nova@127.0.0.1:3306/ovs_neutron
# Replace 127.0.0.1 above with the IP address of the database used by the
-# main quantum server. (Leave it as is if the database runs on this host.)
-connection = mysql://root:password@localhost/quantum_metaplugin?charset=utf8
+# main neutron server. (Leave it as is if the database runs on this host.)
+connection = mysql://root:password@localhost/neutron_metaplugin?charset=utf8
# Database reconnection retry times - in event connectivity is lost
# set to -1 implgies an infinite retry count
retry_interval = 2
[meta]
-## This is list of flavor:quantum_plugins
+## This is list of flavor:neutron_plugins
# extension method is used in the order of this list
-plugin_list= 'openvswitch:quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2,linuxbridge:quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2'
+plugin_list= 'openvswitch:neutron.plugins.openvswitch.ovs_neutron_plugin.OVSneutronPluginV2,linuxbridge:neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2'
# plugin for l3
-l3_plugin_list= 'openvswitch:quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2,linuxbridge:quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2'
+l3_plugin_list= 'openvswitch:neutron.plugins.openvswitch.ovs_neutron_plugin.OVSneutronPluginV2,linuxbridge:neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2'
# Default value of flavor
default_flavor = 'openvswitch'
[DEFAULT]
# Meta Plugin
# Mapping between flavor and driver
-meta_flavor_driver_mappings = openvswitch:quantum.agent.linux.interface.OVSInterfaceDriver, linuxbridge:quantum.agent.linux.interface.BridgeInterfaceDriver
+meta_flavor_driver_mappings = openvswitch:neutron.agent.linux.interface.OVSInterfaceDriver, linuxbridge:neutron.agent.linux.interface.BridgeInterfaceDriver
# interface driver for MetaPlugin
-interface_driver = quantum.agent.linux.interface.MetaInterfaceDriver
+interface_driver = neutron.agent.linux.interface.MetaInterfaceDriver
[proxy]
auth_url = http://10.0.0.1:35357/v2.0
auth_region = RegionOne
admin_tenant_name = service
-admin_user = quantum
+admin_user = neutron
admin_password = password
# -- Agent
-Agents for Metaplugin are in quantum/plugins/metaplugin/agent
-linuxbridge_quantum_agent and ovs_quantum_agent is available.
+Agents for Metaplugin are in neutron/plugins/metaplugin/agent
+linuxbridge_neutron_agent and ovs_neutron_agent is available.
# -- Extensions
#- limitations
-Basically, All plugin should inherit QuantumDBPluginV2.
-Metaplugin assumes all plugin share same Database expecially for IPAM part in QuantumV2 API.
-You can use another plugin if you use ProxyPluginV2, which proxies request to the another quantum server.
+Basically, All plugin should inherit NeutronDbPluginV2.
+Metaplugin assumes all plugin share same Database expecially for IPAM part in NeutronV2 API.
+You can use another plugin if you use ProxyPluginV2, which proxies request to the another neutron server.
Example flavor configration for ProxyPluginV2
-meta_flavor_driver_mappings = "openvswitch:quantum.agent.linux.interface.OVSInterfaceDriver,proxy:quantum.plugins.metaplugin.proxy_quantum_plugin.ProxyPluginV2"
+meta_flavor_driver_mappings = "openvswitch:neutron.agent.linux.interface.OVSInterfaceDriver,proxy:neutron.plugins.metaplugin.proxy_neutron_plugin.ProxyPluginV2"
- Limited L3 support
In folsom version, l3 is an extension. There is no way to extend exntension attributes.
from sqlalchemy.orm import exc
-from quantum.plugins.metaplugin import meta_models_v2
+from neutron.plugins.metaplugin import meta_models_v2
def get_flavor_by_network(session, net_id):
import sqlalchemy as sa
from sqlalchemy import Column, String
-from quantum.db import models_v2
+from neutron.db import models_v2
class NetworkFlavor(models_v2.model_base.BASEV2):
from oslo.config import cfg
-from quantum.common import exceptions as exc
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import extraroute_db
-from quantum.db import l3_db
-from quantum.db import models_v2
-from quantum.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.plugins.metaplugin.common import config # noqa
-from quantum.plugins.metaplugin import meta_db_v2
-from quantum.plugins.metaplugin.meta_models_v2 import (NetworkFlavor,
+from neutron.common import exceptions as exc
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import extraroute_db
+from neutron.db import l3_db
+from neutron.db import models_v2
+from neutron.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.plugins.metaplugin.common import config # noqa
+from neutron.plugins.metaplugin import meta_db_v2
+from neutron.plugins.metaplugin.meta_models_v2 import (NetworkFlavor,
RouterFlavor)
message = _("Flavor %(flavor)s could not be found")
-class FaildToAddFlavorBinding(exc.QuantumException):
+class FaildToAddFlavorBinding(exc.NeutronException):
message = _("Failed to add flavor binding")
-class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
extraroute_db.ExtraRoute_db_mixin):
def __init__(self, configfile=None):
cfg._is_opt_registered = _is_opt_registered
# Keep existing tables if multiple plugin use same table name.
- db.model_base.QuantumBase.__table_args__ = {'keep_existing': True}
+ db.model_base.NeutronBase.__table_args__ = {'keep_existing': True}
self.plugins = {}
from oslo.config import cfg
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_db
-from quantum.openstack.common import log as logging
-from quantumclient.common import exceptions
-from quantumclient.v2_0 import client
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_db
+from neutron.openstack.common import log as logging
+from neutronclient.common import exceptions
+from neutronclient.v2_0 import client
LOG = logging.getLogger(__name__)
-class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class ProxyPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
l3_db.L3_NAT_db_mixin):
supported_extension_aliases = ["router"]
def __init__(self, configfile=None):
db.configure_db()
- self.quantum = client.Client(
+ self.neutron = client.Client(
username=cfg.CONF.PROXY.admin_user,
password=cfg.CONF.PROXY.admin_password,
tenant_name=cfg.CONF.PROXY.admin_tenant_name,
)
def _get_client(self):
- return self.quantum
+ return self.neutron
def create_subnet(self, context, subnet):
subnet_remote = self._get_client().create_subnet(subnet)
# limitations under the License.
-"""Unittest runner for quantum Meta plugin
+"""Unittest runner for neutron Meta plugin
-This file should be run from the top dir in the quantum directory
+This file should be run from the top dir in the neutron directory
To run all tests::
- PLUGIN_DIR=quantum/plugins/metaplugin ./run_tests.sh
+ PLUGIN_DIR=neutron/plugins/metaplugin ./run_tests.sh
"""
import os
sys.path.append(os.getcwd())
sys.path.append(os.path.dirname(__file__))
-from quantum.common.test_lib import run_tests, test_config
+from neutron.common.test_lib import run_tests, test_config
if __name__ == '__main__':
exit_status = False
# we should only invoked the tests once
invoke_once = len(sys.argv) > 1
- test_config['plugin_name'] = "meta_quantum_plugin.MetaPluginV2"
+ test_config['plugin_name'] = "meta_neutron_plugin.MetaPluginV2"
cwd = os.getcwd()
- working_dir = os.path.abspath("quantum/plugins/metaplugin")
+ working_dir = os.path.abspath("neutron/plugins/metaplugin")
c = config.Config(stream=sys.stdout,
env=os.environ,
verbosity=3,
from webob import exc as w_exc
-from quantum.common import exceptions as q_exc
-from quantum.openstack.common import log as logging
+from neutron.common import exceptions as q_exc
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
message = _('MidoNet %(resource_type)s %(id)s could not be found')
-class MidonetApiException(q_exc.QuantumException):
+class MidonetApiException(q_exc.NeutronException):
message = _("MidoNet API error: %(msg)s")
from midonetclient import api
from oslo.config import cfg
-from quantum.common import exceptions as q_exc
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_db
-from quantum.db import models_v2
-from quantum.db import securitygroups_db
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import log as logging
-from quantum.plugins.midonet import config # noqa
-from quantum.plugins.midonet import midonet_lib
+from neutron.common import exceptions as q_exc
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_db
+from neutron.db import models_v2
+from neutron.db import securitygroups_db
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import log as logging
+from neutron.plugins.midonet import config # noqa
+from neutron.plugins.midonet import midonet_lib
LOG = logging.getLogger(__name__)
-class MidonetPluginException(q_exc.QuantumException):
+class MidonetPluginException(q_exc.NeutronException):
message = _("%(msg)s")
-class MidonetPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class MidonetPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
l3_db.L3_NAT_db_mixin,
securitygroups_db.SecurityGroupDbMixin):
db.configure_db()
def create_subnet(self, context, subnet):
- """Create Quantum subnet.
+ """Create Neutron subnet.
- Creates a Quantum subnet and a DHCP entry in MidoNet bridge.
+ Creates a Neutron subnet and a DHCP entry in MidoNet bridge.
"""
LOG.debug(_("MidonetPluginV2.create_subnet called: subnet=%r"), subnet)
return sn_entry
def delete_subnet(self, context, id):
- """Delete Quantum subnet.
+ """Delete Neutron subnet.
- Delete quantum network and its corresponding MidoNet bridge.
+ Delete neutron network and its corresponding MidoNet bridge.
"""
LOG.debug(_("MidonetPluginV2.delete_subnet called: id=%s"), id)
subnet = super(MidonetPluginV2, self).get_subnet(context, id,
LOG.debug(_("MidonetPluginV2.delete_subnet exiting"))
def create_network(self, context, network):
- """Create Quantum network.
+ """Create Neutron network.
- Create a new Quantum network and its corresponding MidoNet bridge.
+ Create a new Neutron network and its corresponding MidoNet bridge.
"""
LOG.debug(_('MidonetPluginV2.create_network called: network=%r'),
network)
bridge = self.client.create_bridge(tenant_id,
network['network']['name'])
- # Set MidoNet bridge ID to the quantum DB entry
+ # Set MidoNet bridge ID to the neutron DB entry
network['network']['id'] = bridge.get_id()
net = super(MidonetPluginV2, self).create_network(context, network)
return net
def update_network(self, context, id, network):
- """Update Quantum network.
+ """Update Neutron network.
- Update an existing Quantum network and its corresponding MidoNet
+ Update an existing Neutron network and its corresponding MidoNet
bridge.
"""
LOG.debug(_("MidonetPluginV2.update_network called: id=%(id)r, "
return net
def get_network(self, context, id, fields=None):
- """Get Quantum network.
+ """Get Neutron network.
- Retrieves a Quantum network and its corresponding MidoNet bridge.
+ Retrieves a Neutron network and its corresponding MidoNet bridge.
"""
LOG.debug(_("MidonetPluginV2.get_network called: id=%(id)r, "
"fields=%(fields)r"), {'id': id, 'fields': fields})
try:
super(MidonetPluginV2, self).delete_network(context, id)
except Exception:
- LOG.error(_('Failed to delete quantum db, while Midonet bridge=%r'
+ LOG.error(_('Failed to delete neutron db, while Midonet bridge=%r'
'had been deleted'), id)
raise
def create_port(self, context, port):
- """Create a L2 port in Quantum/MidoNet."""
+ """Create a L2 port in Neutron/MidoNet."""
LOG.debug(_("MidonetPluginV2.create_port called: port=%r"), port)
is_compute_interface = False
bridge_port = self.client.create_interior_bridge_port(bridge)
if bridge_port:
- # set midonet port id to quantum port id and create a DB record.
+ # set midonet port id to neutron port id and create a DB record.
port_data['id'] = bridge_port.get_id()
session = context.session
LOG.debug(_("MidonetPluginV2.get_port called: id=%(id)s "
"fields=%(fields)r"), {'id': id, 'fields': fields})
- # get the quantum port from DB.
+ # get the neutron port from DB.
port_db_entry = super(MidonetPluginV2, self).get_port(context,
id, fields)
# verify that corresponding port exists in MidoNet.
return port_db_entry
def get_ports(self, context, filters=None, fields=None):
- """List quantum ports and verify that they exist in MidoNet."""
+ """List neutron ports and verify that they exist in MidoNet."""
LOG.debug(_("MidonetPluginV2.get_ports called: filters=%(filters)s "
"fields=%(fields)r"),
{'filters': filters, 'fields': fields})
return ports_db_entry
def delete_port(self, context, id, l3_port_check=True):
- """Delete a quantum port and corresponding MidoNet bridge port."""
+ """Delete a neutron port and corresponding MidoNet bridge port."""
LOG.debug(_("MidonetPluginV2.delete_port called: id=%(id)s "
"l3_port_check=%(l3_port_check)r"),
{'id': id, 'l3_port_check': l3_port_check})
subnet = self._get_subnet(context, subnet_id)
network_id = subnet['network_id']
- # find a quantum port for the network
+ # find a neutron port for the network
rport_qry = context.session.query(models_v2.Port)
ports = rport_qry.filter_by(
device_id=router_id,
#
def create_security_group(self, context, security_group, default_sg=False):
- """Create chains for Quantum security group."""
+ """Create chains for Neutron security group."""
LOG.debug(_("MidonetPluginV2.create_security_group called: "
"security_group=%(security_group)s "
"default_sg=%(default_sg)s "),
return sg_db_entry
def delete_security_group(self, context, id):
- """Delete chains for Quantum security group."""
+ """Delete chains for Neutron security group."""
LOG.debug(_("MidonetPluginV2.delete_security_group called: id=%s"), id)
with context.session.begin(subtransactions=True):
from oslo.config import cfg
-from quantum import scheduler
+from neutron import scheduler
ml2_opts = [
cfg.ListOpt('type_drivers',
default=['local', 'flat', 'vlan'],
help=_("List of network type driver entrypoints to be loaded "
- "from the quantum.ml2.type_drivers namespace.")),
+ "from the neutron.ml2.type_drivers namespace.")),
cfg.ListOpt('tenant_network_types',
default=['local'],
help=_("Ordered list of network_types to allocate as tenant "
cfg.ListOpt('mechanism_drivers',
default=[],
help=_("List of networking mechanism driver entrypoints to "
- "be loaded from the quantum.ml2.mechanism_drivers "
+ "be loaded from the neutron.ml2.mechanism_drivers "
"namespace.")),
]
from sqlalchemy.orm import exc
-from quantum.db import api as db_api
-from quantum.db import models_v2
-from quantum.db import securitygroups_db as sg_db
-from quantum import manager
-from quantum.openstack.common import log
-from quantum.openstack.common import uuidutils
-from quantum.plugins.ml2 import driver_api as api
-from quantum.plugins.ml2 import models
+from neutron.db import api as db_api
+from neutron.db import models_v2
+from neutron.db import securitygroups_db as sg_db
+from neutron import manager
+from neutron.openstack.common import log
+from neutron.openstack.common import uuidutils
+from neutron.plugins.ml2 import driver_api as api
+from neutron.plugins.ml2 import models
LOG = log.getLogger(__name__)
if not port_and_sgs:
return
port = port_and_sgs[0][0]
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin._make_port_dict(port)
port_dict['security_groups'] = [
sg_id for port_, sg_id in port_and_sgs if sg_id]
# The following keys are used in the segment dictionaries passed via
# the driver API. These are defined separately from similar keys in
-# quantum.extensions.providernet so that drivers don't need to change
+# neutron.extensions.providernet so that drivers don't need to change
# if/when providernet moves to the core API.
#
NETWORK_TYPE = 'network_type'
:param segment: segment dictionary using keys defined above
:returns: segment dictionary with any defaulted attributes added
- :raises: quantum.common.exceptions.InvalidInput if invalid
+ :raises: neutron.common.exceptions.InvalidInput if invalid
Called outside transaction context to validate the provider
attributes for a provider network segment. Raise InvalidInput
from oslo.config import cfg
import sqlalchemy as sa
-from quantum.common import exceptions as exc
-from quantum.db import model_base
-from quantum.openstack.common import log
-from quantum.plugins.ml2 import driver_api as api
+from neutron.common import exceptions as exc
+from neutron.db import model_base
+from neutron.openstack.common import log
+from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger(__name__)
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.common import exceptions as exc
-from quantum.openstack.common import log
-from quantum.plugins.ml2 import driver_api as api
+from neutron.common import exceptions as exc
+from neutron.openstack.common import log
+from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger(__name__)
from oslo.config import cfg
import sqlalchemy as sa
-from quantum.common import constants as q_const
-from quantum.common import exceptions as exc
-from quantum.common import utils
-from quantum.db import api as db_api
-from quantum.db import model_base
-from quantum.openstack.common import log
-from quantum.plugins.common import utils as plugin_utils
-from quantum.plugins.ml2 import driver_api as api
+from neutron.common import constants as q_const
+from neutron.common import exceptions as exc
+from neutron.common import utils
+from neutron.db import api as db_api
+from neutron.db import model_base
+from neutron.openstack.common import log
+from neutron.plugins.common import utils as plugin_utils
+from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger(__name__)
from oslo.config import cfg
import stevedore
-from quantum.common import exceptions as exc
-from quantum.openstack.common import log
-from quantum.plugins.ml2 import driver_api as api
+from neutron.common import exceptions as exc
+from neutron.openstack.common import log
+from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger(__name__)
LOG.info(_("Configured type driver names: %s"),
cfg.CONF.ml2.type_drivers)
- super(TypeManager, self).__init__('quantum.ml2.type_drivers',
+ super(TypeManager, self).__init__('neutron.ml2.type_drivers',
cfg.CONF.ml2.type_drivers,
invoke_on_load=True)
LOG.info(_("Loaded type driver names: %s"), self.names())
LOG.info(_("Configured mechanism driver names: %s"),
cfg.CONF.ml2.mechanism_drivers)
- super(MechanismManager, self).__init__('quantum.ml2.mechanism_drivers',
+ super(MechanismManager, self).__init__('neutron.ml2.mechanism_drivers',
cfg.CONF.ml2.mechanism_drivers,
invoke_on_load=True)
LOG.info(_("Loaded mechanism driver names: %s"), self.names())
import sqlalchemy as sa
-from quantum.db import model_base
-from quantum.db import models_v2
+from neutron.db import model_base
+from neutron.db import models_v2
class NetworkSegment(model_base.BASEV2, models_v2.HasId):
"""Represent persistent state of a network segment.
- A network segment is a portion of a quantum network with a
- specific physical realization. A quantum network can consist of
+ A network segment is a portion of a neutron network with a
+ specific physical realization. A neutron network can consist of
one or more segments.
"""
from oslo.config import cfg
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.rpc.agentnotifiers import l3_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.common import constants as const
-from quantum.common import exceptions as exc
-from quantum.common import topics
-from quantum.db import agentschedulers_db
-from quantum.db import db_base_plugin_v2
-from quantum.db import extraroute_db
-from quantum.db import portbindings_db
-from quantum.db import quota_db # noqa
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.extensions import portbindings
-from quantum.extensions import providernet as provider
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log
-from quantum.openstack.common import rpc as c_rpc
-from quantum.plugins.ml2 import config # noqa
-from quantum.plugins.ml2 import db
-from quantum.plugins.ml2 import driver_api as api
-from quantum.plugins.ml2 import managers
-from quantum.plugins.ml2 import rpc
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.common import constants as const
+from neutron.common import exceptions as exc
+from neutron.common import topics
+from neutron.db import agentschedulers_db
+from neutron.db import db_base_plugin_v2
+from neutron.db import extraroute_db
+from neutron.db import portbindings_db
+from neutron.db import quota_db # noqa
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.extensions import portbindings
+from neutron.extensions import providernet as provider
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log
+from neutron.openstack.common import rpc as c_rpc
+from neutron.plugins.ml2 import config # noqa
+from neutron.plugins.ml2 import db
+from neutron.plugins.ml2 import driver_api as api
+from neutron.plugins.ml2 import managers
+from neutron.plugins.ml2 import rpc
LOG = log.getLogger(__name__)
TYPE_MULTI_SEGMENT = 'multi-segment'
-class Ml2Plugin(db_base_plugin_v2.QuantumDbPluginV2,
+class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
extraroute_db.ExtraRoute_db_mixin,
sg_db_rpc.SecurityGroupServerRpcMixin,
agentschedulers_db.AgentSchedulerDbMixin,
portbindings_db.PortBindingMixin):
- """Implement the Quantum L2 abstractions using modules.
+ """Implement the Neutron L2 abstractions using modules.
- Ml2Plugin is a Quantum plugin based on separately extensible sets
+ Ml2Plugin is a Neutron plugin based on separately extensible sets
of network types and mechanisms for connecting to networks of
those types. The network types and mechanisms are implemented as
drivers loaded via Python entry points. Networks can be made up of
# REVISIT(rkukura): Use stevedore for these?
self.network_scheduler = importutils.import_object(
- cfg.CONF.network_scheduler_driver)
+ cfg.CONF.network_scheduler_driver
+ )
self.router_scheduler = importutils.import_object(
- cfg.CONF.router_scheduler_driver)
+ cfg.CONF.router_scheduler_driver
+ )
LOG.info(_("Modular L2 Plugin initialization complete"))
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.common import constants as q_const
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.db import agents_db
-from quantum.db import api as db_api
-from quantum.db import dhcp_rpc_base
-from quantum.db import l3_rpc_base
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.openstack.common import log
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.ml2 import db
-from quantum.plugins.ml2 import driver_api as api
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.common import constants as q_const
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.db import agents_db
+from neutron.db import api as db_api
+from neutron.db import dhcp_rpc_base
+from neutron.db import l3_rpc_base
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.openstack.common import log
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.ml2 import db
+from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger(__name__)
-Mellanox Quantum Plugin
+Mellanox Neutron Plugin
-This plugin implements Quantum v2 APIs with support for
+This plugin implements Neutron v2 APIs with support for
Mellanox embedded switch functionality as part of the
VPI (Ethernet/InfiniBand) HCA.
For more details on the plugin, please refer to the following link:
-https://wiki.openstack.org/wiki/Mellanox-Quantum
\ No newline at end of file
+https://wiki.openstack.org/wiki/Mellanox-Quantum
import eventlet
from oslo.config import cfg
-from quantum.agent import rpc as agent_rpc
-from quantum.common import config as logging_config
-from quantum.common import constants as q_constants
-from quantum.common import topics
-from quantum.common import utils as q_utils
-from quantum import context
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
-from quantum.openstack.common.rpc import dispatcher
-from quantum.plugins.mlnx.agent import utils
-from quantum.plugins.mlnx.common import config # noqa
-from quantum.plugins.mlnx.common import constants
-from quantum.plugins.mlnx.common import exceptions
+from neutron.agent import rpc as agent_rpc
+from neutron.common import config as logging_config
+from neutron.common import constants as q_constants
+from neutron.common import topics
+from neutron.common import utils as q_utils
+from neutron import context
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
+from neutron.openstack.common.rpc import dispatcher
+from neutron.plugins.mlnx.agent import utils
+from neutron.plugins.mlnx.common import config # noqa
+from neutron.plugins.mlnx.common import constants
+from neutron.plugins.mlnx.common import exceptions
LOG = logging.getLogger(__name__)
return dispatcher.RpcDispatcher([self])
-class MlnxEswitchQuantumAgent(object):
+class MlnxEswitchNeutronAgent(object):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'
self._polling_interval = cfg.CONF.AGENT.polling_interval
self._setup_eswitches(interface_mapping)
self.agent_state = {
- 'binary': 'quantum-mlnx-agent',
+ 'binary': 'neutron-mlnx-agent',
'host': cfg.CONF.host,
'topic': q_constants.L2_AGENT_TOPIC,
'configurations': interface_mapping,
dev_details['admin_state_up'])
else:
LOG.debug(_("Device with mac_address %s not defined "
- "on Quantum Plugin"), device)
+ "on Neutron Plugin"), device)
return resync
def treat_devices_removed(self, devices):
def main():
eventlet.monkey_patch()
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
logging_config.setup_logging(cfg.CONF)
try:
LOG.info(_("Interface mappings: %s"), interface_mappings)
try:
- agent = MlnxEswitchQuantumAgent(interface_mappings)
+ agent = MlnxEswitchNeutronAgent(interface_mappings)
except Exception as e:
LOG.error(_("Failed on Agent initialisation : %s."
" Agent terminated!"), e)
import zmq
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.plugins.mlnx.common import exceptions
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.plugins.mlnx.common import exceptions
LOG = logging.getLogger(__name__)
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.common import topics
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.rpc import proxy
+from neutron.common import topics
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.rpc import proxy
LOG = logging.getLogger(__name__)
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.plugins.mlnx.common import constants
+from neutron.agent.common import config
+from neutron.plugins.mlnx.common import constants
DEFAULT_VLAN_RANGES = ['default:1:1000']
DEFAULT_INTERFACE_MAPPINGS = []
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.common import exceptions as qexc
+from neutron.common import exceptions as qexc
-class MlnxException(qexc.QuantumException):
+class MlnxException(qexc.NeutronException):
message = _("Mlnx Exception: %(err_msg)s")
from sqlalchemy.orm import exc
-from quantum.common import exceptions as q_exc
-import quantum.db.api as db
-from quantum.db import models_v2
-from quantum.openstack.common import log as logging
-from quantum.plugins.mlnx.common import config # noqa
-from quantum.plugins.mlnx.db import mlnx_models_v2
+from neutron.common import exceptions as q_exc
+import neutron.db.api as db
+from neutron.db import models_v2
+from neutron.openstack.common import log as logging
+from neutron.plugins.mlnx.common import config # noqa
+from neutron.plugins.mlnx.db import mlnx_models_v2
LOG = logging.getLogger(__name__)
import sqlalchemy as sa
-from quantum.db import model_base
+from neutron.db import model_base
class SegmentationIdAllocation(model_base.BASEV2):
from oslo.config import cfg
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.api.v2 import attributes
-from quantum.common import constants as q_const
-from quantum.common import exceptions as q_exc
-from quantum.common import topics
-from quantum.common import utils
-from quantum.db import agents_db
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_db
-from quantum.db import quota_db # noqa
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.extensions import portbindings
-from quantum.extensions import providernet as provider
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.plugins.common import utils as plugin_utils
-from quantum.plugins.mlnx import agent_notify_api
-from quantum.plugins.mlnx.common import constants
-from quantum.plugins.mlnx.db import mlnx_db_v2 as db
-from quantum.plugins.mlnx import rpc_callbacks
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.api.v2 import attributes
+from neutron.common import constants as q_const
+from neutron.common import exceptions as q_exc
+from neutron.common import topics
+from neutron.common import utils
+from neutron.db import agents_db
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_db
+from neutron.db import quota_db # noqa
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.extensions import portbindings
+from neutron.extensions import providernet as provider
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.plugins.common import utils as plugin_utils
+from neutron.plugins.mlnx import agent_notify_api
+from neutron.plugins.mlnx.common import constants
+from neutron.plugins.mlnx.db import mlnx_db_v2 as db
+from neutron.plugins.mlnx import rpc_callbacks
LOG = logging.getLogger(__name__)
-class MellanoxEswitchPlugin(db_base_plugin_v2.QuantumDbPluginV2,
+class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2,
l3_db.L3_NAT_db_mixin,
agents_db.AgentDbMixin,
sg_db_rpc.SecurityGroupServerRpcMixin):
- """Realization of Quantum API on Mellanox HCA embedded switch technology.
+ """Realization of Neutron API on Mellanox HCA embedded switch technology.
Current plugin provides embedded HCA Switch connectivity.
Code is based on the Linux Bridge plugin content to
binding_set = "extension:port_binding:set"
def __init__(self):
- """Start Mellanox Quantum Plugin."""
+ """Start Mellanox Neutron Plugin."""
db.initialize()
self._parse_network_vlan_ranges()
db.sync_network_states(self.network_vlan_ranges)
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.common import constants as q_const
-from quantum.common import rpc as q_rpc
-from quantum.db import agents_db
-from quantum.db import api as db_api
-from quantum.db import dhcp_rpc_base
-from quantum.db import l3_rpc_base
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.openstack.common import log as logging
-from quantum.plugins.mlnx.db import mlnx_db_v2 as db
+from neutron.common import constants as q_const
+from neutron.common import rpc as q_rpc
+from neutron.db import agents_db
+from neutron.db import api as db_api
+from neutron.db import dhcp_rpc_base
+from neutron.db import l3_rpc_base
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.openstack.common import log as logging
+from neutron.plugins.mlnx.db import mlnx_db_v2 as db
LOG = logging.getLogger(__name__)
# -- Installation
Use QuickStart Script for this plugin. This provides you auto installation and
-configuration of Nova, Quantum and Trema.
+configuration of Nova, Neutron and Trema.
https://github.com/nec-openstack/quantum-openflow-plugin/tree/folsom
import eventlet
-from quantum.agent.linux import ovs_lib
-from quantum.agent import rpc as agent_rpc
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.common import config as logging_config
-from quantum.common import constants as q_const
-from quantum.common import topics
-from quantum import context as q_context
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
-from quantum.openstack.common.rpc import dispatcher
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.nec.common import config
+from neutron.agent.linux import ovs_lib
+from neutron.agent import rpc as agent_rpc
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.common import config as logging_config
+from neutron.common import constants as q_const
+from neutron.common import topics
+from neutron import context as q_context
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
+from neutron.openstack.common.rpc import dispatcher
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.nec.common import config
LOG = logging.getLogger(__name__)
def update_ports(self, context, agent_id, datapath_id,
port_added, port_removed):
- """RPC to update information of ports on Quantum Server."""
+ """RPC to update information of ports on Neutron Server."""
LOG.info(_("Update ports: added=%(added)s, "
"removed=%(removed)s"),
{'added': port_added, 'removed': port_removed})
self.init_firewall()
-class NECQuantumAgent(object):
+class NECNeutronAgent(object):
def __init__(self, integ_br, root_helper, polling_interval):
'''Constructor.
self.datapath_id = "0x%s" % self.int_br.get_datapath_id()
self.agent_state = {
- 'binary': 'quantum-nec-agent',
+ 'binary': 'neutron-nec-agent',
'host': config.CONF.host,
'topic': q_const.L2_AGENT_TOPIC,
'configurations': {},
def main():
eventlet.monkey_patch()
- config.CONF(project='quantum')
+ config.CONF(project='neutron')
logging_config.setup_logging(config.CONF)
root_helper = config.AGENT.root_helper
polling_interval = config.AGENT.polling_interval
- agent = NECQuantumAgent(integ_br, root_helper, polling_interval)
+ agent = NECNeutronAgent(integ_br, root_helper, polling_interval)
# Start everything.
agent.daemon_loop()
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.openstack.common import rpc # noqa
-from quantum import scheduler
+from neutron.agent.common import config
+from neutron.openstack.common import rpc # noqa
+from neutron import scheduler
ovs_opts = [
# under the License.
# @author: Ryota MIBU
-from quantum.common import exceptions as qexc
+from neutron.common import exceptions as qexc
-class OFCException(qexc.QuantumException):
+class OFCException(qexc.NeutronException):
message = _("An OFC exception has occurred: %(reason)s")
-class NECDBException(qexc.QuantumException):
+class NECDBException(qexc.NeutronException):
message = _("An exception occurred in NECPluginV2 DB: %(reason)s")
-class OFCConsistencyBroken(qexc.QuantumException):
- message = _("Consistency of Quantum-OFC resource map is broken: "
+class OFCConsistencyBroken(qexc.NeutronException):
+ message = _("Consistency of neutron-OFC resource map is broken: "
"%(reason)s")
import json
import socket
-from quantum.openstack.common import log as logging
-from quantum.plugins.nec.common import exceptions as nexc
+from neutron.openstack.common import log as logging
+from neutron.plugins.nec.common import exceptions as nexc
LOG = logging.getLogger(__name__)
import sqlalchemy as sa
-from quantum.db import api as db
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.db import securitygroups_db as sg_db
-from quantum.extensions import securitygroup as ext_sg
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum.plugins.nec.common import config # noqa
-from quantum.plugins.nec.common import exceptions as nexc
-from quantum.plugins.nec.db import models as nmodels
+from neutron.db import api as db
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.db import securitygroups_db as sg_db
+from neutron.extensions import securitygroup as ext_sg
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron.plugins.nec.common import config # noqa
+from neutron.plugins.nec.common import exceptions as nexc
+from neutron.plugins.nec.db import models as nmodels
LOG = logging.getLogger(__name__)
db.clear_db(base)
-def get_ofc_item(session, resource, quantum_id, old_style=False):
+def get_ofc_item(session, resource, neutron_id, old_style=False):
try:
model = _get_resource_model(resource, old_style)
- return session.query(model).filter_by(quantum_id=quantum_id).one()
+ return session.query(model).filter_by(quantum_id=neutron_id).one()
except sa.orm.exc.NoResultFound:
return None
-def get_ofc_id(session, resource, quantum_id, old_style=False):
- ofc_item = get_ofc_item(session, resource, quantum_id, old_style)
+def get_ofc_id(session, resource, neutron_id, old_style=False):
+ ofc_item = get_ofc_item(session, resource, neutron_id, old_style)
if ofc_item:
if old_style:
return ofc_item.id
return None
-def exists_ofc_item(session, resource, quantum_id, old_style=False):
- if get_ofc_item(session, resource, quantum_id, old_style):
+def exists_ofc_item(session, resource, neutron_id, old_style=False):
+ if get_ofc_item(session, resource, neutron_id, old_style):
return True
else:
return False
return None
-def add_ofc_item(session, resource, quantum_id, ofc_id, old_style=False):
+def add_ofc_item(session, resource, neutron_id, ofc_id, old_style=False):
try:
model = _get_resource_model(resource, old_style)
if old_style:
- params = dict(quantum_id=quantum_id, id=ofc_id)
+ params = dict(quantum_id=neutron_id, id=ofc_id)
else:
- params = dict(quantum_id=quantum_id, ofc_id=ofc_id)
+ params = dict(quantum_id=neutron_id, ofc_id=ofc_id)
item = model(**params)
with session.begin(subtransactions=True):
session.add(item)
return item
-def del_ofc_item(session, resource, quantum_id, old_style=False,
+def del_ofc_item(session, resource, neutron_id, old_style=False,
warning=True):
try:
model = _get_resource_model(resource, old_style)
with session.begin(subtransactions=True):
- item = session.query(model).filter_by(quantum_id=quantum_id).one()
+ item = session.query(model).filter_by(quantum_id=neutron_id).one()
session.delete(item)
return True
except sa.orm.exc.NoResultFound:
if warning:
LOG.warning(_("_del_ofc_item(): NotFound item "
"(model=%(model)s, id=%(id)s) "),
- {'model': model, 'id': quantum_id})
+ {'model': model, 'id': neutron_id})
return False
-def get_ofc_id_lookup_both(session, resource, quantum_id):
- ofc_id = get_ofc_id(session, resource, quantum_id)
+def get_ofc_id_lookup_both(session, resource, neutron_id):
+ ofc_id = get_ofc_id(session, resource, neutron_id)
# Lookup old style of OFC mapping table
if not ofc_id:
- ofc_id = get_ofc_id(session, resource, quantum_id,
+ ofc_id = get_ofc_id(session, resource, neutron_id,
old_style=True)
if not ofc_id:
- reason = (_("NotFound %(resource)s for quantum_id=%(id)s.")
- % {'resource': resource, 'id': quantum_id})
+ reason = (_("NotFound %(resource)s for neutron_id=%(id)s.")
+ % {'resource': resource, 'id': neutron_id})
raise nexc.OFCConsistencyBroken(reason=reason)
return ofc_id
-def exists_ofc_item_lookup_both(session, resource, quantum_id):
- if exists_ofc_item(session, resource, quantum_id):
+def exists_ofc_item_lookup_both(session, resource, neutron_id):
+ if exists_ofc_item(session, resource, neutron_id):
return True
# Check old style of OFC mapping table
- if exists_ofc_item(session, resource, quantum_id,
+ if exists_ofc_item(session, resource, neutron_id,
old_style=True):
return True
return False
-def del_ofc_item_lookup_both(session, resource, quantum_id):
+def del_ofc_item_lookup_both(session, resource, neutron_id):
# Delete the mapping from new style of OFC mapping table
- if del_ofc_item(session, resource, quantum_id,
+ if del_ofc_item(session, resource, neutron_id,
old_style=False, warning=False):
return
# Delete old style of OFC mapping table
- if del_ofc_item(session, resource, quantum_id,
+ if del_ofc_item(session, resource, neutron_id,
old_style=True, warning=False):
return
# The specified resource not found
LOG.warning(_("_del_ofc_item(): NotFound item "
"(resource=%(resource)s, id=%(id)s) "),
- {'resource': resource, 'id': quantum_id})
+ {'resource': resource, 'id': neutron_id})
def get_portinfo(session, id):
if not port_and_sgs:
return None
port = port_and_sgs[0][0]
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin._make_port_dict(port)
port_dict[ext_sg.SECURITYGROUPS] = [
sg_id for port_, sg_id in port_and_sgs if sg_id]
import sqlalchemy as sa
-from quantum.db import model_base
-from quantum.db import models_v2
+from neutron.db import model_base
+from neutron.db import models_v2
"""New mapping tables."""
ofc_id = sa.Column(sa.String(255), unique=True, nullable=False)
-class QuantumId(object):
+class NeutronId(object):
"""Logical ID on Quantum."""
quantum_id = sa.Column(sa.String(36), primary_key=True)
-class OFCTenantMapping(model_base.BASEV2, QuantumId, OFCId):
+class OFCTenantMapping(model_base.BASEV2, NeutronId, OFCId):
"""Represents a Tenant on OpenFlow Network/Controller."""
-class OFCNetworkMapping(model_base.BASEV2, QuantumId, OFCId):
+class OFCNetworkMapping(model_base.BASEV2, NeutronId, OFCId):
"""Represents a Network on OpenFlow Network/Controller."""
-class OFCPortMapping(model_base.BASEV2, QuantumId, OFCId):
+class OFCPortMapping(model_base.BASEV2, NeutronId, OFCId):
"""Represents a Port on OpenFlow Network/Controller."""
-class OFCFilterMapping(model_base.BASEV2, QuantumId, OFCId):
+class OFCFilterMapping(model_base.BASEV2, NeutronId, OFCId):
"""Represents a Filter on OpenFlow Network/Controller."""
"""Old mapping tables."""
-class HasQuantumId(object):
+class HasNeutronId(object):
"""Logical ID on Quantum."""
quantum_id = sa.Column(sa.String(36), nullable=False)
-class OFCTenant(model_base.BASEV2, models_v2.HasId, HasQuantumId):
+class OFCTenant(model_base.BASEV2, models_v2.HasId, HasNeutronId):
"""Represents a Tenant on OpenFlow Network/Controller."""
-class OFCNetwork(model_base.BASEV2, models_v2.HasId, HasQuantumId):
+class OFCNetwork(model_base.BASEV2, models_v2.HasId, HasNeutronId):
"""Represents a Network on OpenFlow Network/Controller."""
-class OFCPort(model_base.BASEV2, models_v2.HasId, HasQuantumId):
+class OFCPort(model_base.BASEV2, models_v2.HasId, HasNeutronId):
"""Represents a Port on OpenFlow Network/Controller."""
-class OFCFilter(model_base.BASEV2, models_v2.HasId, HasQuantumId):
+class OFCFilter(model_base.BASEV2, models_v2.HasId, HasNeutronId):
"""Represents a Filter on OpenFlow Network/Controller."""
from sqlalchemy.orm import exc
-from quantum.api.v2 import attributes
-from quantum.db import db_base_plugin_v2
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nec.common import exceptions as q_exc
-from quantum.plugins.nec.db import models as nmodels
+from neutron.api.v2 import attributes
+from neutron.db import db_base_plugin_v2
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nec.common import exceptions as q_exc
+from neutron.plugins.nec.db import models as nmodels
LOG = logging.getLogger(__name__)
-class NECPluginV2Base(db_base_plugin_v2.QuantumDbPluginV2):
+class NECPluginV2Base(db_base_plugin_v2.NeutronDbPluginV2):
"""Base class of plugins that handle packet filters."""
# under the License.
# @author: Ryota MIBU
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
-DRIVER_PATH = "quantum.plugins.nec.drivers.%s"
+DRIVER_PATH = "neutron.plugins.nec.drivers.%s"
DRIVER_LIST = {
'trema': DRIVER_PATH % "trema.TremaPortBaseDriver",
'trema_port': DRIVER_PATH % "trema.TremaPortBaseDriver",
import re
import uuid
-from quantum.plugins.nec.common import ofc_client
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec import ofc_driver_base
+from neutron.plugins.nec.common import ofc_client
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec import ofc_driver_base
class PFCDriverBase(ofc_driver_base.OFCDriverBase):
# @author: Ryota MIBU
# @author: Akihiro MOTOKI
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nec.common import ofc_client
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec import ofc_driver_base
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nec.common import ofc_client
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec import ofc_driver_base
class TremaDriverBase(ofc_driver_base.OFCDriverBase):
from oslo.config import cfg
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.api.v2 import base
-from quantum.manager import QuantumManager
-from quantum import quota
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.api.v2 import base
+from neutron.manager import NeutronManager
+from neutron import quota
quota_packet_filter_opts = [
def get_resources(self):
resource = base.create_resource('packet_filters', 'packet_filter',
- QuantumManager.get_plugin(),
+ NeutronManager.get_plugin(),
PACKET_FILTER_ATTR_MAP)
qresource = quota.CountableResource('packet_filter',
quota._count_resource,
# @author: Ryota MIBU
# @author: Akihiro MOTOKI
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.rpc.agentnotifiers import l3_rpc_agent_api
-from quantum.common import exceptions as q_exc
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.db import agents_db
-from quantum.db import agentschedulers_db
-from quantum.db import db_base_plugin_v2
-from quantum.db import dhcp_rpc_base
-from quantum.db import extraroute_db
-from quantum.db import l3_gwmode_db
-from quantum.db import l3_rpc_base
-from quantum.db import quota_db # noqa
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.extensions import portbindings
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.nec.common import config
-from quantum.plugins.nec.common import exceptions as nexc
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec.db import nec_plugin_base
-from quantum.plugins.nec import ofc_manager
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
+from neutron.common import exceptions as q_exc
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.db import agents_db
+from neutron.db import agentschedulers_db
+from neutron.db import db_base_plugin_v2
+from neutron.db import dhcp_rpc_base
+from neutron.db import extraroute_db
+from neutron.db import l3_gwmode_db
+from neutron.db import l3_rpc_base
+from neutron.db import quota_db # noqa
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.extensions import portbindings
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.nec.common import config
+from neutron.plugins.nec.common import exceptions as nexc
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec.db import nec_plugin_base
+from neutron.plugins.nec import ofc_manager
LOG = logging.getLogger(__name__)
agentschedulers_db.AgentSchedulerDbMixin):
"""NECPluginV2 controls an OpenFlow Controller.
- The Quantum NECPluginV2 maps L2 logical networks to L2 virtualized networks
+ The Neutron NECPluginV2 maps L2 logical networks to L2 virtualized networks
on an OpenFlow enabled network. An OpenFlow Controller (OFC) provides
L2 network isolation without VLAN and this plugin controls the OFC.
- NOTE: This is for Quantum API V2. Codes for V1.0 and V1.1 are available
- at https://github.com/nec-openstack/quantum-openflow-plugin .
+ NOTE: This is for Neutron API V2. Codes for V1.0 and V1.1 are available
+ at https://github.com/nec-openstack/neutron-openflow-plugin .
The port binding extension enables an external application relay
information to and from the plugin.
# if no api_extensions_path is specified.
if not config.CONF.api_extensions_path:
config.CONF.set_override('api_extensions_path',
- 'quantum/plugins/nec/extensions')
+ 'neutron/plugins/nec/extensions')
self.setup_rpc()
self.network_scheduler = importutils.import_object(
- config.CONF.network_scheduler_driver)
+ config.CONF.network_scheduler_driver
+ )
self.router_scheduler = importutils.import_object(
- config.CONF.router_scheduler_driver)
+ config.CONF.router_scheduler_driver
+ )
def setup_rpc(self):
self.topic = topics.PLUGIN
:param tenant_id: A hint of OFC tenant ID.
A driver could use this id as a OFC id or ignore it.
:returns: ID of the tenant created at OpenFlow Controller.
- :raises: quantum.plugin.nec.common.exceptions.OFCException
+ :raises: neutron.plugin.nec.common.exceptions.OFCException
"""
pass
def delete_tenant(self, ofc_tenant_id):
"""Delete a tenant at OpenFlow Controller.
- :raises: quantum.plugin.nec.common.exceptions.OFCException
+ :raises: neutron.plugin.nec.common.exceptions.OFCException
"""
pass
ID returned must be unique in the OpenFlow Controller.
If a network is identified in conjunction with other information
such as a tenant ID, such information should be included in the ID.
- :raises: quantum.plugin.nec.common.exceptions.OFCException
+ :raises: neutron.plugin.nec.common.exceptions.OFCException
"""
pass
def delete_network(self, ofc_network_id):
"""Delete a netwrok at OpenFlow Controller.
- :raises: quantum.plugin.nec.common.exceptions.OFCException
+ :raises: neutron.plugin.nec.common.exceptions.OFCException
"""
pass
a tenant, such information should be included in the ID.
:returns: ID of the port created at OpenFlow Controller.
- :raises: quantum.plugin.nec.common.exceptions.OFCException
+ :raises: neutron.plugin.nec.common.exceptions.OFCException
"""
pass
def delete_port(self, ofc_port_id):
"""Delete a port at OpenFlow Controller.
- :raises: quantum.plugin.nec.common.exceptions.OFCException
+ :raises: neutron.plugin.nec.common.exceptions.OFCException
"""
pass
def convert_ofc_tenant_id(self, context, ofc_tenant_id):
"""Convert old-style ofc tenand id to new-style one.
- :param context: quantum context object
+ :param context: neutron context object
:param ofc_tenant_id: ofc_tenant_id to be converted
"""
pass
tenant_id):
"""Convert old-style ofc network id to new-style one.
- :param context: quantum context object
+ :param context: neutron context object
:param ofc_network_id: ofc_network_id to be converted
- :param tenant_id: quantum tenant_id of the network
+ :param tenant_id: neutron tenant_id of the network
"""
pass
tenant_id, network_id):
"""Convert old-style ofc port id to new-style one.
- :param context: quantum context object
+ :param context: neutron context object
:param ofc_port_id: ofc_port_id to be converted
- :param tenant_id: quantum tenant_id of the port
- :param network_id: quantum network_id of the port
+ :param tenant_id: neutron tenant_id of the port
+ :param network_id: neutron network_id of the port
"""
pass
# @author: Ryota MIBU
# @author: Akihiro MOTOKI
-from quantum.plugins.nec.common import config
-from quantum.plugins.nec.common import exceptions as nexc
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec import drivers
+from neutron.plugins.nec.common import config
+from neutron.plugins.nec.common import exceptions as nexc
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec import drivers
class OFCManager(object):
"""This class manages an OpenFlow Controller and map resources.
This class manage an OpenFlow Controller (OFC) with a driver specified in
- a configuration of this plugin. This keeps mappings between IDs on Quantum
+ a configuration of this plugin. This keeps mappings between IDs on Neutron
and OFC for various entities such as Tenant, Network and Filter. A Port on
OFC is identified by a switch ID 'datapath_id' and a port number 'port_no'
of the switch. An ID named as 'ofc_*' is used to identify resource on OFC.
def __init__(self):
self.driver = drivers.get_driver(config.OFC.driver)(config.OFC)
- def _get_ofc_id(self, context, resource, quantum_id):
+ def _get_ofc_id(self, context, resource, neutron_id):
return ndb.get_ofc_id_lookup_both(context.session,
- resource, quantum_id)
+ resource, neutron_id)
- def _exists_ofc_item(self, context, resource, quantum_id):
+ def _exists_ofc_item(self, context, resource, neutron_id):
return ndb.exists_ofc_item_lookup_both(context.session,
- resource, quantum_id)
+ resource, neutron_id)
- def _add_ofc_item(self, context, resource, quantum_id, ofc_id):
+ def _add_ofc_item(self, context, resource, neutron_id, ofc_id):
# Ensure a new item is added to the new mapping table
- ndb.add_ofc_item(context.session, resource, quantum_id, ofc_id)
+ ndb.add_ofc_item(context.session, resource, neutron_id, ofc_id)
- def _del_ofc_item(self, context, resource, quantum_id):
- ndb.del_ofc_item_lookup_both(context.session, resource, quantum_id)
+ def _del_ofc_item(self, context, resource, neutron_id):
+ ndb.del_ofc_item_lookup_both(context.session, resource, neutron_id)
def create_ofc_tenant(self, context, tenant_id):
desc = "ID=%s at OpenStack." % tenant_id
ofc_tenant_id = self.driver.convert_ofc_tenant_id(
context, ofc_tenant_id)
- desc = "ID=%s Name=%s at Quantum." % (network_id, network_name)
+ desc = "ID=%s Name=%s at Neutron." % (network_id, network_name)
ofc_net_id = self.driver.create_network(ofc_tenant_id, desc,
network_id)
self._add_ofc_item(context, "ofc_network", network_id, ofc_net_id)
from sqlalchemy.orm import exc as sa_exc
import webob.exc
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.v2 import attributes as attr
-from quantum.api.v2 import base
-from quantum.common import constants
-from quantum.common import exceptions as q_exc
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.common import utils
-from quantum import context as q_context
-from quantum.db import agents_db
-from quantum.db import agentschedulers_db
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import dhcp_rpc_base
-from quantum.db import l3_db
-from quantum.db import models_v2
-from quantum.db import portsecurity_db
-from quantum.db import quota_db # noqa
-from quantum.db import securitygroups_db
-from quantum.extensions import l3
-from quantum.extensions import portsecurity as psec
-from quantum.extensions import providernet as pnet
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import excutils
-from quantum.openstack.common import importutils
-from quantum.openstack.common import rpc
-from quantum.plugins.nicira.common import config # noqa
-from quantum.plugins.nicira.common import exceptions as nvp_exc
-from quantum.plugins.nicira.common import metadata_access as nvp_meta
-from quantum.plugins.nicira.common import securitygroups as nvp_sec
-from quantum.plugins.nicira.dbexts import maclearning as mac_db
-from quantum.plugins.nicira.dbexts import nicira_db
-from quantum.plugins.nicira.dbexts import nicira_networkgw_db as networkgw_db
-from quantum.plugins.nicira.dbexts import nicira_qos_db as qos_db
-from quantum.plugins.nicira.extensions import maclearning as mac_ext
-from quantum.plugins.nicira.extensions import nvp_networkgw as networkgw
-from quantum.plugins.nicira.extensions import nvp_qos as ext_qos
-from quantum.plugins.nicira import nvp_cluster
-from quantum.plugins.nicira import NvpApiClient
-from quantum.plugins.nicira import nvplib
-
-
-LOG = logging.getLogger("QuantumPlugin")
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.v2 import attributes as attr
+from neutron.api.v2 import base
+from neutron.common import constants
+from neutron.common import exceptions as q_exc
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.common import utils
+from neutron import context as q_context
+from neutron.db import agents_db
+from neutron.db import agentschedulers_db
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import dhcp_rpc_base
+from neutron.db import l3_db
+from neutron.db import models_v2
+from neutron.db import portsecurity_db
+from neutron.db import quota_db # noqa
+from neutron.db import securitygroups_db
+from neutron.extensions import l3
+from neutron.extensions import portsecurity as psec
+from neutron.extensions import providernet as pnet
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import excutils
+from neutron.openstack.common import importutils
+from neutron.openstack.common import rpc
+from neutron.plugins.nicira.common import config # noqa
+from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import metadata_access as nvp_meta
+from neutron.plugins.nicira.common import securitygroups as nvp_sec
+from neutron.plugins.nicira.dbexts import maclearning as mac_db
+from neutron.plugins.nicira.dbexts import nicira_db
+from neutron.plugins.nicira.dbexts import nicira_networkgw_db as networkgw_db
+from neutron.plugins.nicira.dbexts import nicira_qos_db as qos_db
+from neutron.plugins.nicira.extensions import maclearning as mac_ext
+from neutron.plugins.nicira.extensions import nvp_networkgw as networkgw
+from neutron.plugins.nicira.extensions import nvp_qos as ext_qos
+from neutron.plugins.nicira import nvp_cluster
+from neutron.plugins.nicira import NvpApiClient
+from neutron.plugins.nicira import nvplib
+
+
+LOG = logging.getLogger("NeutronPlugin")
NVP_NOSNAT_RULES_ORDER = 10
NVP_FLOATINGIP_NAT_RULES_ORDER = 224
NVP_EXTGW_NAT_RULES_ORDER = 255
agents_db.AgentExtRpcCallback()])
-class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class NvpPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
l3_db.L3_NAT_db_mixin,
portsecurity_db.PortSecurityDbMixin,
securitygroups_db.SecurityGroupDbMixin,
agentschedulers_db.AgentSchedulerDbMixin):
"""L2 Virtual network plugin.
- NvpPluginV2 is a Quantum plugin that provides L2 Virtual Network
+ NvpPluginV2 is a Neutron plugin that provides L2 Virtual Network
functionality using NVP.
"""
# Set up RPC interface for DHCP agent
self.setup_rpc()
self.network_scheduler = importutils.import_object(
- cfg.CONF.network_scheduler_driver)
+ cfg.CONF.network_scheduler_driver
+ )
# Set this flag to false as the default gateway has not
# been yet updated from the config file
self._is_default_net_gw_in_sync = False
LOG.exception(_("Unable to create port on NVP logical router %s"),
router_id)
raise nvp_exc.NvpPluginException(
- err_msg=_("Unable to create logical router port for quantum "
+ err_msg=_("Unable to create logical router port for neutron "
"port id %(port_id)s on router %(router_id)s") %
{'port_id': port_data.get('id'), 'router_id': router_id})
self._update_router_port_attachment(cluster, context, router_id,
nvp_router_port_id)
LOG.exception(_("Unable to plug attachment in NVP logical "
"router port %(r_port_id)s, associated with "
- "Quantum %(q_port_id)s"),
+ "Neutron %(q_port_id)s"),
{'r_port_id': nvp_router_port_id,
'q_port_id': port_data.get('id')})
raise nvp_exc.NvpPluginException(
err_msg=(_("Unable to plug attachment in router port "
- "%(r_port_id)s for quantum port id %(q_port_id)s "
+ "%(r_port_id)s for neutron port id %(q_port_id)s "
"on router %(router_id)s") %
{'r_port_id': nvp_router_port_id,
'q_port_id': port_data.get('id'),
def _get_port_by_device_id(self, context, device_id, device_owner):
"""Retrieve ports associated with a specific device id.
- Used for retrieving all quantum ports attached to a given router.
+ Used for retrieving all neutron ports attached to a given router.
"""
port_qry = context.session.query(models_v2.Port)
return port_qry.filter_by(
selected_lswitch['uuid'],
port_data,
True)
- nicira_db.add_quantum_nvp_port_mapping(
+ nicira_db.add_neutron_nvp_port_mapping(
context.session, port_data['id'], lport['uuid'])
if (not port_data['device_owner'] in
(l3_db.DEVICE_OWNER_ROUTER_GW,
msg = (_("An exception occured while plugging the interface "
"into network:%s") % port_data['network_id'])
LOG.exception(msg)
- raise q_exc.QuantumException(message=msg)
+ raise q_exc.NeutronException(message=msg)
def _nvp_delete_port(self, context, port_data):
# FIXME(salvatore-orlando): On the NVP platform we do not really have
selected_lswitch['uuid'],
port_data,
False)
- nicira_db.add_quantum_nvp_port_mapping(
+ nicira_db.add_neutron_nvp_port_mapping(
context.session, port_data['id'], lport['uuid'])
LOG.debug(_("_nvp_create_port completed for port %(name)s on "
"network %(network_id)s. The new port id is %(id)s."),
# is created at the same time as the NVP logical router, otherwise
# the fabric status of the NVP router will be down.
# admin_status should always be up for the gateway port
- # regardless of what the user specifies in quantum
+ # regardless of what the user specifies in neutron
router_id = port_data['device_id']
nvplib.update_router_lport(self.cluster,
router_id,
selected_lswitch['uuid'],
port_data,
True)
- nicira_db.add_quantum_nvp_port_mapping(
+ nicira_db.add_neutron_nvp_port_mapping(
context.session, port_data['id'], lport['uuid'])
nvplib.plug_l2_gw_service(
self.cluster,
# this is a no-op driver
pass
- def _nvp_get_port_id(self, context, cluster, quantum_port):
- """Return the NVP port uuid for a given quantum port.
+ def _nvp_get_port_id(self, context, cluster, neutron_port):
+ """Return the NVP port uuid for a given neutron port.
- First, look up the Quantum database. If not found, execute
+ First, look up the Neutron database. If not found, execute
a query on NVP platform as the mapping might be missing because
the port was created before upgrading to grizzly.
"""
nvp_port_id = nicira_db.get_nvp_port_id(context.session,
- quantum_port['id'])
+ neutron_port['id'])
if nvp_port_id:
return nvp_port_id
# Perform a query to NVP and then update the DB
try:
- nvp_port = nvplib.get_port_by_quantum_tag(
+ nvp_port = nvplib.get_port_by_neutron_tag(
cluster,
- quantum_port['network_id'],
- quantum_port['id'])
+ neutron_port['network_id'],
+ neutron_port['id'])
if nvp_port:
- nicira_db.add_quantum_nvp_port_mapping(
+ nicira_db.add_neutron_nvp_port_mapping(
context.session,
- quantum_port['id'],
+ neutron_port['id'],
nvp_port['uuid'])
return nvp_port['uuid']
except Exception:
- LOG.exception(_("Unable to find NVP uuid for Quantum port %s"),
- quantum_port['id'])
+ LOG.exception(_("Unable to find NVP uuid for Neutron port %s"),
+ neutron_port['id'])
def _extend_fault_map(self):
- """Extends the Quantum Fault Map.
+ """Extends the Neutron Fault Map.
Exceptions specific to the NVP Plugin are mapped to standard
HTTP Exceptions.
port['nvp_port_id'] = nvp_port_id
else:
LOG.warning(_("A nvp lport identifier was not found for "
- "quantum port '%s'"), port['id'])
+ "neutron port '%s'"), port['id'])
super(NvpPluginV2, self).delete_network(context, id)
# clean up network owned ports
try:
lswitches = nvplib.get_lswitches(self.cluster, id)
nvp_net_status = constants.NET_STATUS_ACTIVE
- quantum_status = network.status
+ neutron_status = network.status
for lswitch in lswitches:
relations = lswitch.get('_relations')
if relations:
nvp_net_status = constants.NET_STATUS_DOWN
break
LOG.debug(_("Current network status:%(nvp_net_status)s; "
- "Status in Quantum DB:%(quantum_status)s"),
+ "Status in Neutron DB:%(neutron_status)s"),
{'nvp_net_status': nvp_net_status,
- 'quantum_status': quantum_status})
+ 'neutron_status': neutron_status})
if nvp_net_status != network.status:
# update the network status
network.status = nvp_net_status
nvp_lswitches = {}
filters = filters or {}
with context.session.begin(subtransactions=True):
- quantum_lswitches = (
+ neutron_lswitches = (
super(NvpPluginV2, self).get_networks(context, filters))
- for net in quantum_lswitches:
+ for net in neutron_lswitches:
self._extend_network_dict_provider(context, net)
self._extend_network_port_security_dict(context, net)
self._extend_network_qos_queue(context, net)
(uuid, ls) for (uuid, ls) in nvp_lswitches.iteritems()
if uuid in set(filters['id']))
- for quantum_lswitch in quantum_lswitches:
+ for neutron_lswitch in neutron_lswitches:
# Skip external networks as they do not exist in NVP
- if quantum_lswitch[l3.EXTERNAL]:
+ if neutron_lswitch[l3.EXTERNAL]:
continue
- elif quantum_lswitch['id'] not in nvp_lswitches:
- LOG.warning(_("Logical Switch %s found in quantum database "
- "but not in NVP."), quantum_lswitch["id"])
- quantum_lswitch["status"] = constants.NET_STATUS_ERROR
+ elif neutron_lswitch['id'] not in nvp_lswitches:
+ LOG.warning(_("Logical Switch %s found in neutron database "
+ "but not in NVP."), neutron_lswitch["id"])
+ neutron_lswitch["status"] = constants.NET_STATUS_ERROR
else:
# TODO(salvatore-orlando): be careful about "extended"
# logical switches
- ls = nvp_lswitches.pop(quantum_lswitch['id'])
+ ls = nvp_lswitches.pop(neutron_lswitch['id'])
if (ls["_relations"]["LogicalSwitchStatus"]["fabric_status"]):
- quantum_lswitch["status"] = constants.NET_STATUS_ACTIVE
+ neutron_lswitch["status"] = constants.NET_STATUS_ACTIVE
else:
- quantum_lswitch["status"] = constants.NET_STATUS_DOWN
+ neutron_lswitch["status"] = constants.NET_STATUS_DOWN
# do not make the case in which switches are found in NVP
- # but not in Quantum catastrophic.
+ # but not in Neutron catastrophic.
if nvp_lswitches:
LOG.warning(_("Found %s logical switches not bound "
- "to Quantum networks. Quantum and NVP are "
+ "to Neutron networks. Neutron and NVP are "
"potentially out of sync"), len(nvp_lswitches))
LOG.debug(_("get_networks() completed for tenant %s"),
if fields:
ret_fields = []
- for quantum_lswitch in quantum_lswitches:
+ for neutron_lswitch in neutron_lswitches:
row = {}
for field in fields:
- row[field] = quantum_lswitch[field]
+ row[field] = neutron_lswitch[field]
ret_fields.append(row)
return ret_fields
- return quantum_lswitches
+ return neutron_lswitches
def update_network(self, context, id, network):
pnet._raise_if_updates_provider_attributes(network['network'])
def get_ports(self, context, filters=None, fields=None):
with context.session.begin(subtransactions=True):
- quantum_lports = super(NvpPluginV2, self).get_ports(
+ neutron_lports = super(NvpPluginV2, self).get_ports(
context, filters)
- for quantum_lport in quantum_lports:
- self._extend_port_port_security_dict(context, quantum_lport)
- self._extend_port_mac_learning_state(context, quantum_lport)
+ for neutron_lport in neutron_lports:
+ self._extend_port_port_security_dict(context, neutron_lport)
+ self._extend_port_mac_learning_state(context, neutron_lport)
if (filters.get('network_id') and len(filters.get('network_id')) and
self._network_is_external(context, filters['network_id'][0])):
# Do not perform check on NVP platform
- return quantum_lports
+ return neutron_lports
vm_filter = ""
tenant_filter = ""
- # This is used when calling delete_network. Quantum checks to see if
+ # This is used when calling delete_network. Neutron checks to see if
# the network has any ports.
if filters.get("network_id"):
# FIXME (Aaron) If we get more than one network_id this won't work
raise nvp_exc.NvpPluginException(err_msg=err_msg)
lports = []
- for quantum_lport in quantum_lports:
- # if a quantum port is not found in NVP, this migth be because
+ for neutron_lport in neutron_lports:
+ # if a neutron port is not found in NVP, this migth be because
# such port is not mapped to a logical switch - ie: floating ip
- if quantum_lport['device_owner'] in (l3_db.DEVICE_OWNER_FLOATINGIP,
+ if neutron_lport['device_owner'] in (l3_db.DEVICE_OWNER_FLOATINGIP,
l3_db.DEVICE_OWNER_ROUTER_GW):
- lports.append(quantum_lport)
+ lports.append(neutron_lport)
continue
try:
- quantum_lport["admin_state_up"] = (
- nvp_lports[quantum_lport["id"]]["admin_status_enabled"])
+ neutron_lport["admin_state_up"] = (
+ nvp_lports[neutron_lport["id"]]["admin_status_enabled"])
- if (nvp_lports[quantum_lport["id"]]
+ if (nvp_lports[neutron_lport["id"]]
["_relations"]
["LogicalPortStatus"]
["fabric_status_up"]):
- quantum_lport["status"] = constants.PORT_STATUS_ACTIVE
+ neutron_lport["status"] = constants.PORT_STATUS_ACTIVE
else:
- quantum_lport["status"] = constants.PORT_STATUS_DOWN
+ neutron_lport["status"] = constants.PORT_STATUS_DOWN
- del nvp_lports[quantum_lport["id"]]
+ del nvp_lports[neutron_lport["id"]]
except KeyError:
- quantum_lport["status"] = constants.PORT_STATUS_ERROR
- LOG.debug(_("Quantum logical port %s was not found on NVP"),
- quantum_lport['id'])
+ neutron_lport["status"] = constants.PORT_STATUS_ERROR
+ LOG.debug(_("Neutron logical port %s was not found on NVP"),
+ neutron_lport['id'])
- lports.append(quantum_lport)
+ lports.append(neutron_lport)
# do not make the case in which ports are found in NVP
- # but not in Quantum catastrophic.
+ # but not in Neutron catastrophic.
if nvp_lports:
LOG.warning(_("Found %s logical ports not bound "
- "to Quantum ports. Quantum and NVP are "
+ "to Neutron ports. Neutron and NVP are "
"potentially out of sync"), len(nvp_lports))
if fields:
port_data = port['port']
notify_dhcp_agent = False
with context.session.begin(subtransactions=True):
- # First we allocate port in quantum database
- quantum_db = super(NvpPluginV2, self).create_port(context, port)
- # Update fields obtained from quantum db (eg: MAC address)
- port["port"].update(quantum_db)
+ # First we allocate port in neutron database
+ neutron_db = super(NvpPluginV2, self).create_port(context, port)
+ # Update fields obtained from neutron db (eg: MAC address)
+ port["port"].update(neutron_db)
# metadata_dhcp_host_route
if (cfg.CONF.NVP.metadata_mode == "dhcp_host_route" and
- quantum_db.get('device_owner') == constants.DEVICE_OWNER_DHCP):
- if (quantum_db.get('fixed_ips') and
- len(quantum_db['fixed_ips'])):
+ neutron_db.get('device_owner') == constants.DEVICE_OWNER_DHCP):
+ if (neutron_db.get('fixed_ips') and
+ len(neutron_db['fixed_ips'])):
notify_dhcp_agent = self._ensure_metadata_host_route(
- context, quantum_db['fixed_ips'][0])
+ context, neutron_db['fixed_ips'][0])
# port security extension checks
(port_security, has_ip) = self._determine_port_security_and_has_ip(
context, port_data)
elif mac_ext.MAC_LEARNING in port_data:
port_data.pop(mac_ext.MAC_LEARNING)
# provider networking extension checks
- # Fetch the network and network binding from Quantum db
+ # Fetch the network and network binding from neutron db
try:
port_data = port['port'].copy()
port_create_func = self._port_drivers['create'].get(
self.schedule_network(context, net)
if notify_dhcp_agent:
self._send_subnet_update_end(
- context, quantum_db['fixed_ips'][0]['subnet_id'])
+ context, neutron_db['fixed_ips'][0]['subnet_id'])
return port_data
def update_port(self, context, id, port):
# a l3 router. If so, we should prevent deletion here
if l3_port_check:
self.prevent_l3_port_deletion(context, id)
- quantum_db_port = self.get_port(context, id)
+ neutron_db_port = self.get_port(context, id)
# Perform the same check for ports owned by layer-2 gateways
if nw_gw_port_check:
self.prevent_network_gateway_port_deletion(context,
- quantum_db_port)
+ neutron_db_port)
port_delete_func = self._port_drivers['delete'].get(
- quantum_db_port['device_owner'],
+ neutron_db_port['device_owner'],
self._port_drivers['delete']['default'])
- port_delete_func(context, quantum_db_port)
+ port_delete_func(context, neutron_db_port)
self.disassociate_floatingips(context, id)
notify_dhcp_agent = False
with context.session.begin(subtransactions=True):
queue = self._get_port_queue_bindings(context, {'port_id': [id]})
# metadata_dhcp_host_route
- port_device_owner = quantum_db_port['device_owner']
+ port_device_owner = neutron_db_port['device_owner']
if (cfg.CONF.NVP.metadata_mode == "dhcp_host_route" and
port_device_owner == constants.DEVICE_OWNER_DHCP):
notify_dhcp_agent = self._ensure_metadata_host_route(
- context, quantum_db_port['fixed_ips'][0],
+ context, neutron_db_port['fixed_ips'][0],
is_delete=True)
super(NvpPluginV2, self).delete_port(context, id)
# Delete qos queue if possible
self.delete_qos_queue(context, queue[0]['queue_id'], False)
if notify_dhcp_agent:
self._send_subnet_update_end(
- context, quantum_db_port['fixed_ips'][0]['subnet_id'])
+ context, neutron_db_port['fixed_ips'][0]['subnet_id'])
def get_port(self, context, id, fields=None):
with context.session.begin(subtransactions=True):
- quantum_db_port = super(NvpPluginV2, self).get_port(context,
+ neutron_db_port = super(NvpPluginV2, self).get_port(context,
id, fields)
- self._extend_port_port_security_dict(context, quantum_db_port)
- self._extend_port_qos_queue(context, quantum_db_port)
- self._extend_port_mac_learning_state(context, quantum_db_port)
+ self._extend_port_port_security_dict(context, neutron_db_port)
+ self._extend_port_qos_queue(context, neutron_db_port)
+ self._extend_port_mac_learning_state(context, neutron_db_port)
if self._network_is_external(context,
- quantum_db_port['network_id']):
- return quantum_db_port
+ neutron_db_port['network_id']):
+ return neutron_db_port
nvp_id = self._nvp_get_port_id(context, self.cluster,
- quantum_db_port)
+ neutron_db_port)
# If there's no nvp IP do not bother going to NVP and put
# the port in error state
if nvp_id:
- # Find the NVP port corresponding to quantum port_id
+ # Find the NVP port corresponding to neutron port_id
# Do not query by nvp id as the port might be on
# an extended switch and we do not store the extended
# switch uuid
if results:
port = results[0]
port_status = port["_relations"]["LogicalPortStatus"]
- quantum_db_port["admin_state_up"] = (
+ neutron_db_port["admin_state_up"] = (
port["admin_status_enabled"])
if port_status["fabric_status_up"]:
- quantum_db_port["status"] = (
+ neutron_db_port["status"] = (
constants.PORT_STATUS_ACTIVE)
else:
- quantum_db_port["status"] = (
+ neutron_db_port["status"] = (
constants.PORT_STATUS_DOWN)
else:
- quantum_db_port["status"] = (
+ neutron_db_port["status"] = (
constants.PORT_STATUS_ERROR)
else:
- quantum_db_port["status"] = constants.PORT_STATUS_ERROR
- return quantum_db_port
+ neutron_db_port["status"] = constants.PORT_STATUS_ERROR
+ return neutron_db_port
def create_router(self, context, router):
# NOTE(salvatore-orlando): We completely override this method in
- # order to be able to use the NVP ID as Quantum ID
+ # order to be able to use the NVP ID as Neutron ID
# TODO(salvatore-orlando): Propose upstream patch for allowing
# 3rd parties to specify IDs as we do with l2 plugin
r = router['router']
lrouter = nvplib.create_lrouter(self.cluster, tenant_id,
router['router']['name'],
nexthop)
- # Use NVP identfier for Quantum resource
+ # Use NVP identfier for Neutron resource
router['router']['id'] = lrouter['uuid']
except NvpApiClient.NvpApiException:
raise nvp_exc.NvpPluginException(
nvplib.update_lrouter(self.cluster, id,
router['router'].get('name'), nexthop)
# NOTE(salv-orlando): The exception handling below is not correct, but
- # unfortunately nvplib raises a quantum notfound exception when an
+ # unfortunately nvplib raises a neutron notfound exception when an
# object is not found in the underlying backend
except q_exc.NotFound:
# Put the router in ERROR status
# cause the router delete operation to fail too.
self._handle_metadata_access_network(context, id, do_create=False)
super(NvpPluginV2, self).delete_router(context, id)
- # If removal is successful in Quantum it should be so on
+ # If removal is successful in Neutron it should be so on
# the NVP platform too - otherwise the transaction should
# be automatically aborted
# TODO(salvatore-orlando): Extend the object models in order to
router_op_status = constants.NET_STATUS_ERROR
if router_op_status != router.status:
LOG.debug(_("Current router status:%(router_status)s;"
- "Status in Quantum DB:%(db_router_status)s"),
+ "Status in Neutron DB:%(db_router_status)s"),
{'router_status': router_op_status,
'db_router_status': router.status})
# update the router status
router.status = constants.NET_STATUS_ERROR
# do not make the case in which routers are found in NVP
- # but not in Quantum catastrophic.
+ # but not in Neutron catastrophic.
if nvp_lrouters:
LOG.warning(_("Found %s logical routers not bound "
- "to Quantum routers. Quantum and NVP are "
+ "to Neutron routers. Neutron and NVP are "
"potentially out of sync"), len(nvp_lrouters))
return [self._make_router_dict(router, fields)
# Add port to the logical router as well
# The owner of the router port is always the same as the owner of the
# router. Use tenant_id from the port instead of fetching more records
- # from the Quantum database
- # Find the NVP port corresponding to quantum port_id
+ # from the Neutron database
+ # Find the NVP port corresponding to neutron port_id
results = nvplib.query_lswitch_lports(
self.cluster, '*',
filters={'tag': port_id, 'tag_scope': 'q_port_id'})
LOG.warning(_("The port %(port_id)s, connected to the router "
"%(router_id)s was not found on the NVP backend"),
{'port_id': port_id, 'router_id': router_id})
- # Finally remove the data from the Quantum DB
+ # Finally remove the data from the Neutron DB
# This will also destroy the port on the logical switch
info = super(NvpPluginV2, self).remove_router_interface(
context, router_id, interface_info)
# Destroy router port (no need to unplug the attachment)
- # FIXME(salvatore-orlando): In case of failures in the Quantum plugin
+ # FIXME(salvatore-orlando): In case of failures in the Neutron plugin
# this migth leave a dangling port. We perform the operation here
# to leverage validation performed in the base class
if not lrouter_port_id:
LOG.warning(_("Unable to find NVP logical router port for "
- "Quantum port id:%s. Was this port ever paired "
+ "Neutron port id:%s. Was this port ever paired "
"with a logical router?"), port_id)
return info
router_id = fip_db.router_id
nvp_gw_port_id = nvplib.find_router_gw_port(
context, self.cluster, router_id)['uuid']
- ext_quantum_port_db = self._get_port(context.elevated(),
+ ext_neutron_port_db = self._get_port(context.elevated(),
fip_db.floating_port_id)
nvp_floating_ips = self._build_ip_address_list(
- context.elevated(), ext_quantum_port_db['fixed_ips'])
+ context.elevated(), ext_neutron_port_db['fixed_ips'])
nvplib.update_lrouter_port_ips(self.cluster,
router_id,
nvp_gw_port_id,
"""Create a layer-2 network gateway.
Create the gateway service on NVP platform and corresponding data
- structures in Quantum datase.
+ structures in Neutron datase.
"""
# Ensure the default gateway in the config file is in sync with the db
self._ensure_default_network_gateway()
"""Remove a layer-2 network gateway.
Remove the gateway service from NVP platform and corresponding data
- structures in Quantum datase.
+ structures in Neutron datase.
"""
# Ensure the default gateway in the config file is in sync with the db
self._ensure_default_network_gateway()
import httplib # basic HTTP library for HTTPS connections
import logging
-from quantum.plugins.nicira.api_client import (
+from neutron.plugins.nicira.api_client import (
client_eventlet, request_eventlet)
LOG = logging.getLogger("NVPApiHelper")
Overview and pre-requisites
- This is a Quantum plugin that can talk to a set of NVP controllers and
- implements the core Quantum v2 api. In order to use it you must have
- Nicira NVP running and configured. You must also have Quantum installed
+ This is a Neutron plugin that can talk to a set of NVP controllers and
+ implements the core Neutron v2 api. In order to use it you must have
+ Nicira NVP running and configured. You must also have Neutron installed
and configured.
NVP Plugin configuration
1) Database configuration
- The NVP plugin leverages the Quantum database. The following connection
+ The NVP plugin leverages the Neutron database. The following connection
parameters should be specified:
- connection: Database connection string
- max_retries: Maximum number of connection attempts (default 10)
- nvp_gen_timout: Number of seconds a generation id should be valid for
(default -1 meaning do not time out)
3) NVP cluster
- By default the Quantum NVP plugin can talk to multiple controllers in a
+ By default the Neutron NVP plugin can talk to multiple controllers in a
single cluster. In the future (Havana+) support for multiple clusters
will be added.
The following parameters can be configured:
- default_tz_uuid: This is uuid of the default NVP Transport zone that
- will be used for creating tunneled isolated "Quantum" networks. It
- needs to be created in NVP before starting Quantum with the nvp plugin.
+ will be used for creating tunneled isolated "Neutron" networks. It
+ needs to be created in NVP before starting Neutron with the nvp plugin.
- nvp_cluster_uuid: Optional paramter identifying the UUID of the cluster
in NVP. This can be retrieved from NVP management console "admin" section.
- nvp_controllers: describes the list of controllers
- More details can be found in etc/quantum/plugins/nicira/nvp.ini
+ More details can be found in etc/neutron/plugins/nicira/nvp.ini
-Quantum Configuration
+Neutron Configuration
- Modify your Quantum configuration for using the NVP Plugin:
+ Modify your Neutron configuration for using the NVP Plugin:
core_plugin =
- quantum.plugins.nicira.QuantumPlugin.NvpPluginV2
+ neutron.plugins.nicira.neutronPlugin.NvpPluginV2
import time
-from quantum.plugins.nicira.api_client.common import (
+from neutron.plugins.nicira.api_client.common import (
_conn_str)
import logging
import time
-from quantum.plugins.nicira.api_client import client
-from quantum.plugins.nicira.api_client import request_eventlet
+from neutron.plugins.nicira.api_client import client
+from neutron.plugins.nicira.api_client import request_eventlet
eventlet.monkey_patch()
import time
import urlparse
-from quantum.openstack.common import excutils
-from quantum.plugins.nicira.api_client.common import (
+from neutron.openstack.common import excutils
+from neutron.plugins.nicira.api_client.common import (
_conn_str)
import logging
import urllib
-from quantum.plugins.nicira.api_client import request
+from neutron.plugins.nicira.api_client import request
eventlet.monkey_patch()
logging.basicConfig(level=logging.INFO)
LOG = logging.getLogger(__name__)
-USER_AGENT = "NVP Quantum eventlet client/2.0"
+USER_AGENT = "NVP Neutron eventlet client/2.0"
class NvpApiRequestEventlet(request.NvpApiRequest):
'''Eventlet-based ApiRequest class.
This class will form the basis for eventlet-based ApiRequest classes
- (e.g. those used by the Quantum NVP Plugin).
+ (e.g. those used by the Neutron NVP Plugin).
'''
# Maximum number of green threads present in the system at one time.
from oslo.config import cfg
-from quantum.common import config
-from quantum.plugins.nicira.common import config as nvp_cfg # noqa
-from quantum.plugins.nicira import nvplib
-from quantum.plugins.nicira import QuantumPlugin
+from neutron.common import config
+from neutron.plugins.nicira.common import config as nvp_cfg # noqa
+from neutron.plugins.nicira import NeutronPlugin
+from neutron.plugins.nicira import nvplib
config.setup_logging(cfg.CONF)
print "\tretries: %s" % cfg.CONF.retries
print "\tredirects: %s" % cfg.CONF.redirects
print "\thttp_timeout: %s" % cfg.CONF.http_timeout
- cluster = QuantumPlugin.create_nvp_cluster(
+ cluster = NeutronPlugin.create_nvp_cluster(
cfg.CONF,
cfg.CONF.NVP.concurrent_connections,
cfg.CONF.NVP.nvp_gen_timeout)
from oslo.config import cfg
-from quantum import scheduler
+from neutron import scheduler
nvp_opts = [
cfg.IntOpt('max_lp_per_bridged_ls', default=64,
cfg.StrOpt('metadata_mode', default='access_network',
help=_("If set to access_network this enables a dedicated "
"connection to the metadata proxy for metadata server "
- "access via Quantum router. If set to dhcp_host_route "
+ "access via Neutron router. If set to dhcp_host_route "
"this enables host route injection via the dhcp agent. "
"This option is only useful if running on a host that "
"does not support namespaces otherwise access_network "
"should be used.")),
cfg.BoolOpt('enable_metadata_access_network', default=True,
help=_("Enables dedicated connection to the metadata proxy "
- "for metadata server access via Quantum router")),
+ "for metadata server access via Neutron router")),
cfg.StrOpt('default_transport_type', default='stt',
help=_("The default network tranport type to use (stt, gre, "
"bridge, ipsec_gre, or ipsec_stt)")),
cfg.StrOpt('default_tz_uuid',
help=_("This is uuid of the default NVP Transport zone that "
"will be used for creating tunneled isolated "
- "\"Quantum\" networks. It needs to be created in NVP "
- "before starting Quantum with the nvp plugin.")),
+ "\"Neutron\" networks. It needs to be created in NVP "
+ "before starting Neutron with the nvp plugin.")),
cfg.StrOpt('nvp_cluster_uuid',
help=_("Optional paramter identifying the UUID of the cluster "
"in NVP. This can be retrieved from NVP management "
"""NVP Plugin exceptions"""
-from quantum.common import exceptions as q_exc
+from neutron.common import exceptions as q_exc
-class NvpPluginException(q_exc.QuantumException):
+class NvpPluginException(q_exc.NeutronException):
message = _("An unexpected error occurred in the NVP Plugin:%(err_msg)s")
import netaddr
from oslo.config import cfg
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.common import constants
-from quantum.common import exceptions as q_exc
-from quantum.db import l3_db
-from quantum.db import models_v2
-from quantum.openstack.common import log as logging
-from quantum.plugins.nicira.common import exceptions as nvp_exc
-from quantum.plugins.nicira import NvpApiClient
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.common import constants
+from neutron.common import exceptions as q_exc
+from neutron.db import l3_db
+from neutron.db import models_v2
+from neutron.openstack.common import log as logging
+from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira import NvpApiClient
LOG = logging.getLogger(__name__)
return port
def _create_metadata_access_network(self, context, router_id):
- # This will still ensure atomicity on Quantum DB
+ # This will still ensure atomicity on Neutron DB
with context.session.begin(subtransactions=True):
# Add network
# Network name is likely to be truncated on NVP
'network.create.end')
def _destroy_metadata_access_network(self, context, router_id, ports):
- # This will still ensure atomicity on Quantum DB
+ # This will still ensure atomicity on Neutron DB
with context.session.begin(subtransactions=True):
if ports:
meta_port = self._find_metadata_port(context, ports)
"created or destroyed"), router_id)
# TODO(salvatore-orlando): A better exception handling in the
# NVP plugin would allow us to improve error handling here
- except (q_exc.QuantumException, nvp_exc.NvpPluginException,
+ except (q_exc.NeutronException, nvp_exc.NvpPluginException,
NvpApiClient.NvpApiException):
# Any exception here should be regarded as non-fatal
LOG.exception(_("An error occurred while operating on the "
#
# @author: Aaron Rosen, Nicira Networks, Inc.
-from quantum.extensions import securitygroup as ext_sg
+from neutron.extensions import securitygroup as ext_sg
# Protocol number look up for supported protocols
protocol_num_look_up = {'tcp': 6, 'icmp': 1, 'udp': 17}
class NVPSecurityGroups(object):
def _convert_to_nvp_rule(self, rule, with_id=False):
- """Converts Quantum API security group rule to NVP API."""
+ """Converts Neutron API security group rule to NVP API."""
nvp_rule = {}
params = ['remote_ip_prefix', 'protocol',
'remote_group_id', 'port_range_min',
return nvp_rule
def _convert_to_nvp_rules(self, rules, with_id=False):
- """Converts a list of Quantum API security group rules to NVP API."""
+ """Converts a list of Neutron API security group rules to NVP API."""
nvp_rules = {'logical_port_ingress_rules': [],
'logical_port_egress_rules': []}
for direction in ['logical_port_ingress_rules',
def _get_security_group_rules_nvp_format(self, context, security_group_id,
with_id=False):
- """Query quantum db for security group rules."""
+ """Query neutron db for security group rules."""
fields = ['remote_ip_prefix', 'remote_group_id', 'protocol',
'port_range_min', 'port_range_max', 'protocol', 'ethertype']
if with_id:
import sqlalchemy as sa
from sqlalchemy.orm import exc
-from quantum.db import model_base
-from quantum.openstack.common import log as logging
-from quantum.plugins.nicira.extensions import maclearning as mac
+from neutron.db import model_base
+from neutron.openstack.common import log as logging
+from neutron.plugins.nicira.extensions import maclearning as mac
LOG = logging.getLogger(__name__)
from sqlalchemy.orm import exc
-import quantum.db.api as db
-from quantum.openstack.common import log as logging
-from quantum.plugins.nicira.dbexts import nicira_models
-from quantum.plugins.nicira.dbexts import nicira_networkgw_db
+import neutron.db.api as db
+from neutron.openstack.common import log as logging
+from neutron.plugins.nicira.dbexts import nicira_models
+from neutron.plugins.nicira.dbexts import nicira_networkgw_db
LOG = logging.getLogger(__name__)
return binding
-def add_quantum_nvp_port_mapping(session, quantum_id, nvp_id):
+def add_neutron_nvp_port_mapping(session, neutron_id, nvp_id):
with session.begin(subtransactions=True):
- mapping = nicira_models.QuantumNvpPortMapping(quantum_id, nvp_id)
+ mapping = nicira_models.NeutronNvpPortMapping(neutron_id, nvp_id)
session.add(mapping)
return mapping
-def get_nvp_port_id(session, quantum_id):
+def get_nvp_port_id(session, neutron_id):
try:
- mapping = (session.query(nicira_models.QuantumNvpPortMapping).
- filter_by(quantum_id=quantum_id).
+ mapping = (session.query(nicira_models.NeutronNvpPortMapping).
+ filter_by(quantum_id=neutron_id).
one())
return mapping['nvp_id']
except exc.NoResultFound:
from sqlalchemy import Column, Enum, ForeignKey, Integer, String
-from quantum.db.models_v2 import model_base
+from neutron.db.models_v2 import model_base
class NvpNetworkBinding(model_base.BASEV2):
"""Represents a binding of a virtual network with a transport zone.
- This model class associates a Quantum network with a transport zone;
+ This model class associates a Neutron network with a transport zone;
optionally a vlan ID might be used if the binding type is 'bridge'
"""
__tablename__ = 'nvp_network_bindings'
self.vlan_id)
-class QuantumNvpPortMapping(model_base.BASEV2):
- """Represents the mapping between quantum and nvp port uuids."""
+class NeutronNvpPortMapping(model_base.BASEV2):
+ """Represents the mapping between neutron and nvp port uuids."""
__tablename__ = 'quantum_nvp_port_mapping'
quantum_id = Column(String(36),
from sqlalchemy.orm import exc as sa_orm_exc
from webob import exc as web_exc
-from quantum.api.v2 import attributes
-from quantum.api.v2 import base
-from quantum.common import exceptions
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nicira.extensions import nvp_networkgw
+from neutron.api.v2 import attributes
+from neutron.api.v2 import base
+from neutron.common import exceptions
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nicira.extensions import nvp_networkgw
LOG = logging.getLogger(__name__)
class GatewayInUse(exceptions.InUse):
message = _("Network Gateway '%(gateway_id)s' still has active mappings "
- "with one or more quantum networks.")
+ "with one or more neutron networks.")
class NetworkGatewayPortInUse(exceptions.InUse):
"network gateway '%(gateway_id)s'.")
-class MultipleGatewayConnections(exceptions.QuantumException):
+class MultipleGatewayConnections(exceptions.NeutronException):
message = _("Multiple network connections found on '%(gateway_id)s' "
"with provided criteria.")
import sqlalchemy as sa
from sqlalchemy.orm import exc
-from quantum.api.v2 import attributes as attr
-from quantum.db import model_base
-from quantum.db import models_v2
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nicira.extensions import nvp_qos as ext_qos
-from quantum.plugins.nicira import nvplib
+from neutron.api.v2 import attributes as attr
+from neutron.db import model_base
+from neutron.db import models_v2
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nicira.extensions import nvp_qos as ext_qos
+from neutron.plugins.nicira import nvplib
class QoSQueue(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
#
-from quantum.api.v2 import attributes
+from neutron.api.v2 import attributes
MAC_LEARNING = 'mac_learning_enabled'
from oslo.config import cfg
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.api.v2 import base
-from quantum import manager
-from quantum import quota
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.api.v2 import base
+from neutron import manager
+from neutron import quota
RESOURCE_NAME = "network_gateway"
IFACE_NAME_ATTR = 'interface_name'
# Attribute Map for Network Gateway Resource
-# TODO(salvatore-orlando): add admin state as other quantum resources
+# TODO(salvatore-orlando): add admin state as other neutron resources
RESOURCE_ATTRIBUTE_MAP = {
COLLECTION_NAME: {
'id': {'allow_post': False, 'allow_put': False,
class Nvp_networkgw(object):
"""API extension for Layer-2 Gateway support.
- The Layer-2 gateway feature allows for connecting quantum networks
+ The Layer-2 gateway feature allows for connecting neutron networks
with external networks at the layer-2 level. No assumption is made on
the location of the external network, which might not even be directly
reachable from the hosts where the VMs are deployed.
This is achieved by instantiating 'network gateways', and then connecting
- Quantum network to them.
+ Neutron network to them.
"""
@classmethod
def get_name(cls):
- return "Quantum-NVP Network Gateway"
+ return "Neutron-NVP Network Gateway"
@classmethod
def get_alias(cls):
@classmethod
def get_description(cls):
- return "Connects Quantum networks with external networks at layer 2"
+ return "Connects Neutron networks with external networks at layer 2"
@classmethod
def get_namespace(cls):
- return "http://docs.openstack.org/ext/quantum/network-gateway/api/v1.0"
+ return "http://docs.openstack.org/ext/neutron/network-gateway/api/v1.0"
@classmethod
def get_updated(cls):
@classmethod
def get_resources(cls):
"""Returns Ext Resources."""
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
params = RESOURCE_ATTRIBUTE_MAP.get(COLLECTION_NAME, dict())
member_actions = {'connect_network': 'PUT',
from abc import abstractmethod
-from quantum.api import extensions
-from quantum.api.v2 import attributes as attr
-from quantum.api.v2 import base
-from quantum.common import exceptions as qexception
-from quantum import manager
+from neutron.api import extensions
+from neutron.api.v2 import attributes as attr
+from neutron.api.v2 import base
+from neutron.common import exceptions as qexception
+from neutron import manager
# For policy.json/Auth
def get_resources(cls):
"""Returns Ext Resources."""
exts = []
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
resource_name = 'qos_queue'
collection_name = resource_name.replace('_', '-') + "s"
params = RESOURCE_ATTRIBUTE_MAP.get(resource_name + "s", dict())
from oslo.config import cfg
-from quantum.openstack.common import log as logging
-from quantum.plugins.nicira.common import exceptions
+from neutron.openstack.common import log as logging
+from neutron.plugins.nicira.common import exceptions
LOG = logging.getLogger(__name__)
DEFAULT_PORT = 443
from oslo.config import cfg
#FIXME(danwent): I'd like this file to get to the point where it has
-# no quantum-specific logic in it
-from quantum.common import constants
-from quantum.common import exceptions as exception
-from quantum.openstack.common import log
-from quantum.plugins.nicira.common import (
+# no neutron-specific logic in it
+from neutron.common import constants
+from neutron.common import exceptions as exception
+from neutron.openstack.common import log
+from neutron.plugins.nicira.common import (
exceptions as nvp_exc)
-from quantum.plugins.nicira import NvpApiClient
+from neutron.plugins.nicira import NvpApiClient
LOG = log.getLogger(__name__)
LSWITCH_RESOURCE = "lswitch"
LSWITCHPORT_RESOURCE = "lport/%s" % LSWITCH_RESOURCE
LROUTER_RESOURCE = "lrouter"
-# Current quantum version
+# Current neutron version
LROUTERPORT_RESOURCE = "lport/%s" % LROUTER_RESOURCE
LROUTERNAT_RESOURCE = "nat/lrouter"
LQUEUE_RESOURCE = "lqueue"
GWSERVICE_RESOURCE = "gateway-service"
-QUANTUM_VERSION = "2013.1"
+NEUTRON_VERSION = "2013.1"
# Other constants for NVP resource
MAX_DISPLAY_NAME_LEN = 40
# Constants for NAT rules
# -------------------------------------------------------------------
# Network functions
# -------------------------------------------------------------------
-def get_lswitches(cluster, quantum_net_id):
- lswitch_uri_path = _build_uri_path(LSWITCH_RESOURCE, quantum_net_id,
+def get_lswitches(cluster, neutron_net_id):
+ lswitch_uri_path = _build_uri_path(LSWITCH_RESOURCE, neutron_net_id,
relations="LogicalSwitchStatus")
results = []
try:
LSWITCH_RESOURCE,
fields="uuid,display_name,tags,lport_count",
relations="LogicalSwitchStatus",
- filters={'tag': quantum_net_id,
+ filters={'tag': neutron_net_id,
'tag_scope': 'quantum_net_id'})
extra_switches = get_all_query_pages(extra_lswitch_uri_path,
cluster)
results.extend(extra_switches)
return results
except exception.NotFound:
- raise exception.NetworkNotFound(net_id=quantum_net_id)
+ raise exception.NetworkNotFound(net_id=neutron_net_id)
def create_lswitch(cluster, tenant_id, display_name,
transport_type=None,
transport_zone_uuid=None,
vlan_id=None,
- quantum_net_id=None,
+ neutron_net_id=None,
shared=None,
**kwargs):
nvp_binding_type = transport_type
lswitch_obj = {"display_name": _check_and_truncate_name(display_name),
"transport_zones": [transport_zone_config],
"tags": [{"tag": tenant_id, "scope": "os_tid"},
- {"tag": QUANTUM_VERSION, "scope": "quantum"}]}
+ {"tag": NEUTRON_VERSION, "scope": "quantum"}]}
if nvp_binding_type == 'bridge' and vlan_id:
transport_zone_config["binding_config"] = {"vlan_translation":
[{"transport": vlan_id}]}
- if quantum_net_id:
- lswitch_obj["tags"].append({"tag": quantum_net_id,
+ if neutron_net_id:
+ lswitch_obj["tags"].append({"tag": neutron_net_id,
"scope": "quantum_net_id"})
if shared:
lswitch_obj["tags"].append({"tag": "true",
uri = _build_uri_path(LSWITCH_RESOURCE, resource_id=lswitch_id)
lswitch_obj = {"display_name": _check_and_truncate_name(display_name),
"tags": [{"tag": tenant_id, "scope": "os_tid"},
- {"tag": QUANTUM_VERSION, "scope": "quantum"}]}
+ {"tag": NEUTRON_VERSION, "scope": "quantum"}]}
if "tags" in kwargs:
lswitch_obj["tags"].extend(kwargs["tags"])
try:
with the NVP controller
"""
tags = [{"tag": tenant_id, "scope": "os_tid"},
- {"tag": QUANTUM_VERSION, "scope": "quantum"}]
+ {"tag": NEUTRON_VERSION, "scope": "quantum"}]
# NOTE(salvatore-orlando): This is a little confusing, but device_id in
# NVP is actually the identifier a physical interface on the gateway
- # device, which in the Quantum API is referred as interface_name
+ # device, which in the Neutron API is referred as interface_name
gateways = [{"transport_node_uuid": device['id'],
"device_id": device['interface_name'],
"type": "L2Gateway"} for device in devices]
"""
display_name = _check_and_truncate_name(display_name)
tags = [{"tag": tenant_id, "scope": "os_tid"},
- {"tag": QUANTUM_VERSION, "scope": "quantum"}]
+ {"tag": NEUTRON_VERSION, "scope": "quantum"}]
lrouter_obj = {
"display_name": display_name,
"tags": tags,
raise exception.PortNotFound(net_id=switch,
port_id=port)
except NvpApiClient.NvpApiException:
- raise exception.QuantumException()
+ raise exception.NeutronException()
-def get_port_by_quantum_tag(cluster, lswitch_uuid, quantum_port_id):
- """Get port by quantum tag.
+def get_port_by_neutron_tag(cluster, lswitch_uuid, neutron_port_id):
+ """Get port by neutron tag.
Returns the NVP UUID of the logical port with tag q_port_id equal to
- quantum_port_id or None if the port is not Found.
+ neutron_port_id or None if the port is not Found.
"""
uri = _build_uri_path(LSWITCHPORT_RESOURCE,
parent_resource_id=lswitch_uuid,
fields='uuid',
- filters={'tag': quantum_port_id,
+ filters={'tag': neutron_port_id,
'tag_scope': 'q_port_id'})
- LOG.debug(_("Looking for port with q_port_id tag '%(quantum_port_id)s' "
+ LOG.debug(_("Looking for port with q_port_id tag '%(neutron_port_id)s' "
"on: '%(lswitch_uuid)s'") %
- {'quantum_port_id': quantum_port_id,
+ {'neutron_port_id': neutron_port_id,
'lswitch_uuid': lswitch_uuid})
res = do_request(HTTP_GET, uri, cluster=cluster)
num_results = len(res["results"])
if num_results >= 1:
if num_results > 1:
LOG.warn(_("Found '%(num_ports)d' ports with "
- "q_port_id tag: '%(quantum_port_id)s'. "
+ "q_port_id tag: '%(neutron_port_id)s'. "
"Only 1 was expected.") %
{'num_ports': num_results,
- 'quantum_port_id': quantum_port_id})
+ 'neutron_port_id': neutron_port_id})
return res["results"][0]
lport_obj["type"] = "LogicalSwitchPortConfig"
-def update_port(cluster, lswitch_uuid, lport_uuid, quantum_port_id, tenant_id,
+def update_port(cluster, lswitch_uuid, lport_uuid, neutron_port_id, tenant_id,
display_name, device_id, admin_status_enabled,
mac_address=None, fixed_ips=None, port_security_enabled=None,
security_profiles=None, queue_id=None,
admin_status_enabled=admin_status_enabled,
display_name=_check_and_truncate_name(display_name),
tags=[dict(scope='os_tid', tag=tenant_id),
- dict(scope='q_port_id', tag=quantum_port_id),
+ dict(scope='q_port_id', tag=neutron_port_id),
dict(scope='vm_id', tag=hashed_device_id),
- dict(scope='quantum', tag=QUANTUM_VERSION)])
+ dict(scope='quantum', tag=NEUTRON_VERSION)])
_configure_extensions(lport_obj, mac_address, fixed_ips,
port_security_enabled, security_profiles,
raise exception.PortNotFound(port_id=lport_uuid, net_id=lswitch_uuid)
-def create_lport(cluster, lswitch_uuid, tenant_id, quantum_port_id,
+def create_lport(cluster, lswitch_uuid, tenant_id, neutron_port_id,
display_name, device_id, admin_status_enabled,
mac_address=None, fixed_ips=None, port_security_enabled=None,
security_profiles=None, queue_id=None,
admin_status_enabled=admin_status_enabled,
display_name=display_name,
tags=[dict(scope='os_tid', tag=tenant_id),
- dict(scope='q_port_id', tag=quantum_port_id),
+ dict(scope='q_port_id', tag=neutron_port_id),
dict(scope='vm_id', tag=hashed_device_id),
- dict(scope='quantum', tag=QUANTUM_VERSION)],
+ dict(scope='quantum', tag=NEUTRON_VERSION)],
)
_configure_extensions(lport_obj, mac_address, fixed_ips,
return result
-def create_router_lport(cluster, lrouter_uuid, tenant_id, quantum_port_id,
+def create_router_lport(cluster, lrouter_uuid, tenant_id, neutron_port_id,
display_name, admin_status_enabled, ip_addresses):
"""Creates a logical port on the assigned logical router."""
tags = [dict(scope='os_tid', tag=tenant_id),
- dict(scope='q_port_id', tag=quantum_port_id),
- dict(scope='quantum', tag=QUANTUM_VERSION)]
+ dict(scope='q_port_id', tag=neutron_port_id),
+ dict(scope='quantum', tag=NEUTRON_VERSION)]
lport_obj = dict(
admin_status_enabled=admin_status_enabled,
def update_router_lport(cluster, lrouter_uuid, lrouter_port_uuid,
- tenant_id, quantum_port_id, display_name,
+ tenant_id, neutron_port_id, display_name,
admin_status_enabled, ip_addresses):
"""Updates a logical port on the assigned logical router."""
lport_obj = dict(
admin_status_enabled=admin_status_enabled,
display_name=display_name,
tags=[dict(scope='os_tid', tag=tenant_id),
- dict(scope='q_port_id', tag=quantum_port_id),
- dict(scope='quantum', tag=QUANTUM_VERSION)],
+ dict(scope='q_port_id', tag=neutron_port_id),
+ dict(scope='quantum', tag=NEUTRON_VERSION)],
ip_addresses=ip_addresses,
type="LogicalRouterPortConfig"
)
"""Retrieves the external gateway port for a NVP logical router."""
# Find the uuid of nvp ext gw logical router port
- # TODO(salvatore-orlando): Consider storing it in Quantum DB
+ # TODO(salvatore-orlando): Consider storing it in Neutron DB
results = query_lrouter_lports(
cluster, router_id,
relations="LogicalPortAttachment")
[{'ethertype': 'IPv4'},
{'ethertype': 'IPv6'}]}
tags = [dict(scope='os_tid', tag=tenant_id),
- dict(scope='quantum', tag=QUANTUM_VERSION)]
+ dict(scope='quantum', tag=NEUTRON_VERSION)]
display_name = _check_and_truncate_name(security_profile.get('name'))
body = mk_body(
tags=tags, display_name=display_name,
rsp = do_request(HTTP_PUT, path, body, cluster=cluster)
except exception.NotFound as e:
LOG.error(format_exception("Unknown", e, locals()))
- #FIXME(salvatore-orlando): This should not raise QuantumException
- raise exception.QuantumException()
+ #FIXME(salvatore-orlando): This should not raise NeutronException
+ raise exception.NeutronException()
LOG.debug(_("Updated Security Profile: %s"), rsp)
return rsp
try:
do_request(HTTP_DELETE, path, cluster=cluster)
except exception.NotFound as e:
- # FIXME(salv-orlando): should not raise QuantumException
+ # FIXME(salv-orlando): should not raise NeutronException
LOG.error(format_exception("Unknown", e, locals()))
- raise exception.QuantumException()
+ raise exception.NeutronException()
def _create_nat_match_obj(**kwargs):
# -----------------------------------------------------------------------------
def create_lqueue(cluster, lqueue):
uri = _build_uri_path(LQUEUE_RESOURCE)
- lqueue['tags'] = [{'tag': QUANTUM_VERSION, 'scope': 'quantum'}]
+ lqueue['tags'] = [{'tag': NEUTRON_VERSION, 'scope': 'quantum'}]
try:
return do_request(HTTP_POST, uri, json.dumps(lqueue),
cluster=cluster)['uuid']
except NvpApiClient.NvpApiException:
# FIXME(salv-orlando): This should not raise QauntumException
LOG.exception(_("Failed to create logical queue"))
- raise exception.QuantumException()
+ raise exception.NeutronException()
def delete_lqueue(cluster, id):
except Exception:
# FIXME(salv-orlando): This should not raise QauntumException
LOG.exception(_("Failed to delete logical queue"))
- raise exception.QuantumException()
+ raise exception.NeutronException()
# -----------------------------------------------------------------------------
-The Open vSwitch (OVS) Quantum plugin is a simple plugin to manage OVS
+The Open vSwitch (OVS) Neutron plugin is a simple plugin to manage OVS
features using a local agent running on each hypervisor.
For details on how to configure and use the plugin, see:
import eventlet
from oslo.config import cfg
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import ovs_lib
-from quantum.agent import rpc as agent_rpc
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.common import config as logging_config
-from quantum.common import constants as q_const
-from quantum.common import topics
-from quantum.common import utils as q_utils
-from quantum import context
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
-from quantum.openstack.common.rpc import common as rpc_common
-from quantum.openstack.common.rpc import dispatcher
-from quantum.plugins.openvswitch.common import config # noqa
-from quantum.plugins.openvswitch.common import constants
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import ovs_lib
+from neutron.agent import rpc as agent_rpc
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.common import config as logging_config
+from neutron.common import constants as q_const
+from neutron.common import legacy
+from neutron.common import topics
+from neutron.common import utils as q_utils
+from neutron import context
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
+from neutron.openstack.common.rpc import common as rpc_common
+from neutron.openstack.common.rpc import dispatcher
+from neutron.plugins.openvswitch.common import config # noqa
+from neutron.plugins.openvswitch.common import constants
LOG = logging.getLogger(__name__)
class Port(object):
- """Represents a quantum port.
+ """Represents a neutron port.
Class stores port data in a ORM-free way, so attributres are
still available even if a row has been deleted.
self.init_firewall()
-class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
+class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
'''Implements OVS-based tunneling, VLANs and flat networks.
Two local bridges are created: an integration bridge (defaults to
if self.enable_tunneling:
self.setup_tunnel_br(tun_br)
self.agent_state = {
- 'binary': 'quantum-openvswitch-agent',
+ 'binary': 'neutron-openvswitch-agent',
'host': cfg.CONF.host,
'topic': q_const.L2_AGENT_TOPIC,
'configurations': bridge_mappings,
def main():
eventlet.monkey_patch()
- cfg.CONF(project='quantum')
cfg.CONF.register_opts(ip_lib.OPTS)
+ cfg.CONF(project='neutron')
logging_config.setup_logging(cfg.CONF)
+ legacy.modernize_quantum_config(cfg.CONF)
try:
agent_config = create_agent_config_map(cfg.CONF)
# commands target xen dom0 rather than domU.
cfg.CONF.set_default('ip_lib_force_root', True)
- plugin = OVSQuantumAgent(**agent_config)
+ plugin = OVSNeutronAgent(**agent_config)
# Start everything.
LOG.info(_("Agent initialized successfully, now running... "))
and install the rpm by running the following command (from dom0):
- rpm -i openstack-quantum-xen-plugins.rpm
+ rpm -i openstack-neutron-xen-plugins.rpm
set -eux
thisdir=$(dirname $(readlink -f "$0"))
-export QUANTUM_ROOT="$thisdir/../../../../../../"
-export PYTHONPATH=$QUANTUM_ROOT
+export NEUTRON_ROOT="$thisdir/../../../../../../"
+export PYTHONPATH=$NEUTRON_ROOT
-cd $QUANTUM_ROOT
-VERSION=$(sh -c "(cat $QUANTUM_ROOT/quantum/version.py; \
- echo 'print common_version.VersionInfo(\"quantum\").release_string()') | \
+cd $NEUTRON_ROOT
+VERSION=$(sh -c "(cat $NEUTRON_ROOT/neutron/version.py; \
+ echo 'print common_version.VersionInfo(\"neutron\").release_string()') | \
python")
cd -
-PACKAGE=openstack-quantum-xen-plugins
+PACKAGE=openstack-neutron-xen-plugins
RPMBUILD_DIR=$PWD/rpmbuild
if [ ! -d $RPMBUILD_DIR ]; then
echo $RPMBUILD_DIR is missing
-Name: openstack-quantum-xen-plugins
+Name: openstack-neutron-xen-plugins
Version: %{version}
Release: 1
Summary: Files for XenAPI support.
License: ASL 2.0
Group: Applications/Utilities
-Source0: openstack-quantum-xen-plugins.tar.gz
+Source0: openstack-neutron-xen-plugins.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%define debug_package %{nil}
%description
-This package contains files that are required for XenAPI support for Quantum.
+This package contains files that are required for XenAPI support for Neutron.
%prep
-%setup -q -n openstack-quantum-xen-plugins
+%setup -q -n openstack-neutron-xen-plugins
%install
rm -rf $RPM_BUILD_ROOT
#
import gettext
-gettext.install('quantum', unicode=1)
+gettext.install('neutron', unicode=1)
try:
import json
except ImportError:
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.plugins.openvswitch.common import constants
-from quantum import scheduler
+from neutron.agent.common import config
+from neutron.plugins.openvswitch.common import constants
+from neutron import scheduler
DEFAULT_BRIDGE_MAPPINGS = []
from sqlalchemy.orm import exc
from sqlalchemy.sql import func
-from quantum.common import exceptions as q_exc
-import quantum.db.api as db
-from quantum.db import models_v2
-from quantum.db import securitygroups_db as sg_db
-from quantum.extensions import securitygroup as ext_sg
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum.plugins.openvswitch.common import constants
-from quantum.plugins.openvswitch import ovs_models_v2
+from neutron.common import exceptions as q_exc
+import neutron.db.api as db
+from neutron.db import models_v2
+from neutron.db import securitygroups_db as sg_db
+from neutron.extensions import securitygroup as ext_sg
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron.plugins.openvswitch.common import constants
+from neutron.plugins.openvswitch import ovs_models_v2
LOG = logging.getLogger(__name__)
if not port_and_sgs:
return None
port = port_and_sgs[0][0]
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin._make_port_dict(port)
port_dict[ext_sg.SECURITYGROUPS] = [
sg_id for port_, sg_id in port_and_sgs if sg_id]
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
-from quantum.db.models_v2 import model_base
+from neutron.db.models_v2 import model_base
class VlanAllocation(model_base.BASEV2):
from oslo.config import cfg
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.rpc.agentnotifiers import l3_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.common import constants as q_const
-from quantum.common import exceptions as q_exc
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.common import utils
-from quantum.db import agents_db
-from quantum.db import agentschedulers_db
-from quantum.db import db_base_plugin_v2
-from quantum.db import dhcp_rpc_base
-from quantum.db import extraroute_db
-from quantum.db import l3_gwmode_db
-from quantum.db import l3_rpc_base
-from quantum.db import portbindings_db
-from quantum.db import quota_db # noqa
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.extensions import portbindings
-from quantum.extensions import providernet as provider
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.common import utils as plugin_utils
-from quantum.plugins.openvswitch.common import config # noqa
-from quantum.plugins.openvswitch.common import constants
-from quantum.plugins.openvswitch import ovs_db_v2
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.common import constants as q_const
+from neutron.common import exceptions as q_exc
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.common import utils
+from neutron.db import agents_db
+from neutron.db import agentschedulers_db
+from neutron.db import db_base_plugin_v2
+from neutron.db import dhcp_rpc_base
+from neutron.db import extraroute_db
+from neutron.db import l3_gwmode_db
+from neutron.db import l3_rpc_base
+from neutron.db import portbindings_db
+from neutron.db import quota_db # noqa
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.extensions import portbindings
+from neutron.extensions import providernet as provider
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.common import utils as plugin_utils
+from neutron.plugins.openvswitch.common import config # noqa
+from neutron.plugins.openvswitch.common import constants
+from neutron.plugins.openvswitch import ovs_db_v2
LOG = logging.getLogger(__name__)
topic=self.topic_tunnel_update)
-class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class OVSNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
extraroute_db.ExtraRoute_db_mixin,
l3_gwmode_db.L3_NAT_db_mixin,
sg_db_rpc.SecurityGroupServerRpcMixin,
agentschedulers_db.AgentSchedulerDbMixin,
portbindings_db.PortBindingMixin):
- """Implement the Quantum abstractions using Open vSwitch.
+ """Implement the Neutron abstractions using Open vSwitch.
Depending on whether tunneling is enabled, either a GRE, VXLAN tunnel or
a new VLAN is created for each network. An agent is relied upon to
perform the actual OVS configuration on each host.
The provider extension is also supported. As discussed in
- https://bugs.launchpad.net/quantum/+bug/1023156, this class could
+ https://bugs.launchpad.net/neutron/+bug/1023156, this class could
be simplified, and filtering on extended attributes could be
handled, by adding support for extended attributes to the
- QuantumDbPluginV2 base class. When that occurs, this class should
+ NeutronDbPluginV2 base class. When that occurs, this class should
be updated to take advantage of it.
The port binding extension enables an external application relay
sys.exit(1)
self.setup_rpc()
self.network_scheduler = importutils.import_object(
- cfg.CONF.network_scheduler_driver)
+ cfg.CONF.network_scheduler_driver
+ )
self.router_scheduler = importutils.import_object(
- cfg.CONF.router_scheduler_driver)
+ cfg.CONF.router_scheduler_driver
+ )
def setup_rpc(self):
# RPC support
elif network_type in constants.TUNNEL_NETWORK_TYPES:
ovs_db_v2.reserve_specific_tunnel(session, segmentation_id)
# no reservation needed for TYPE_LOCAL
- net = super(OVSQuantumPluginV2, self).create_network(context,
+ net = super(OVSNeutronPluginV2, self).create_network(context,
network)
ovs_db_v2.add_network_binding(session, net['id'], network_type,
physical_network, segmentation_id)
session = context.session
with session.begin(subtransactions=True):
- net = super(OVSQuantumPluginV2, self).update_network(context, id,
+ net = super(OVSNeutronPluginV2, self).update_network(context, id,
network)
self._process_l3_update(context, net, network['network'])
self._extend_network_dict_provider(context, net)
session = context.session
with session.begin(subtransactions=True):
binding = ovs_db_v2.get_network_binding(session, id)
- super(OVSQuantumPluginV2, self).delete_network(context, id)
+ super(OVSNeutronPluginV2, self).delete_network(context, id)
if binding.network_type in constants.TUNNEL_NETWORK_TYPES:
ovs_db_v2.release_tunnel(session, binding.segmentation_id,
self.tunnel_id_ranges)
def get_network(self, context, id, fields=None):
session = context.session
with session.begin(subtransactions=True):
- net = super(OVSQuantumPluginV2, self).get_network(context,
+ net = super(OVSNeutronPluginV2, self).get_network(context,
id, None)
self._extend_network_dict_provider(context, net)
return self._fields(net, fields)
limit=None, marker=None, page_reverse=False):
session = context.session
with session.begin(subtransactions=True):
- nets = super(OVSQuantumPluginV2,
+ nets = super(OVSNeutronPluginV2,
self).get_networks(context, filters, None, sorts,
limit, marker, page_reverse)
for net in nets:
with session.begin(subtransactions=True):
self._ensure_default_security_group_on_port(context, port)
sgids = self._get_security_groups_on_port(context, port)
- port = super(OVSQuantumPluginV2, self).create_port(context, port)
+ port = super(OVSNeutronPluginV2, self).create_port(context, port)
self._process_portbindings_create_and_update(context,
port_data, port)
self._process_port_create_security_group(context, port, sgids)
session = context.session
need_port_update_notify = False
with session.begin(subtransactions=True):
- original_port = super(OVSQuantumPluginV2, self).get_port(
+ original_port = super(OVSNeutronPluginV2, self).get_port(
context, id)
- updated_port = super(OVSQuantumPluginV2, self).update_port(
+ updated_port = super(OVSNeutronPluginV2, self).update_port(
context, id, port)
need_port_update_notify = self.update_security_group_on_port(
context, id, port, original_port, updated_port)
self.disassociate_floatingips(context, id)
port = self.get_port(context, id)
self._delete_port_security_group_bindings(context, id)
- super(OVSQuantumPluginV2, self).delete_port(context, id)
+ super(OVSNeutronPluginV2, self).delete_port(context, id)
self.notify_security_groups_member_updated(context, port)
--- /dev/null
+PLUMgrid Neutron Virtual Network Plugin
+
+This plugin implements Neutron v2 APIs and helps configure
+L2/L3 virtual networks consisting of PLUMgrid Platform.
+
+For more details on use please refer to:
+http://wiki.openstack.org/plumgrid-neutron
# @author: Edgar Magana, emagana@plumgrid.com, PLUMgrid, Inc.
-"""Quantum PLUMgrid Plugin exceptions"""
+"""Neutron PLUMgrid Plugin exceptions"""
-from quantum.common import exceptions as base_exec
+from neutron.common import exceptions as base_exec
-class PLUMgridException(base_exec.QuantumException):
+class PLUMgridException(base_exec.NeutronException):
message = _("An unexpected error occurred in the PLUMgrid Plugin: "
"%(err_msg)s")
Snippets needed by the PLUMgrid Plugin
"""
-from quantum.openstack.common import log as logging
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
BASE_NOS_URL = '/0/connectivity/domain/'
def __init__(self):
- LOG.info(_('QuantumPluginPLUMgrid Status: NOS Body Data Creation'))
+ LOG.info(_('NeutronPluginPLUMgrid Status: NOS Body Data Creation'))
def create_domain_body_data(self, tenant_id):
body_data = {"container_group": tenant_id}
# @author: Edgar Magana, emagana@plumgrid.com, PLUMgrid, Inc.
"""
-Quantum PLUMgrid Plug-in for PLUMgrid Virtual Technology
+Neutron PLUMgrid Plug-in for PLUMgrid Virtual Technology
This plugin will forward authenticated REST API calls
to the Network Operating System by PLUMgrid called NOS
"""
from oslo.config import cfg
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.openstack.common import log as logging
-from quantum.plugins.plumgrid.common import exceptions as plum_excep
-from quantum.plugins.plumgrid.plumgrid_nos_plugin.plugin_ver import VERSION
-from quantum.plugins.plumgrid.plumgrid_nos_plugin import plumgrid_nos_snippets
-from quantum.plugins.plumgrid.plumgrid_nos_plugin import rest_connection
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.openstack.common import log as logging
+from neutron.plugins.plumgrid.common import exceptions as plum_excep
+from neutron.plugins.plumgrid.plumgrid_nos_plugin.plugin_ver import VERSION
+from neutron.plugins.plumgrid.plumgrid_nos_plugin import plumgrid_nos_snippets
+from neutron.plugins.plumgrid.plumgrid_nos_plugin import rest_connection
LOG = logging.getLogger(__name__)
cfg.CONF.register_opts(nos_server_opts, "PLUMgridNOS")
-class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
+class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2):
def __init__(self):
- LOG.info(_('QuantumPluginPLUMgrid Status: Starting Plugin'))
+ LOG.info(_('NeutronPluginPLUMgrid Status: Starting Plugin'))
# PLUMgrid NOS configuration
nos_plumgrid = cfg.CONF.PLUMgridNOS.nos_server
self.rest_conn = rest_connection.RestConnection(nos_plumgrid,
nos_port, timeout)
if self.rest_conn is None:
- raise SystemExit(_('QuantumPluginPLUMgrid Status: '
+ raise SystemExit(_('NeutronPluginPLUMgrid Status: '
'Aborting Plugin'))
else:
db.configure_db()
# PLUMgrid NOS info validation
- LOG.info(_('QuantumPluginPLUMgrid NOS: %s'), nos_plumgrid)
+ LOG.info(_('NeutronPluginPLUMgrid NOS: %s'), nos_plumgrid)
if not nos_plumgrid:
- raise SystemExit(_('QuantumPluginPLUMgrid Status: '
+ raise SystemExit(_('NeutronPluginPLUMgrid Status: '
'NOS value is missing in config file'))
- LOG.debug(_('QuantumPluginPLUMgrid Status: Quantum server with '
+ LOG.debug(_('NeutronPluginPLUMgrid Status: Neutron server with '
'PLUMgrid Plugin has started'))
def create_network(self, context, network):
- """Create network core Quantum API."""
+ """Create network core Neutron API."""
- LOG.debug(_('QuantumPluginPLUMgrid Status: create_network() called'))
+ LOG.debug(_('NeutronPluginPLUMgrid Status: create_network() called'))
# Plugin DB - Network Create and validation
tenant_id = self._get_tenant_id_for_create(context,
self._network_admin_state(network)
with context.session.begin(subtransactions=True):
- net = super(QuantumPluginPLUMgridV2, self).create_network(context,
+ net = super(NeutronPluginPLUMgridV2, self).create_network(context,
network)
try:
- LOG.debug(_('QuantumPluginPLUMgrid Status: %(tenant_id)s, '
+ LOG.debug(_('NeutronPluginPLUMgrid Status: %(tenant_id)s, '
'%(network)s, %(network_id)s'),
dict(
tenant_id=tenant_id,
return net
def update_network(self, context, net_id, network):
- """Update network core Quantum API."""
+ """Update network core Neutron API."""
- LOG.debug(_("QuantumPluginPLUMgridV2.update_network() called"))
+ LOG.debug(_("NeutronPluginPLUMgridV2.update_network() called"))
self._network_admin_state(network)
tenant_id = self._get_tenant_id_for_create(context, network["network"])
with context.session.begin(subtransactions=True):
# Plugin DB - Network Update
new_network = super(
- QuantumPluginPLUMgridV2, self).update_network(context,
+ NeutronPluginPLUMgridV2, self).update_network(context,
net_id, network)
try:
return new_network
def delete_network(self, context, net_id):
- """Delete network core Quantum API."""
- LOG.debug(_("QuantumPluginPLUMgrid Status: delete_network() called"))
- super(QuantumPluginPLUMgridV2, self).get_network(context, net_id)
+ """Delete network core Neutron API."""
+ LOG.debug(_("NeutronPluginPLUMgrid Status: delete_network() called"))
+ super(NeutronPluginPLUMgridV2, self).get_network(context, net_id)
with context.session.begin(subtransactions=True):
# Plugin DB - Network Delete
- super(QuantumPluginPLUMgridV2, self).delete_network(context,
+ super(NeutronPluginPLUMgridV2, self).delete_network(context,
net_id)
try:
raise plum_excep.PLUMgridException(err_message)
def create_port(self, context, port):
- """Create port core Quantum API."""
- LOG.debug(_("QuantumPluginPLUMgrid Status: create_port() called"))
+ """Create port core Neutron API."""
+ LOG.debug(_("NeutronPluginPLUMgrid Status: create_port() called"))
# Port operations on PLUMgrid NOS is an automatic operation from the
# VIF driver operations in Nova. It requires admin_state_up to be True
port["port"]["admin_state_up"] = True
# Plugin DB - Port Create and Return port
- return super(QuantumPluginPLUMgridV2, self).create_port(context,
+ return super(NeutronPluginPLUMgridV2, self).create_port(context,
port)
def update_port(self, context, port_id, port):
- """Update port core Quantum API."""
- LOG.debug(_("QuantumPluginPLUMgrid Status: update_port() called"))
+ """Update port core Neutron API."""
+ LOG.debug(_("NeutronPluginPLUMgrid Status: update_port() called"))
# Port operations on PLUMgrid NOS is an automatic operation from the
# VIF driver operations in Nova.
# Plugin DB - Port Update
- return super(QuantumPluginPLUMgridV2, self).update_port(
+ return super(NeutronPluginPLUMgridV2, self).update_port(
context, port_id, port)
def delete_port(self, context, port_id):
- """Delete port core Quantum API."""
+ """Delete port core Neutron API."""
- LOG.debug(_("QuantumPluginPLUMgrid Status: delete_port() called"))
+ LOG.debug(_("NeutronPluginPLUMgrid Status: delete_port() called"))
# Port operations on PLUMgrid NOS is an automatic operation from the
# VIF driver operations in Nova.
# Plugin DB - Port Delete
- super(QuantumPluginPLUMgridV2, self).delete_port(context, port_id)
+ super(NeutronPluginPLUMgridV2, self).delete_port(context, port_id)
def create_subnet(self, context, subnet):
- """Create subnet core Quantum API."""
+ """Create subnet core Neutron API."""
- LOG.debug(_("QuantumPluginPLUMgrid Status: create_subnet() called"))
+ LOG.debug(_("NeutronPluginPLUMgrid Status: create_subnet() called"))
with context.session.begin(subtransactions=True):
# Plugin DB - Subnet Create
- subnet = super(QuantumPluginPLUMgridV2, self).create_subnet(
+ subnet = super(NeutronPluginPLUMgridV2, self).create_subnet(
context, subnet)
subnet_details = self._get_subnet(context, subnet["id"])
net_id = subnet_details["network_id"]
return subnet
def delete_subnet(self, context, subnet_id):
- """Delete subnet core Quantum API."""
+ """Delete subnet core Neutron API."""
- LOG.debug(_("QuantumPluginPLUMgrid Status: delete_subnet() called"))
+ LOG.debug(_("NeutronPluginPLUMgrid Status: delete_subnet() called"))
#Collecting subnet info
subnet_details = self._get_subnet(context, subnet_id)
with context.session.begin(subtransactions=True):
# Plugin DB - Subnet Delete
- del_subnet = super(QuantumPluginPLUMgridV2, self).delete_subnet(
+ del_subnet = super(NeutronPluginPLUMgridV2, self).delete_subnet(
context, subnet_id)
try:
headers = {}
return del_subnet
def update_subnet(self, context, subnet_id, subnet):
- """Update subnet core Quantum API."""
+ """Update subnet core Neutron API."""
LOG.debug(_("update_subnet() called"))
#Collecting subnet info
with context.session.begin(subtransactions=True):
# Plugin DB - Subnet Update
- new_subnet = super(QuantumPluginPLUMgridV2, self).update_subnet(
+ new_subnet = super(NeutronPluginPLUMgridV2, self).update_subnet(
context, subnet_id, subnet)
try:
# @author: Brenden Blanco, bblanco@plumgrid.com, PLUMgrid, Inc.
"""
-Quantum PLUMgrid Plug-in for PLUMgrid Virtual Technology
+Neutron PLUMgrid Plug-in for PLUMgrid Virtual Technology
This plugin will forward authenticated REST API calls
to the Network Operating System by PLUMgrid called NOS
"""
import httplib
import urllib2
-from quantum.openstack.common import jsonutils as json
-from quantum.openstack.common import log as logging
-from quantum.plugins.plumgrid.common import exceptions as plum_excep
+from neutron.openstack.common import jsonutils as json
+from neutron.openstack.common import log as logging
+from neutron.plugins.plumgrid.common import exceptions as plum_excep
LOG = logging.getLogger(__name__)
"""REST Connection to PLUMgrid NOS Server."""
def __init__(self, server, port, timeout):
- LOG.debug(_('QuantumPluginPLUMgrid Status: REST Connection Started'))
+ LOG.debug(_('NeutronPluginPLUMgrid Status: REST Connection Started'))
self.server = server
self.port = port
self.timeout = timeout
-Quantum plugin for Ryu Network Operating System
-This directory includes quantum plugin for Ryu Network Operating System.
+Neutron plugin for Ryu Network Operating System
+This directory includes neutron plugin for Ryu Network Operating System.
# -- Installation
from ryu.app import conf_switch_key
from ryu.app import rest_nw_id
-from quantum.agent.linux import ovs_lib
-from quantum.agent.linux.ovs_lib import VifPort
-from quantum.agent import rpc as agent_rpc
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.common import config as logging_config
-from quantum.common import exceptions as q_exc
-from quantum.common import topics
-from quantum import context as q_context
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common import log
-from quantum.openstack.common.rpc import dispatcher
-from quantum.plugins.ryu.common import config # noqa
+from neutron.agent.linux import ovs_lib
+from neutron.agent.linux.ovs_lib import VifPort
+from neutron.agent import rpc as agent_rpc
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.common import config as logging_config
+from neutron.common import exceptions as q_exc
+from neutron.common import topics
+from neutron import context as q_context
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common import log
+from neutron.openstack.common.rpc import dispatcher
+from neutron.plugins.ryu.common import config # noqa
LOG = log.getLogger(__name__)
self.init_firewall()
-class OVSQuantumOFPRyuAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
+class OVSNeutronOFPRyuAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def __init__(self, integ_br, tunnel_ip, ovsdb_ip, ovsdb_port,
polling_interval, root_helper):
- super(OVSQuantumOFPRyuAgent, self).__init__()
+ super(OVSNeutronOFPRyuAgent, self).__init__()
self.polling_interval = polling_interval
self._setup_rpc()
self.sg_agent = RyuSecurityGroupAgent(self.context,
def main():
eventlet.monkey_patch()
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
logging_config.setup_logging(cfg.CONF)
ovsdb_ip = _get_ovsdb_ip()
LOG.debug(_('ovsdb_ip %s'), ovsdb_ip)
try:
- agent = OVSQuantumOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip,
+ agent = OVSNeutronOFPRyuAgent(integ_br, tunnel_ip, ovsdb_ip,
ovsdb_port, polling_interval,
root_helper)
except httplib.HTTPException as e:
from oslo.config import cfg
-from quantum.agent.common import config
+from neutron.agent.common import config
ovs_opts = [
from sqlalchemy import func
from sqlalchemy.orm import exc as orm_exc
-from quantum.common import exceptions as q_exc
-import quantum.db.api as db
-from quantum.db import models_v2
-from quantum.db import securitygroups_db as sg_db
-from quantum.extensions import securitygroup as ext_sg
-from quantum import manager
-from quantum.openstack.common import log as logging
-from quantum.plugins.ryu.db import models_v2 as ryu_models_v2
+from neutron.common import exceptions as q_exc
+import neutron.db.api as db
+from neutron.db import models_v2
+from neutron.db import securitygroups_db as sg_db
+from neutron.extensions import securitygroup as ext_sg
+from neutron import manager
+from neutron.openstack.common import log as logging
+from neutron.plugins.ryu.db import models_v2 as ryu_models_v2
LOG = logging.getLogger(__name__)
if not port_and_sgs:
return None
port = port_and_sgs[0][0]
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin._make_port_dict(port)
port_dict[ext_sg.SECURITYGROUPS] = [
sg_id for port_, sg_id in port_and_sgs if sg_id]
import sqlalchemy as sa
-from quantum.db import model_base
+from neutron.db import model_base
class TunnelKeyLast(model_base.BASEV2):
from ryu.app import client
from ryu.app import rest_nw_id
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum.common import constants as q_const
-from quantum.common import exceptions as q_exc
-from quantum.common import rpc as q_rpc
-from quantum.common import topics
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import dhcp_rpc_base
-from quantum.db import extraroute_db
-from quantum.db import l3_gwmode_db
-from quantum.db import l3_rpc_base
-from quantum.db import models_v2
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.ryu.common import config # noqa
-from quantum.plugins.ryu.db import api_v2 as db_api_v2
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron.common import constants as q_const
+from neutron.common import exceptions as q_exc
+from neutron.common import rpc as q_rpc
+from neutron.common import topics
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import dhcp_rpc_base
+from neutron.db import extraroute_db
+from neutron.db import l3_gwmode_db
+from neutron.db import l3_rpc_base
+from neutron.db import models_v2
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.ryu.common import config # noqa
+from neutron.plugins.ryu.db import api_v2 as db_api_v2
LOG = logging.getLogger(__name__)
topic=self.topic_port_update)
-class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+class RyuNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
extraroute_db.ExtraRoute_db_mixin,
l3_gwmode_db.L3_NAT_db_mixin,
sg_db_rpc.SecurityGroupServerRpcMixin):
self.client = client.OFPClient(self.ofp_api_host)
self.tun_client = client.TunnelClient(self.ofp_api_host)
- self.iface_client = client.QuantumIfaceClient(self.ofp_api_host)
+ self.iface_client = client.NeutronIfaceClient(self.ofp_api_host)
for nw_id in rest_nw_id.RESERVED_NETWORK_IDS:
if nw_id != rest_nw_id.NW_ID_UNKNOWN:
self.client.update_network(nw_id)
context, network['network'])
self._ensure_default_security_group(context, tenant_id)
- net = super(RyuQuantumPluginV2, self).create_network(context,
+ net = super(RyuNeutronPluginV2, self).create_network(context,
network)
self._process_l3_create(context, net, network['network'])
def update_network(self, context, id, network):
session = context.session
with session.begin(subtransactions=True):
- net = super(RyuQuantumPluginV2, self).update_network(context, id,
+ net = super(RyuNeutronPluginV2, self).update_network(context, id,
network)
self._process_l3_update(context, net, network['network'])
return net
session = context.session
with session.begin(subtransactions=True):
self.tunnel_key.delete(session, id)
- super(RyuQuantumPluginV2, self).delete_network(context, id)
+ super(RyuNeutronPluginV2, self).delete_network(context, id)
def create_port(self, context, port):
session = context.session
with session.begin(subtransactions=True):
self._ensure_default_security_group_on_port(context, port)
sgids = self._get_security_groups_on_port(context, port)
- port = super(RyuQuantumPluginV2, self).create_port(context, port)
+ port = super(RyuNeutronPluginV2, self).create_port(context, port)
self._process_port_create_security_group(
context, port, sgids)
self.notify_security_groups_member_updated(context, port)
self.disassociate_floatingips(context, id)
port = self.get_port(context, id)
self._delete_port_security_group_bindings(context, id)
- super(RyuQuantumPluginV2, self).delete_port(context, id)
+ super(RyuNeutronPluginV2, self).delete_port(context, id)
self.notify_security_groups_member_updated(context, port)
need_port_update_notify = False
with session.begin(subtransactions=True):
- original_port = super(RyuQuantumPluginV2, self).get_port(
+ original_port = super(RyuNeutronPluginV2, self).get_port(
context, id)
- updated_port = super(RyuQuantumPluginV2, self).update_port(
+ updated_port = super(RyuNeutronPluginV2, self).update_port(
context, id, port)
need_port_update_notify = self.update_security_group_on_port(
context, id, port, original_port, updated_port)
def get_port(self, context, id, fields=None):
with context.session.begin(subtransactions=True):
- port = super(RyuQuantumPluginV2, self).get_port(context, id,
+ port = super(RyuNeutronPluginV2, self).get_port(context, id,
fields)
return self._fields(port, fields)
def get_ports(self, context, filters=None, fields=None):
with context.session.begin(subtransactions=True):
- ports = super(RyuQuantumPluginV2, self).get_ports(
+ ports = super(RyuNeutronPluginV2, self).get_ports(
context, filters, fields)
return [self._fields(port, fields) for port in ports]
# under the License.
"""
-Policy engine for quantum. Largely copied from nova.
+Policy engine for neutron. Largely copied from nova.
"""
import itertools
import re
from oslo.config import cfg
-from quantum.api.v2 import attributes
-from quantum.common import exceptions
-import quantum.common.utils as utils
-from quantum import manager
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import policy
+from neutron.api.v2 import attributes
+from neutron.common import exceptions
+import neutron.common.utils as utils
+from neutron import manager
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import policy
LOG = logging.getLogger(__name__)
'set': ['create', 'update']
}
-cfg.CONF.import_opt('policy_file', 'quantum.common.config')
+cfg.CONF.import_opt('policy_file', 'neutron.common.config')
def reset():
# resource is handled by the core plugin. It might be worth
# having a way to map resources to plugins so to make this
# check more general
- f = getattr(manager.QuantumManager.get_instance().plugin,
+ f = getattr(manager.NeutronManager.get_instance().plugin,
'get_%s' % parent_res)
- # f *must* exist, if not found it is better to let quantum
+ # f *must* exist, if not found it is better to let neutron
# explode. Check will be performed with admin context
- context = importutils.import_module('quantum.context')
+ context = importutils.import_module('neutron.context')
try:
data = f(context.get_admin_context(),
target[parent_foreign_key],
def check(context, action, target, plugin=None):
"""Verifies that the action is valid on the target in this context.
- :param context: quantum context
+ :param context: neutron context
:param action: string representing the action to be checked
this should be colon separated for clarity.
:param target: dictionary representing the object of the action
def enforce(context, action, target, plugin=None):
"""Verifies that the action is valid on the target in this context.
- :param context: quantum context
+ :param context: neutron context
:param action: string representing the action to be checked
this should be colon separated for clarity.
:param target: dictionary representing the object of the action
:param plugin: currently unused and deprecated.
Kept for backward compatibility.
- :raises quantum.exceptions.PolicyNotAllowed: if verification fails.
+ :raises neutron.exceptions.PolicyNotAllowed: if verification fails.
"""
init()
from oslo.config import cfg
import webob
-from quantum.common import exceptions
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
+from neutron.common import exceptions
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
quota_opts = [
help=_('number of ports allowed per tenant, minus for '
'unlimited')),
cfg.StrOpt('quota_driver',
- default='quantum.quota.ConfDriver',
+ default='neutron.quota.ConfDriver',
help=_('Default driver to use for quota checks')),
]
# Register the configuration options
Driver to perform necessary checks to enforce quotas and obtain
quota information. The default driver utilizes the default values
- in quantum.conf.
+ in neutron.conf.
"""
def _get_quotas(self, context, resources, keys):
return False
def is_dnsmasq_env_vars(self, argv):
- if (argv[0].startswith("QUANTUM_RELAY_SOCKET_PATH=") and
- argv[1].startswith("QUANTUM_NETWORK_ID=")):
+ if (argv[0].startswith("NEUTRON_RELAY_SOCKET_PATH=") and
+ argv[1].startswith("NEUTRON_NETWORK_ID=")):
return True
return False
def get_environment(self, userargs):
env = os.environ.copy()
- env['QUANTUM_RELAY_SOCKET_PATH'] = userargs[0].split('=')[-1]
- env['QUANTUM_NETWORK_ID'] = userargs[1].split('=')[-1]
+ env['NEUTRON_RELAY_SOCKET_PATH'] = userargs[0].split('=')[-1]
+ env['NEUTRON_NETWORK_ID'] = userargs[1].split('=')[-1]
return env
import os
import string
-from quantum.rootwrap import filters
+from neutron.rootwrap import filters
class NoFilterMatched(Exception):
AGENTS_SCHEDULER_OPTS = [
cfg.StrOpt('network_scheduler_driver',
- default='quantum.scheduler.'
+ default='neutron.scheduler.'
'dhcp_agent_scheduler.ChanceScheduler',
help=_('Driver to use for scheduling network to DHCP agent')),
cfg.StrOpt('router_scheduler_driver',
- default='quantum.scheduler.l3_agent_scheduler.ChanceScheduler',
+ default='neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
help=_('Driver to use for scheduling '
'router to a default L3 agent')),
cfg.BoolOpt('network_auto_schedule', default=True,
from oslo.config import cfg
-from quantum.common import constants
-from quantum.db import agents_db
-from quantum.db import agentschedulers_db
-from quantum.openstack.common import log as logging
+from neutron.common import constants
+from neutron.db import agents_db
+from neutron.db import agentschedulers_db
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
from sqlalchemy.orm import exc
from sqlalchemy.sql import exists
-from quantum.common import constants
-from quantum.db import agents_db
-from quantum.db import agentschedulers_db
-from quantum.db import l3_db
-from quantum.openstack.common import log as logging
+from neutron.common import constants
+from neutron.db import agents_db
+from neutron.db import agentschedulers_db
+from neutron.db import l3_db
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
# License for the specific language governing permissions and limitations
# under the License.
-# If ../quantum/__init__.py exists, add ../ to Python search path, so that
+# If ../neutron/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
import sys
from oslo.config import cfg
-from quantum.common import config
-from quantum import service
+from neutron.common import config
+from neutron import service
def main():
config.parse(sys.argv[1:])
if not cfg.CONF.config_file:
sys.exit(_("ERROR: Unable to find configuration file via the default"
- " search paths (~/.quantum/, ~/, /etc/quantum/, /etc/) and"
+ " search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
" the '--config-file' option!"))
try:
- quantum_service = service.serve_wsgi(service.QuantumApiService)
- quantum_service.wait()
+ neutron_service = service.serve_wsgi(service.NeutronApiService)
+ neutron_service.wait()
except RuntimeError as e:
sys.exit(_("ERROR: %s") % e)
from oslo.config import cfg
-from quantum.common import config
-from quantum import context
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import loopingcall
-from quantum.openstack.common.rpc import service
-from quantum import wsgi
+from neutron.common import config
+from neutron import context
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import loopingcall
+from neutron.openstack.common.rpc import service
+from neutron import wsgi
-LOG = logging.getLogger(__name__)
-
service_opts = [
cfg.IntOpt('periodic_interval',
default=40,
self.wsgi_app.wait()
-class QuantumApiService(WsgiService):
- """Class for quantum-api service."""
+class NeutronApiService(WsgiService):
+ """Class for neutron-api service."""
@classmethod
- def create(cls):
- app_name = "quantum"
+ def create(cls, app_name='neutron'):
# Setup logging early, supplying both the CLI options and the
# configuration mapping from the config file
def serve_wsgi(cls):
+
try:
- service = cls.create()
+ try:
+ service = cls.create()
+ service.start()
+ except RuntimeError:
+ LOG.warn(_('Attempting fallback to old Quantum api-paste config'))
+ service = cls.create('quantum')
+ service.start()
except Exception:
- LOG.exception(_('In WsgiService.create()'))
+ LOG.exception(_('In serve_wsgi()'))
raise
- service.start()
-
return service
if not app:
LOG.error(_('No known API applications configured.'))
return
- server = wsgi.Server("Quantum")
+ server = wsgi.Server("Neutron")
server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host)
# Dump all option values here after all options are parsed
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
- LOG.info(_("Quantum service started, listening on %(host)s:%(port)s"),
+ LOG.info(_("Neutron service started, listening on %(host)s:%(port)s"),
{'host': cfg.CONF.bind_host,
'port': cfg.CONF.bind_port})
return server
if not binary:
binary = os.path.basename(inspect.stack()[-1][1])
if not topic:
- topic = binary.rpartition('quantum-')[2]
+ topic = binary.rpartition('neutron-')[2]
topic = topic.replace("-", "_")
if not manager:
manager = CONF.get('%s_manager' % topic, None)
def report_state(self):
"""Update the state of this service."""
- # Todo(gongysh) report state to quantum server
+ # Todo(gongysh) report state to neutron server
pass
import eventlet
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.linux import interface
-from quantum.openstack.common.rpc import service as rpc_service
-from quantum.openstack.common import service
-from quantum.services.loadbalancer.drivers.haproxy import (
+from neutron.agent.common import config
+from neutron.agent.linux import interface
+from neutron.common import legacy
+from neutron.openstack.common.rpc import service as rpc_service
+from neutron.openstack.common import service
+from neutron.services.loadbalancer.drivers.haproxy import (
agent_manager as manager,
plugin_driver
)
cfg.CONF.register_opts(interface.OPTS)
config.register_root_helper(cfg.CONF)
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
+ legacy.modernize_quantum_config(cfg.CONF)
config.setup_logging(cfg.CONF)
mgr = manager.LbaasAgentManager(cfg.CONF)
#
# @author: Mark McClain, DreamHost
-from quantum.openstack.common.rpc import proxy
+from neutron.openstack.common.rpc import proxy
class LbaasAgentApi(proxy.RpcProxy):
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum import context
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import periodic_task
-from quantum.services.loadbalancer.drivers.haproxy import (
+from neutron.agent.common import config
+from neutron import context
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import periodic_task
+from neutron.services.loadbalancer.drivers.haproxy import (
agent_api,
plugin_driver
)
OPTS = [
cfg.StrOpt(
'device_driver',
- default=('quantum.services.loadbalancer.drivers'
+ default=('neutron.services.loadbalancer.drivers'
'.haproxy.namespace_driver.HaproxyNSDriver'),
help=_('The driver used to manage the loadbalancing device'),
),
from oslo.config import cfg
-from quantum.agent.linux import utils
-from quantum.plugins.common import constants as qconstants
-from quantum.services.loadbalancer import constants
+from neutron.agent.linux import utils
+from neutron.plugins.common import constants as qconstants
+from neutron.services.loadbalancer import constants
PROTOCOL_MAP = {
import netaddr
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.common import exceptions
-from quantum.openstack.common import log as logging
-from quantum.services.loadbalancer.drivers.haproxy import cfg as hacfg
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.common import exceptions
+from neutron.openstack.common import log as logging
+from neutron.services.loadbalancer.drivers.haproxy import cfg as hacfg
LOG = logging.getLogger(__name__)
NS_PREFIX = 'qlbaas-'
from oslo.config import cfg
-from quantum.common import exceptions as q_exc
-from quantum.common import rpc as q_rpc
-from quantum.db.loadbalancer import loadbalancer_db
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import rpc
-from quantum.openstack.common.rpc import proxy
-from quantum.plugins.common import constants
-from quantum.services.loadbalancer.drivers import abstract_driver
+from neutron.common import exceptions as q_exc
+from neutron.common import rpc as q_rpc
+from neutron.db.loadbalancer import loadbalancer_db
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import rpc
+from neutron.openstack.common.rpc import proxy
+from neutron.plugins.common import constants
+from neutron.services.loadbalancer.drivers import abstract_driver
LOG = logging.getLogger(__name__)
return
port['admin_state_up'] = True
- port['device_owner'] = 'quantum:' + constants.LOADBALANCER
+ port['device_owner'] = 'neutron:' + constants.LOADBALANCER
port['device_id'] = str(uuid.uuid5(uuid.NAMESPACE_DNS, str(host)))
self.plugin._core_plugin.update_port(
# @author: Avishay Balderman, Radware
-from quantum.openstack.common import log as logging
-from quantum.services.loadbalancer.drivers import (
+from neutron.openstack.common import log as logging
+from neutron.services.loadbalancer.drivers import (
abstract_driver
)
from oslo.config import cfg
-from quantum.db import api as qdbapi
-from quantum.db.loadbalancer import loadbalancer_db
-from quantum.openstack.common import importutils
-from quantum.openstack.common import log as logging
-from quantum.plugins.common import constants
+from neutron.db import api as qdbapi
+from neutron.db.loadbalancer import loadbalancer_db
+from neutron.openstack.common import importutils
+from neutron.openstack.common import log as logging
+from neutron.plugins.common import constants
LOG = logging.getLogger(__name__)
-DEFAULT_DRIVER = ("quantum.services.loadbalancer.drivers.haproxy"
+DEFAULT_DRIVER = ("neutron.services.loadbalancer.drivers.haproxy"
".plugin_driver.HaproxyOnHostPluginDriver")
lbaas_plugin_opts = [
class LoadBalancerPlugin(loadbalancer_db.LoadBalancerPluginDb):
- """Implementation of the Quantum Loadbalancer Service Plugin.
+ """Implementation of the Neutron Loadbalancer Service Plugin.
This class manages the workflow of LBaaS request/response.
Most DB related works are implemented in class
"""
try:
self.driver = importutils.import_object(
- cfg.CONF.LBAAS.driver_fqn, self)
+ cfg.CONF.LBAAS.driver_fqn, self
+ )
except ImportError:
LOG.exception(_("Error loading LBaaS driver %s"),
cfg.CONF.LBAAS.driver_fqn)
return constants.LOADBALANCER
def get_plugin_description(self):
- return "Quantum LoadBalancer Service Plugin"
+ return "Neutron LoadBalancer Service Plugin"
def create_vip(self, context, vip):
v = super(LoadBalancerPlugin, self).create_vip(context, vip)
import abc
-from quantum.api import extensions
+from neutron.api import extensions
class ServicePluginBase(extensions.PluginInterface):
def get_plugin_type(self):
"""Return one of predefined service types.
- See quantum/plugins/common/constants.py
+ See neutron/plugins/common/constants.py
"""
pass
import stubout
import testtools
-from quantum.openstack.common import exception
+from neutron.openstack.common import exception
CONF = cfg.CONF
TRUE_STRING = ['True', '1']
pipeline = extensions extensions_test_app
[filter:extensions]
-paste.filter_factory = quantum.common.extensions:plugin_aware_extension_middleware_factory
+paste.filter_factory = neutron.common.extensions:plugin_aware_extension_middleware_factory
[app:extensions_test_app]
-paste.app_factory = quantum.tests.unit.test_extensions:app_factory
+paste.app_factory = neutron.tests.unit.test_extensions:app_factory
api_paste_config = api-paste.ini.test
# The messaging module to use, defaults to kombu.
-rpc_backend = quantum.openstack.common.rpc.impl_fake
+rpc_backend = neutron.openstack.common.rpc.impl_fake
lock_path = $state_path/lock
[default_servicetype]
description = "default service type"
-service_definition=dummy:quantum.tests.unit.dummy_plugin.QuantumDummyPlugin
+service_definition=dummy:neutron.tests.unit.dummy_plugin.NeutronDummyPlugin
-# quantum-rootwrap command filters for the unit test
+# neutron-rootwrap command filters for the unit test
-# this file goes with quantum/tests/unit/_test_rootwrap_exec.py.
+# this file goes with neutron/tests/unit/_test_rootwrap_exec.py.
# See the comments there about how to run that unit tests
# format seems to be
from oslo.config import cfg
from webob import exc
-from quantum import context
-from quantum.extensions import portbindings
-from quantum.manager import QuantumManager
-from quantum.tests.unit import test_db_plugin
+from neutron import context
+from neutron.extensions import portbindings
+from neutron.manager import NeutronManager
+from neutron.tests.unit import test_db_plugin
-class PortBindingsTestCase(test_db_plugin.QuantumDbPluginV2TestCase):
+class PortBindingsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
# VIF_TYPE must be overridden according to plugin vif_type
VIF_TYPE = portbindings.VIF_TYPE_OTHER
self._check_response_portbindings(port['port'])
# Check a response of get_port
ctx = context.get_admin_context()
- port = self._show('ports', port_id, quantum_context=ctx)['port']
+ port = self._show('ports', port_id, neutron_context=ctx)['port']
self._check_response_portbindings(port)
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
is_admin=False,
read_deleted="no")
non_admin_port = self._show(
- 'ports', port_id, quantum_context=ctx)['port']
+ 'ports', port_id, neutron_context=ctx)['port']
self._check_response_no_portbindings(non_admin_port)
def test_ports_vif_details(self):
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
cfg.CONF.set_default('allow_overlapping_ips', True)
with contextlib.nested(self.port(), self.port()):
ctx = context.get_admin_context()
tenant_id=self._tenant_id,
is_admin=False,
read_deleted="no")
- ports = self._list('ports', quantum_context=ctx)['ports']
+ ports = self._list('ports', neutron_context=ctx)['ports']
self.assertEqual(len(ports), 2)
for non_admin_port in ports:
self._check_response_no_portbindings(non_admin_port)
self._check_response_portbindings_host(port['port'])
# Check a response of get_port
ctx = context.get_admin_context()
- port = self._show('ports', port_id, quantum_context=ctx)['port']
+ port = self._show('ports', port_id, neutron_context=ctx)['port']
self._check_response_portbindings_host(port)
# By default user is admin - now test non admin user
ctx = context.Context(user_id=None,
is_admin=False,
read_deleted="no")
non_admin_port = self._show(
- 'ports', port_id, quantum_context=ctx)['port']
+ 'ports', port_id, neutron_context=ctx)['port']
self._check_response_no_portbindings_host(non_admin_port)
def test_ports_vif_host(self):
**host_arg),
self.port(name='name2')):
ctx = context.get_admin_context()
- ports = self._list('ports', quantum_context=ctx)['ports']
+ ports = self._list('ports', neutron_context=ctx)['ports']
self.assertEqual(2, len(ports))
for port in ports:
if port['name'] == 'name1':
tenant_id=self._tenant_id,
is_admin=False,
read_deleted="no")
- ports = self._list('ports', quantum_context=ctx)['ports']
+ ports = self._list('ports', neutron_context=ctx)['ports']
self.assertEqual(2, len(ports))
for non_admin_port in ports:
self._check_response_no_portbindings_host(non_admin_port)
req = self.new_update_request('ports', data, port2['port']['id'])
ctx = context.get_admin_context()
req.get_response(self.api)
- ports = self._list('ports', quantum_context=ctx)['ports']
+ ports = self._list('ports', neutron_context=ctx)['ports']
self.assertEqual(2, len(ports))
for port in ports:
self.assertEqual('testhosttemp', port[portbindings.HOST_ID])
import fixtures
-from quantum.agent.linux import utils
-from quantum.openstack.common import log as logging
-from quantum.tests import base
+from neutron.agent.linux import utils
+from neutron.openstack.common import log as logging
+from neutron.tests import base
LOG = logging.getLogger(__name__)
"generated by test_rootwrap.py\n")
f.write("[DEFAULT]\n")
f.write("filters_path=" + self.cwd +
- "/quantum/tests/etc/rootwrap.d/")
+ "/neutron/tests/etc/rootwrap.d/")
# now set the root helper to sudo our rootwrap script,
# with the new conf
- self.root_helper = "sudo " + self.cwd + "/bin/quantum-rootwrap "
+ self.root_helper = "sudo " + self.cwd + "/bin/neutron-rootwrap "
self.root_helper += self.conf_file
def runTest(self):
from oslo.config import cfg
import webob.exc
-import quantum.common.test_lib as test_lib
-from quantum.extensions import portbindings
-from quantum.manager import QuantumManager
-from quantum.tests.unit import _test_extension_portbindings as test_bindings
-import quantum.tests.unit.test_db_plugin as test_plugin
+import neutron.common.test_lib as test_lib
+from neutron.extensions import portbindings
+from neutron.manager import NeutronManager
+from neutron.tests.unit import _test_extension_portbindings as test_bindings
+import neutron.tests.unit.test_db_plugin as test_plugin
-RESTPROXY_PKG_PATH = 'quantum.plugins.bigswitch.plugin'
+RESTPROXY_PKG_PATH = 'neutron.plugins.bigswitch.plugin'
class HTTPResponseMock():
pass
-class BigSwitchProxyPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class BigSwitchProxyPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = ('%s.QuantumRestProxyV2' % RESTPROXY_PKG_PATH)
+ _plugin_name = ('%s.NeutronRestProxyV2' % RESTPROXY_PKG_PATH)
def setUp(self):
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
class TestBigSwitchProxySync(BigSwitchProxyPluginV2TestCase):
def test_send_data(self):
- plugin_obj = QuantumManager.get_plugin()
+ plugin_obj = NeutronManager.get_plugin()
result = plugin_obj._send_all_data()
self.assertEqual(result[0], 200)
# License for the specific language governing permissions and limitations
# under the License.
#
-# Adapted from quantum.tests.unit.test_l3_plugin
+# Adapted from neutron.tests.unit.test_l3_plugin
# @author: Sumit Naiksatam, sumitnaiksatam@gmail.com
#
from oslo.config import cfg
from webob import exc
-from quantum.common.test_lib import test_config
-from quantum.extensions import l3
-from quantum.manager import QuantumManager
-from quantum.openstack.common.notifier import api as notifier_api
-from quantum.openstack.common.notifier import test_notifier
-from quantum.plugins.bigswitch.extensions import routerrule
-from quantum.tests.unit import test_l3_plugin
+from neutron.common.test_lib import test_config
+from neutron.extensions import l3
+from neutron.manager import NeutronManager
+from neutron.openstack.common.notifier import api as notifier_api
+from neutron.openstack.common.notifier import test_notifier
+from neutron.plugins.bigswitch.extensions import routerrule
+from neutron.tests.unit import test_l3_plugin
def new_L3_setUp(self):
test_config['plugin_name_v2'] = (
- 'quantum.plugins.bigswitch.plugin.QuantumRestProxyV2')
+ 'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2')
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
rp_conf_file = os.path.join(etc_path, 'restproxy.ini.test')
test_config['config_files'] = [rp_conf_file]
self.httpPatch.start()
test_l3_plugin.L3NatDBTestCase.setUp = new_L3_setUp
super(RouterDBTestCase, self).setUp()
- self.plugin_obj = QuantumManager.get_plugin()
+ self.plugin_obj = NeutronManager.get_plugin()
def tearDown(self):
self.httpPatch.stop()
def test_floatingip_with_invalid_create_port(self):
self._test_floatingip_with_invalid_create_port(
- 'quantum.plugins.bigswitch.plugin.QuantumRestProxyV2')
+ 'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2')
def test_create_floatingip_no_ext_gateway_return_404(self):
with self.subnet(cidr='10.0.10.0/24') as public_sub:
def test_send_data(self):
fmt = 'json'
- plugin_obj = QuantumManager.get_plugin()
+ plugin_obj = NeutronManager.get_plugin()
with self.router() as r:
r_id = r['router']['id']
"""
import uuid
-from quantum import context
-from quantum.plugins.brocade.db import models as brocade_db
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron import context
+from neutron.plugins.brocade.db import models as brocade_db
+from neutron.tests.unit import test_db_plugin as test_plugin
TEST_VLAN = 1000
-class TestBrocadeDb(test_plugin.QuantumDbPluginV2TestCase):
+class TestBrocadeDb(test_plugin.NeutronDbPluginV2TestCase):
"""Test brocade db functionality."""
def test_create_network(self):
import mock
-from quantum.extensions import portbindings
-from quantum.openstack.common import importutils
-from quantum.plugins.brocade import QuantumPlugin as brocade_plugin
-from quantum.tests.unit import _test_extension_portbindings as test_bindings
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.extensions import portbindings
+from neutron.openstack.common import importutils
+from neutron.plugins.brocade import NeutronPlugin as brocade_plugin
+from neutron.tests.unit import _test_extension_portbindings as test_bindings
+from neutron.tests.unit import test_db_plugin as test_plugin
-PLUGIN_NAME = ('quantum.plugins.brocade.'
- 'QuantumPlugin.BrocadePluginV2')
-NOS_DRIVER = ('quantum.plugins.brocade.'
+PLUGIN_NAME = ('neutron.plugins.brocade.'
+ 'NeutronPlugin.BrocadePluginV2')
+NOS_DRIVER = ('neutron.plugins.brocade.'
'nos.fake_nosdriver.NOSdriver')
FAKE_IPADDRESS = '2.2.2.2'
FAKE_USERNAME = 'user'
FAKE_PHYSICAL_INTERFACE = 'em1'
-class BrocadePluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class BrocadePluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = PLUGIN_NAME
def setUp(self):
Test vlans alloc/dealloc.
"""
-from quantum.db import api as db
-from quantum.openstack.common import context
-from quantum.plugins.brocade import vlanbm as vlan_bitmap
-from quantum.tests import base
+from neutron.db import api as db
+from neutron.openstack.common import context
+from neutron.plugins.brocade import vlanbm as vlan_bitmap
+from neutron.tests import base
class TestVlanBitmap(base.BaseTestCase):
import webob.exc as wexc
-from quantum.api.v2 import base
-from quantum.common import exceptions as q_exc
-from quantum import context
-from quantum.db import db_base_plugin_v2 as base_plugin
-from quantum.db import l3_db
-from quantum.manager import QuantumManager
-from quantum.plugins.cisco.common import cisco_constants as const
-from quantum.plugins.cisco.common import cisco_exceptions as c_exc
-from quantum.plugins.cisco.common import config as cisco_config
-from quantum.plugins.cisco.db import nexus_db_v2
-from quantum.plugins.cisco.models import virt_phy_sw_v2
-from quantum.plugins.openvswitch.common import config as ovs_config
-from quantum.plugins.openvswitch import ovs_db_v2
-from quantum.tests.unit import test_db_plugin
+from neutron.api.v2 import base
+from neutron.common import exceptions as q_exc
+from neutron import context
+from neutron.db import db_base_plugin_v2 as base_plugin
+from neutron.db import l3_db
+from neutron.manager import NeutronManager
+from neutron.plugins.cisco.common import cisco_constants as const
+from neutron.plugins.cisco.common import cisco_exceptions as c_exc
+from neutron.plugins.cisco.common import config as cisco_config
+from neutron.plugins.cisco.db import nexus_db_v2
+from neutron.plugins.cisco.models import virt_phy_sw_v2
+from neutron.plugins.openvswitch.common import config as ovs_config
+from neutron.plugins.openvswitch import ovs_db_v2
+from neutron.tests.unit import test_db_plugin
LOG = logging.getLogger(__name__)
-class CiscoNetworkPluginV2TestCase(test_db_plugin.QuantumDbPluginV2TestCase):
+class CiscoNetworkPluginV2TestCase(test_db_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = 'quantum.plugins.cisco.network_plugin.PluginV2'
+ _plugin_name = 'neutron.plugins.cisco.network_plugin.PluginV2'
def setUp(self):
# Use a mock netconf client
self.addCleanup(self.patch_obj.stop)
def _get_plugin_ref(self):
- plugin_obj = QuantumManager.get_plugin()
+ plugin_obj = NeutronManager.get_plugin()
if getattr(plugin_obj, "_master"):
plugin_ref = plugin_obj
else:
test_db_plugin.TestPortsV2):
def setUp(self):
- """Configure for end-to-end quantum testing using a mock ncclient.
+ """Configure for end-to-end neutron testing using a mock ncclient.
This setup includes:
- Configure the OVS plugin to use VLANs in the range of 1000-1100.
self.vlan_end = 1100
range_str = 'physnet1:%d:%d' % (self.vlan_start,
self.vlan_end)
- nexus_driver = ('quantum.plugins.cisco.nexus.'
+ nexus_driver = ('neutron.plugins.cisco.nexus.'
'cisco_nexus_network_driver_v2.CiscoNEXUSDriver')
config = {
"""Confirm that an HTTP status corresponds to an expected exception.
Confirm that an HTTP status which has been returned for an
- quantum API request matches the HTTP status corresponding
+ neutron API request matches the HTTP status corresponding
to an expected exception.
:param status: HTTP status
self._assertExpectedHTTP(res.status_int, inserted_exc)
# Check that the port still has the original device ID
- plugin = base_plugin.QuantumDbPluginV2()
+ plugin = base_plugin.NeutronDbPluginV2()
ctx = context.get_admin_context()
db_port = plugin._get_port(ctx, port_id)
self.assertEqual(db_port['device_id'],
import mock
-from quantum.db import api as db
-from quantum.openstack.common import importutils
-from quantum.plugins.cisco.common import cisco_constants as const
-from quantum.plugins.cisco.common import cisco_exceptions as cisco_exc
-from quantum.plugins.cisco.nexus import cisco_nexus_plugin_v2
-from quantum.tests import base
+from neutron.db import api as db
+from neutron.openstack.common import importutils
+from neutron.plugins.cisco.common import cisco_constants as const
+from neutron.plugins.cisco.common import cisco_exceptions as cisco_exc
+from neutron.plugins.cisco.nexus import cisco_nexus_plugin_v2
+from neutron.tests import base
NEXUS_IP_ADDRESS = '1.1.1.1'
INSTANCE = 'testvm'
NEXUS_PORTS = '1/10'
NEXUS_SSH_PORT = '22'
-NEXUS_DRIVER = ('quantum.plugins.cisco.nexus.'
+NEXUS_DRIVER = ('neutron.plugins.cisco.nexus.'
'cisco_nexus_network_driver_v2.CiscoNEXUSDriver')
"""stubs.py provides interface methods for the database test cases"""
-from quantum.db import api as db
-from quantum.openstack.common import log as logging
+from neutron.db import api as db
+from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
-class QuantumDB(object):
- """Class conisting of methods to call Quantum db methods."""
+class NeutronDB(object):
+ """Class conisting of methods to call Neutron db methods."""
def get_all_networks(self, tenant_id):
"""Get all networks."""
nets = []
import webob.exc
-from quantum.api.extensions import ExtensionMiddleware
-from quantum.api.extensions import PluginAwareExtensionManager
-from quantum.common import config
-from quantum import context
-from quantum.db.loadbalancer import loadbalancer_db as ldb
-import quantum.extensions
-from quantum.extensions import loadbalancer
-from quantum.plugins.common import constants
-from quantum.services.loadbalancer import (
+from neutron.api.extensions import ExtensionMiddleware
+from neutron.api.extensions import PluginAwareExtensionManager
+from neutron.common import config
+from neutron import context
+from neutron.db.loadbalancer import loadbalancer_db as ldb
+import neutron.extensions
+from neutron.extensions import loadbalancer
+from neutron.plugins.common import constants
+from neutron.services.loadbalancer import (
plugin as loadbalancer_plugin
)
-from quantum.tests.unit import test_db_plugin
+from neutron.tests.unit import test_db_plugin
LOG = logging.getLogger(__name__)
-DB_CORE_PLUGIN_KLASS = 'quantum.db.db_base_plugin_v2.QuantumDbPluginV2'
+DB_CORE_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
DB_LB_PLUGIN_KLASS = (
- "quantum.services.loadbalancer."
+ "neutron.services.loadbalancer."
"plugin.LoadBalancerPlugin"
)
ROOTDIR = os.path.dirname(__file__) + '../../../..'
ETCDIR = os.path.join(ROOTDIR, 'etc')
-extensions_path = ':'.join(quantum.extensions.__path__)
+extensions_path = ':'.join(neutron.extensions.__path__)
def etcdir(*p):
return os.path.join(ETCDIR, *p)
-class LoadBalancerPluginDbTestCase(test_db_plugin.QuantumDbPluginV2TestCase):
+class LoadBalancerPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
resource_prefix_map = dict(
(k, constants.COMMON_PREFIXES[constants.LOADBALANCER])
for k in loadbalancer.RESOURCE_ATTRIBUTE_MAP.keys()
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.api import extensions
-from quantum.api.v2 import base
-from quantum.common import exceptions
-from quantum.db import servicetype_db
-from quantum.extensions import servicetype
-from quantum import manager
-from quantum.openstack.common import uuidutils
-from quantum.plugins.common import constants
-from quantum.services.service_base import ServicePluginBase
+from neutron.api import extensions
+from neutron.api.v2 import base
+from neutron.common import exceptions
+from neutron.db import servicetype_db
+from neutron.extensions import servicetype
+from neutron import manager
+from neutron.openstack.common import uuidutils
+from neutron.plugins.common import constants
+from neutron.services.service_base import ServicePluginBase
DUMMY_PLUGIN_NAME = "dummy_plugin"
@classmethod
def get_namespace(cls):
- return "http://docs.openstack.org/ext/quantum/dummy/api/v1.0"
+ return "http://docs.openstack.org/ext/neutron/dummy/api/v1.0"
@classmethod
def get_updated(cls):
@classmethod
def get_resources(cls):
"""Returns Extended Resource for dummy management."""
- q_mgr = manager.QuantumManager.get_instance()
+ q_mgr = manager.NeutronManager.get_instance()
dummy_inst = q_mgr.get_service_plugins()['DUMMY']
controller = base.create_resource(
COLLECTION_NAME, RESOURCE_NAME, dummy_inst,
return DUMMY_PLUGIN_NAME
def get_plugin_description(self):
- return "Quantum Dummy Service Plugin"
+ return "Neutron Dummy Service Plugin"
def get_dummys(self, context, filters, fields):
return self.dummys.values()
from abc import abstractmethod
-from quantum.api import extensions
-from quantum import wsgi
+from neutron.api import extensions
+from neutron import wsgi
class StubExtension(object):
#
# @author: Kaiwei Fan, VMware, Inc
-from quantum.api import extensions
+from neutron.api import extensions
EXTENDED_ATTRIBUTE = 'extended_attribute'
EXTENDED_ATTRIBUTES_2_0 = {
from abc import abstractmethod
-from quantum.api import extensions
-from quantum.api.v2 import base
-from quantum import manager
-from quantum import quota
+from neutron.api import extensions
+from neutron.api.v2 import base
+from neutron import manager
+from neutron import quota
# Attribute Map
def get_resources(cls):
"""Returns Ext Resources."""
exts = []
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
resource_name = 'ext_test_resource'
collection_name = resource_name + "s"
params = RESOURCE_ATTRIBUTE_MAP.get(collection_name, dict())
from abc import abstractmethod
-from quantum.api import extensions
-from quantum.openstack.common import jsonutils
-from quantum import wsgi
+from neutron.api import extensions
+from neutron.openstack.common import jsonutils
+from neutron import wsgi
class FoxInSocksController(wsgi.Controller):
# under the License.
"""
-Unit tests for Windows Hyper-V virtual switch quantum driver
+Unit tests for Windows Hyper-V virtual switch neutron driver
"""
import mock
from oslo.config import cfg
-from quantum.plugins.hyperv.agent import hyperv_quantum_agent
-from quantum.tests import base
+from neutron.plugins.hyperv.agent import hyperv_neutron_agent
+from neutron.tests import base
-class TestHyperVQuantumAgent(base.BaseTestCase):
+class TestHyperVNeutronAgent(base.BaseTestCase):
def setUp(self):
- super(TestHyperVQuantumAgent, self).setUp()
+ super(TestHyperVNeutronAgent, self).setUp()
self.addCleanup(cfg.CONF.reset)
# Avoid rpc initialization for unit tests
cfg.CONF.set_override('rpc_backend',
- 'quantum.openstack.common.rpc.impl_fake')
- self.agent = hyperv_quantum_agent.HyperVQuantumAgent()
+ 'neutron.openstack.common.rpc.impl_fake')
+ self.agent = hyperv_neutron_agent.HyperVNeutronAgent()
self.agent.plugin_rpc = mock.Mock()
self.agent.context = mock.Mock()
self.agent.agent_id = mock.Mock()
from oslo.config import cfg
-from quantum import context
-from quantum.extensions import portbindings
-from quantum.manager import QuantumManager
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron import context
+from neutron.extensions import portbindings
+from neutron.manager import NeutronManager
+from neutron.tests.unit import test_db_plugin as test_plugin
-class HyperVQuantumPluginTestCase(test_plugin.QuantumDbPluginV2TestCase):
+class HyperVNeutronPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = ('quantum.plugins.hyperv.'
- 'hyperv_quantum_plugin.HyperVQuantumPlugin')
+ _plugin_name = ('neutron.plugins.hyperv.'
+ 'hyperv_neutron_plugin.HyperVNeutronPlugin')
def setUp(self):
- super(HyperVQuantumPluginTestCase, self).setUp(self._plugin_name)
+ super(HyperVNeutronPluginTestCase, self).setUp(self._plugin_name)
class TestHyperVVirtualSwitchBasicGet(
- test_plugin.TestBasicGet, HyperVQuantumPluginTestCase):
+ test_plugin.TestBasicGet, HyperVNeutronPluginTestCase):
pass
class TestHyperVVirtualSwitchV2HTTPResponse(
- test_plugin.TestV2HTTPResponse, HyperVQuantumPluginTestCase):
+ test_plugin.TestV2HTTPResponse, HyperVNeutronPluginTestCase):
pass
class TestHyperVVirtualSwitchPortsV2(
- test_plugin.TestPortsV2, HyperVQuantumPluginTestCase):
+ test_plugin.TestPortsV2, HyperVNeutronPluginTestCase):
def test_port_vif_details(self):
with self.port(name='name') as port:
self.assertEqual(port['port']['binding:vif_type'],
def test_ports_vif_details(self):
cfg.CONF.set_default('allow_overlapping_ips', True)
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
with contextlib.nested(self.port(), self.port()) as (port1, port2):
ctx = context.get_admin_context()
ports = plugin.get_ports(ctx)
class TestHyperVVirtualSwitchNetworksV2(
- test_plugin.TestNetworksV2, HyperVQuantumPluginTestCase):
+ test_plugin.TestNetworksV2, HyperVNeutronPluginTestCase):
pass
# under the License.
"""
-Unit Tests for hyperv quantum rpc
+Unit Tests for hyperv neutron rpc
"""
import mock
-from quantum.agent import rpc as agent_rpc
-from quantum.common import topics
-from quantum.openstack.common import context
-from quantum.openstack.common import rpc
-from quantum.plugins.hyperv import agent_notifier_api as ana
-from quantum.plugins.hyperv.common import constants
-from quantum.tests import base
+from neutron.agent import rpc as agent_rpc
+from neutron.common import topics
+from neutron.openstack.common import context
+from neutron.openstack.common import rpc
+from neutron.plugins.hyperv import agent_notifier_api as ana
+from neutron.plugins.hyperv.common import constants
+from neutron.tests import base
class rpcHyperVApiTestCase(base.BaseTestCase):
- def _test_hyperv_quantum_api(
+ def _test_hyperv_neutron_api(
self, rpcapi, topic, method, rpc_method, **kwargs):
ctxt = context.RequestContext('fake_user', 'fake_project')
expected_retval = 'foo' if method == 'call' else None
def test_delete_network(self):
rpcapi = ana.AgentNotifierApi(topics.AGENT)
- self._test_hyperv_quantum_api(
+ self._test_hyperv_neutron_api(
rpcapi,
topics.get_topic_name(
topics.AGENT,
def test_port_update(self):
rpcapi = ana.AgentNotifierApi(topics.AGENT)
- self._test_hyperv_quantum_api(
+ self._test_hyperv_neutron_api(
rpcapi,
topics.get_topic_name(
topics.AGENT,
def test_port_delete(self):
rpcapi = ana.AgentNotifierApi(topics.AGENT)
- self._test_hyperv_quantum_api(
+ self._test_hyperv_neutron_api(
rpcapi,
topics.get_topic_name(
topics.AGENT,
def test_tunnel_update(self):
rpcapi = ana.AgentNotifierApi(topics.AGENT)
- self._test_hyperv_quantum_api(
+ self._test_hyperv_neutron_api(
rpcapi,
topics.get_topic_name(
topics.AGENT,
def test_device_details(self):
rpcapi = agent_rpc.PluginApi(topics.PLUGIN)
- self._test_hyperv_quantum_api(
+ self._test_hyperv_neutron_api(
rpcapi, topics.PLUGIN,
'get_device_details', rpc_method='call',
device='fake_device',
def test_update_device_down(self):
rpcapi = agent_rpc.PluginApi(topics.PLUGIN)
- self._test_hyperv_quantum_api(
+ self._test_hyperv_neutron_api(
rpcapi, topics.PLUGIN,
'update_device_down', rpc_method='call',
device='fake_device',
def test_tunnel_sync(self):
rpcapi = agent_rpc.PluginApi(topics.PLUGIN)
- self._test_hyperv_quantum_api(
+ self._test_hyperv_neutron_api(
rpcapi, topics.PLUGIN,
'tunnel_sync', rpc_method='call',
tunnel_ip='fake_tunnel_ip')
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.tests.unit.linuxbridge import test_linuxbridge_plugin
-from quantum.tests.unit.openvswitch import test_agent_scheduler
+from neutron.tests.unit.linuxbridge import test_linuxbridge_plugin
+from neutron.tests.unit.openvswitch import test_agent_scheduler
class LbAgentSchedulerTestCase(
from oslo.config import cfg
-from quantum.plugins.linuxbridge.common import config # noqa
-from quantum.tests import base
+from neutron.plugins.linuxbridge.common import config # noqa
+from neutron.tests import base
class ConfigurationTest(base.BaseTestCase):
import testtools
from testtools import matchers
-from quantum.common import exceptions as q_exc
-from quantum.db import api as db
-from quantum.plugins.linuxbridge.db import l2network_db_v2 as lb_db
-from quantum.tests import base
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.common import exceptions as q_exc
+from neutron.db import api as db
+from neutron.plugins.linuxbridge.db import l2network_db_v2 as lb_db
+from neutron.tests import base
+from neutron.tests.unit import test_db_plugin as test_plugin
PHYS_NET = 'physnet1'
PHYS_NET_2 = 'physnet2'
self.assertIsNone(lb_db.get_network_state(PHYS_NET, vlan_id))
-class NetworkBindingsTest(test_plugin.QuantumDbPluginV2TestCase):
+class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
def setUp(self):
super(NetworkBindingsTest, self).setUp()
lb_db.initialize()
from oslo.config import cfg
import testtools
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.openstack.common.rpc import common as rpc_common
-from quantum.plugins.linuxbridge.agent import linuxbridge_quantum_agent
-from quantum.plugins.linuxbridge.common import constants as lconst
-from quantum.tests import base
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.openstack.common.rpc import common as rpc_common
+from neutron.plugins.linuxbridge.agent import linuxbridge_neutron_agent
+from neutron.plugins.linuxbridge.common import constants as lconst
+from neutron.tests import base
class TestLinuxBridge(base.BaseTestCase):
interface_mappings = {'physnet1': 'eth1'}
root_helper = cfg.CONF.AGENT.root_helper
- self.linux_bridge = linuxbridge_quantum_agent.LinuxBridgeManager(
+ self.linux_bridge = linuxbridge_neutron_agent.LinuxBridgeManager(
interface_mappings, root_helper)
def test_ensure_physical_in_bridge_invalid(self):
def setUp(self):
super(TestLinuxBridgeAgent, self).setUp()
cfg.CONF.set_override('rpc_backend',
- 'quantum.openstack.common.rpc.impl_fake')
- self.lbmgr_patcher = mock.patch('quantum.plugins.linuxbridge.agent.'
- 'linuxbridge_quantum_agent.'
+ 'neutron.openstack.common.rpc.impl_fake')
+ self.lbmgr_patcher = mock.patch('neutron.plugins.linuxbridge.agent.'
+ 'linuxbridge_neutron_agent.'
'LinuxBridgeManager')
self.lbmgr_mock = self.lbmgr_patcher.start()
self.addCleanup(self.lbmgr_patcher.stop)
self.execute = self.execute_p.start()
self.addCleanup(self.execute_p.stop)
self.execute.return_value = '\n'.join(self.LINK_SAMPLE)
- self.get_mac_p = mock.patch('quantum.agent.linux.utils.'
+ self.get_mac_p = mock.patch('neutron.agent.linux.utils.'
'get_interface_mac')
self.get_mac = self.get_mac_p.start()
self.addCleanup(self.get_mac_p.stop)
def test_update_devices_failed(self):
lbmgr_instance = self.lbmgr_mock.return_value
lbmgr_instance.update_devices.side_effect = RuntimeError
- agent = linuxbridge_quantum_agent.LinuxBridgeQuantumAgentRPC({},
+ agent = linuxbridge_neutron_agent.LinuxBridgeNeutronAgentRPC({},
0,
None)
raise_exception = [0]
else:
raise RuntimeError()
- with mock.patch.object(linuxbridge_quantum_agent.LOG, 'info') as log:
+ with mock.patch.object(linuxbridge_neutron_agent.LOG, 'info') as log:
log.side_effect = info_mock
with testtools.ExpectedException(RuntimeError):
agent.daemon_loop()
device_info = {'current': [1, 2, 3]}
lbmgr_instance = self.lbmgr_mock.return_value
lbmgr_instance.update_devices.return_value = device_info
- agent = linuxbridge_quantum_agent.LinuxBridgeQuantumAgentRPC({},
+ agent = linuxbridge_neutron_agent.LinuxBridgeNeutronAgentRPC({},
0,
None)
raise_exception = [0]
raise RuntimeError()
with contextlib.nested(
- mock.patch.object(linuxbridge_quantum_agent.LOG, 'info'),
+ mock.patch.object(linuxbridge_neutron_agent.LOG, 'info'),
mock.patch.object(agent, 'process_network_devices')
) as (log, process_network_devices):
log.side_effect = info_mock
self.interface_mappings = {'physnet1': 'eth1'}
self.root_helper = cfg.CONF.AGENT.root_helper
- self.lbm = linuxbridge_quantum_agent.LinuxBridgeManager(
+ self.lbm = linuxbridge_neutron_agent.LinuxBridgeManager(
self.interface_mappings, self.root_helper)
def test_device_exists(self):
self.assertEqual(self.lbm.get_tap_device_name(if_id),
"tap")
- def test_get_all_quantum_bridges(self):
+ def test_get_all_neutron_bridges(self):
br_list = ["br-int", "brq1", "brq2", "br-ex"]
with mock.patch.object(os, 'listdir') as listdir_fn:
listdir_fn.return_value = br_list
- self.assertEqual(self.lbm.get_all_quantum_bridges(),
+ self.assertEqual(self.lbm.get_all_neutron_bridges(),
br_list[1:3])
self.assertTrue(listdir_fn.called)
def test_get_bridge_for_tap_device(self):
with contextlib.nested(
- mock.patch.object(self.lbm, "get_all_quantum_bridges"),
+ mock.patch.object(self.lbm, "get_all_neutron_bridges"),
mock.patch.object(self.lbm, "get_interfaces_on_bridge")
) as (get_all_qbr_fn, get_if_fn):
get_all_qbr_fn.return_value = ["br-int", "br-ex"]
class FakeLBAgent(object):
def __init__(self):
self.agent_id = 1
- self.br_mgr = (linuxbridge_quantum_agent.
+ self.br_mgr = (linuxbridge_neutron_agent.
LinuxBridgeManager({'physnet1': 'eth1'},
cfg.CONF.AGENT.root_helper))
- self.lb_rpc = linuxbridge_quantum_agent.LinuxBridgeRpcCallbacks(
+ self.lb_rpc = linuxbridge_neutron_agent.LinuxBridgeRpcCallbacks(
object(),
FakeLBAgent()
)
"refresh_firewall", create=True),
mock.patch.object(self.lb_rpc.agent,
"plugin_rpc", create=True),
- mock.patch.object(linuxbridge_quantum_agent.LOG, 'error'),
+ mock.patch.object(linuxbridge_neutron_agent.LOG, 'error'),
) as (get_tap_fn, udev_fn, _, _, _, _, plugin_rpc, log):
get_tap_fn.return_value = "tap123"
udev_fn.return_value = ["tap123", "tap124"]
import mock
-from quantum.api.v2 import attributes
-from quantum.extensions import securitygroup as ext_sg
-from quantum.plugins.linuxbridge.db import l2network_db_v2 as lb_db
-from quantum.tests.unit import test_extension_security_group as test_sg
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
-
-
-PLUGIN_NAME = ('quantum.plugins.linuxbridge.'
- 'lb_quantum_plugin.LinuxBridgePluginV2')
-AGENT_NAME = ('quantum.plugins.linuxbridge.'
- 'agent.linuxbridg_quantum_agent.LinuxBridgeQuantumAgentRPC')
-NOTIFIER = ('quantum.plugins.linuxbridge.'
- 'lb_quantum_plugin.AgentNotifierApi')
+from neutron.api.v2 import attributes
+from neutron.extensions import securitygroup as ext_sg
+from neutron.plugins.linuxbridge.db import l2network_db_v2 as lb_db
+from neutron.tests.unit import test_extension_security_group as test_sg
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
+
+
+PLUGIN_NAME = ('neutron.plugins.linuxbridge.'
+ 'lb_neutron_plugin.LinuxBridgePluginV2')
+AGENT_NAME = ('neutron.plugins.linuxbridge.'
+ 'agent.linuxbridg_neutron_agent.LinuxBridgeNeutronAgentRPC')
+NOTIFIER = ('neutron.plugins.linuxbridge.'
+ 'lb_neutron_plugin.AgentNotifierApi')
class LinuxBridgeSecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.extensions import portbindings
-from quantum.tests.unit import _test_extension_portbindings as test_bindings
-from quantum.tests.unit import test_db_plugin as test_plugin
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.extensions import portbindings
+from neutron.tests.unit import _test_extension_portbindings as test_bindings
+from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
-PLUGIN_NAME = ('quantum.plugins.linuxbridge.'
- 'lb_quantum_plugin.LinuxBridgePluginV2')
+PLUGIN_NAME = ('neutron.plugins.linuxbridge.'
+ 'lb_neutron_plugin.LinuxBridgePluginV2')
-class LinuxBridgePluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class LinuxBridgePluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = PLUGIN_NAME
def setUp(self):
from oslo.config import cfg
import stubout
-from quantum.agent import rpc as agent_rpc
-from quantum.common import topics
-from quantum.openstack.common import context
-from quantum.openstack.common import rpc
-from quantum.plugins.linuxbridge import lb_quantum_plugin as plb
-from quantum.tests import base
+from neutron.agent import rpc as agent_rpc
+from neutron.common import topics
+from neutron.openstack.common import context
+from neutron.openstack.common import rpc
+from neutron.plugins.linuxbridge import lb_neutron_plugin as plb
+from neutron.tests import base
class rpcApiTestCase(base.BaseTestCase):
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_gwmode_db
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_gwmode_db
-class Fake1(db_base_plugin_v2.QuantumDbPluginV2,
+class Fake1(db_base_plugin_v2.NeutronDbPluginV2,
l3_gwmode_db.L3_NAT_db_mixin):
supported_extension_aliases = ['router']
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.common.test_lib import test_config
-from quantum.tests.unit.metaplugin.test_metaplugin import setup_metaplugin_conf
-from quantum.tests.unit import test_db_plugin as test_plugin
-from quantum.tests.unit import test_l3_plugin
+from neutron.common.test_lib import test_config
+from neutron.tests.unit.metaplugin.test_metaplugin import setup_metaplugin_conf
+from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import test_l3_plugin
-class MetaPluginV2DBTestCase(test_plugin.QuantumDbPluginV2TestCase):
+class MetaPluginV2DBTestCase(test_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = ('quantum.plugins.metaplugin.'
- 'meta_quantum_plugin.MetaPluginV2')
+ _plugin_name = ('neutron.plugins.metaplugin.'
+ 'meta_neutron_plugin.MetaPluginV2')
def setUp(self):
setup_metaplugin_conf()
import stubout
import testtools
-from quantum import context
-from quantum.db import api as db
-from quantum.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
-from quantum.openstack.common import uuidutils
-from quantum.plugins.metaplugin.meta_quantum_plugin import FlavorNotFound
-from quantum.plugins.metaplugin.meta_quantum_plugin import MetaPluginV2
-from quantum.tests import base
+from neutron import context
+from neutron.db import api as db
+from neutron.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
+from neutron.openstack.common import uuidutils
+from neutron.plugins.metaplugin.meta_neutron_plugin import FlavorNotFound
+from neutron.plugins.metaplugin.meta_neutron_plugin import MetaPluginV2
+from neutron.tests import base
CONF_FILE = ""
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
-META_PATH = "quantum.plugins.metaplugin"
-FAKE_PATH = "quantum.tests.unit.metaplugin"
-PROXY_PATH = "%s.proxy_quantum_plugin.ProxyPluginV2" % META_PATH
+META_PATH = "neutron.plugins.metaplugin"
+FAKE_PATH = "neutron.tests.unit.metaplugin"
+PROXY_PATH = "%s.proxy_neutron_plugin.ProxyPluginV2" % META_PATH
PLUGIN_LIST = """
fake1:%s.fake_plugin.Fake1,fake2:%s.fake_plugin.Fake2,proxy:%s
""".strip() % (FAKE_PATH, FAKE_PATH, PROXY_PATH)
cfg.CONF.set_override('auth_url', 'http://localhost:35357/v2.0',
'PROXY')
cfg.CONF.set_override('auth_region', 'RegionOne', 'PROXY')
- cfg.CONF.set_override('admin_user', 'quantum', 'PROXY')
+ cfg.CONF.set_override('admin_user', 'neutron', 'PROXY')
cfg.CONF.set_override('admin_password', 'password', 'PROXY')
cfg.CONF.set_override('admin_tenant_name', 'service', 'PROXY')
cfg.CONF.set_override('plugin_list', PLUGIN_LIST, 'META')
#TODO(nati) remove this after subnet quota change is merged
cfg.CONF.set_override('max_dns_nameservers', 10)
cfg.CONF.set_override('rpc_backend',
- 'quantum.openstack.common.rpc.impl_fake')
+ 'neutron.openstack.common.rpc.impl_fake')
-class MetaQuantumPluginV2Test(base.BaseTestCase):
- """Class conisting of MetaQuantumPluginV2 unit tests."""
+class MetaNeutronPluginV2Test(base.BaseTestCase):
+ """Class conisting of MetaNeutronPluginV2 unit tests."""
def setUp(self):
- super(MetaQuantumPluginV2Test, self).setUp()
+ super(MetaNeutronPluginV2Test, self).setUp()
db._ENGINE = None
db._MAKER = None
self.fake_tenant_id = uuidutils.generate_uuid()
self.mox = mox.Mox()
self.stubs = stubout.StubOutForTesting()
- self.client_cls_p = mock.patch('quantumclient.v2_0.client.Client')
+ self.client_cls_p = mock.patch('neutronclient.v2_0.client.Client')
client_cls = self.client_cls_p.start()
self.client_inst = mock.Mock()
client_cls.return_value = self.client_inst
self.stubs.SmartUnsetAll()
self.mox.VerifyAll()
db.clear_db()
- super(MetaQuantumPluginV2Test, self).tearDown()
+ super(MetaNeutronPluginV2Test, self).tearDown()
import testtools
import webob.exc as w_exc
-from quantum.openstack.common import uuidutils
-from quantum.plugins.midonet import midonet_lib
-import quantum.tests.unit.midonet.mock_lib as mock_lib
+from neutron.openstack.common import uuidutils
+from neutron.plugins.midonet import midonet_lib
+import neutron.tests.unit.midonet.mock_lib as mock_lib
def _create_test_chain(id, name, tenant_id):
import os
import sys
-import quantum.common.test_lib as test_lib
-import quantum.tests.unit.midonet.mock_lib as mock_lib
-import quantum.tests.unit.test_db_plugin as test_plugin
+import neutron.common.test_lib as test_lib
+import neutron.tests.unit.midonet.mock_lib as mock_lib
+import neutron.tests.unit.test_db_plugin as test_plugin
-MIDOKURA_PKG_PATH = "quantum.plugins.midonet.plugin"
+MIDOKURA_PKG_PATH = "neutron.plugins.midonet.plugin"
# Need to mock the midonetclient module since the plugin will try to load it.
sys.modules["midonetclient"] = mock.Mock()
-class MidonetPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class MidonetPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = ('%s.MidonetPluginV2' % MIDOKURA_PKG_PATH)
def setUp(self):
self.mock_api = mock.patch(
- 'quantum.plugins.midonet.midonet_lib.MidoClient')
+ 'neutron.plugins.midonet.midonet_lib.MidoClient')
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
test_lib.test_config['config_files'] = [os.path.join(
etc_path, 'midonet.ini.test')]
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.tests.unit.ml2 import test_ml2_plugin
-from quantum.tests.unit.openvswitch import test_agent_scheduler
+from neutron.tests.unit.ml2 import test_ml2_plugin
+from neutron.tests.unit.openvswitch import test_agent_scheduler
class Ml2AgentSchedulerTestCase(
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.tests.unit import _test_extension_portbindings as test_bindings
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import _test_extension_portbindings as test_bindings
+from neutron.tests.unit import test_db_plugin as test_plugin
-PLUGIN_NAME = 'quantum.plugins.ml2.plugin.Ml2Plugin'
+PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
-class Ml2PluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = PLUGIN_NAME
import mock
-from quantum.agent import rpc as agent_rpc
-from quantum.common import topics
-from quantum.openstack.common import context
-from quantum.openstack.common import rpc
-from quantum.plugins.ml2 import rpc as plugin_rpc
-from quantum.tests import base
+from neutron.agent import rpc as agent_rpc
+from neutron.common import topics
+from neutron.openstack.common import context
+from neutron.openstack.common import rpc
+from neutron.plugins.ml2 import rpc as plugin_rpc
+from neutron.tests import base
class RpcApiTestCase(base.BaseTestCase):
import mock
-from quantum.api.v2 import attributes
-from quantum.extensions import securitygroup as ext_sg
-from quantum import manager
-from quantum.tests.unit import test_extension_security_group as test_sg
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.api.v2 import attributes
+from neutron.extensions import securitygroup as ext_sg
+from neutron import manager
+from neutron.tests.unit import test_extension_security_group as test_sg
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
-PLUGIN_NAME = 'quantum.plugins.ml2.plugin.Ml2Plugin'
-NOTIFIER = 'quantum.plugins.ml2.rpc.AgentNotifierApi'
+PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
+NOTIFIER = 'neutron.plugins.ml2.rpc.AgentNotifierApi'
class Ml2SecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
res = self.deserialize(self.fmt,
req.get_response(self.api))
port_id = res['port']['id']
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin.callbacks.get_port_from_device(port_id)
self.assertEqual(port_id, port_dict['id'])
self.assertEqual([security_group_id],
self._delete('ports', port_id)
def test_security_group_get_port_from_device_with_no_port(self):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin.callbacks.get_port_from_device('bad_device_id')
self.assertEqual(None, port_dict)
from oslo.config import cfg
#NOTE this import loads tests required options
-from quantum.plugins.mlnx.common import config # noqa
-from quantum.tests import base
+from neutron.plugins.mlnx.common import config # noqa
+from neutron.tests import base
class ConfigurationTest(base.BaseTestCase):
from testtools import matchers
-from quantum.common import exceptions as q_exc
-from quantum.db import api as db
-from quantum.plugins.mlnx.db import mlnx_db_v2 as mlnx_db
-from quantum.tests import base
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.common import exceptions as q_exc
+from neutron.db import api as db
+from neutron.plugins.mlnx.db import mlnx_db_v2 as mlnx_db
+from neutron.tests import base
+from neutron.tests.unit import test_db_plugin as test_plugin
PHYS_NET = 'physnet1'
PHYS_NET_2 = 'physnet2'
self.assertIsNone(mlnx_db.get_network_state(PHYS_NET, vlan_id))
-class NetworkBindingsTest(test_plugin.QuantumDbPluginV2TestCase):
+class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
def setUp(self):
super(NetworkBindingsTest, self).setUp()
mlnx_db.initialize()
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.plugins.mlnx.common import constants
-from quantum.tests.unit import _test_extension_portbindings as test_bindings
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.plugins.mlnx.common import constants
+from neutron.tests.unit import _test_extension_portbindings as test_bindings
+from neutron.tests.unit import test_db_plugin as test_plugin
-PLUGIN_NAME = ('quantum.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin')
+PLUGIN_NAME = ('neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin')
-class MlnxPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class MlnxPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = PLUGIN_NAME
def setUp(self):
import stubout
-from quantum.agent import rpc as agent_rpc
-from quantum.common import topics
-from quantum.openstack.common import context
-from quantum.openstack.common import rpc
-from quantum.plugins.mlnx import agent_notify_api
-from quantum.tests import base
+from neutron.agent import rpc as agent_rpc
+from neutron.common import topics
+from neutron.openstack.common import context
+from neutron.openstack.common import rpc
+from neutron.plugins.mlnx import agent_notify_api
+from neutron.tests import base
class rpcApiTestCase(base.BaseTestCase):
# under the License.
# @author: Ryota MIBU
-from quantum.plugins.nec import ofc_driver_base
+from neutron.plugins.nec import ofc_driver_base
class StubOFCDriver(ofc_driver_base.OFCDriverBase):
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.tests.unit.nec import test_nec_plugin
-from quantum.tests.unit.openvswitch import test_agent_scheduler
+from neutron.tests.unit.nec import test_nec_plugin
+from neutron.tests.unit.openvswitch import test_agent_scheduler
class NecAgentSchedulerTestCase(
# under the License.
# @author: Ryota MIBU
-from quantum.plugins.nec.common import config
-from quantum.tests import base
+from neutron.plugins.nec.common import config
+from neutron.tests import base
class ConfigurationTest(base.BaseTestCase):
import random
-from quantum.common import constants as q_const
-from quantum.db import api as db_api
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nec.common import exceptions as nexc
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec.db import models as nmodels # noqa
-from quantum.tests import base
+from neutron.common import constants as q_const
+from neutron.db import api as db_api
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nec.common import exceptions as nexc
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec.db import models as nmodels # noqa
+from neutron.tests import base
class NECPluginV2DBTestBase(base.BaseTestCase):
def get_ofc_item_random_params(self):
"""create random parameters for ofc_item test."""
ofc_id = uuidutils.generate_uuid()
- quantum_id = uuidutils.generate_uuid()
+ neutron_id = uuidutils.generate_uuid()
none = uuidutils.generate_uuid()
- return ofc_id, quantum_id, none
+ return ofc_id, neutron_id, none
def get_portinfo_random_params(self):
"""create random parameters for portinfo test."""
from oslo.config import cfg
import testtools
-from quantum.agent.linux import ovs_lib
-from quantum.extensions import securitygroup as ext_sg
-from quantum.plugins.nec.agent import nec_quantum_agent
-from quantum.tests import base
+from neutron.agent.linux import ovs_lib
+from neutron.extensions import securitygroup as ext_sg
+from neutron.plugins.nec.agent import nec_neutron_agent
+from neutron.tests import base
DAEMON_LOOP_COUNT = 10
OVS_DPID = '00000629355b6943'
self.addCleanup(cfg.CONF.reset)
self.addCleanup(mock.patch.stopall)
cfg.CONF.set_override('rpc_backend',
- 'quantum.openstack.common.rpc.impl_fake')
+ 'neutron.openstack.common.rpc.impl_fake')
cfg.CONF.set_override('host', 'dummy-host')
with contextlib.nested(
mock.patch.object(ovs_lib.OVSBridge, 'get_datapath_id',
return_value=OVS_DPID),
mock.patch('socket.gethostname', return_value='dummy-host'),
- mock.patch('quantum.openstack.common.loopingcall.'
+ mock.patch('neutron.openstack.common.loopingcall.'
'FixedIntervalLoopingCall'),
- mock.patch('quantum.agent.rpc.PluginReportStateAPI')
+ mock.patch('neutron.agent.rpc.PluginReportStateAPI')
) as (get_datapath_id, gethostname,
loopingcall, state_rpc_api):
kwargs = {'integ_br': 'integ_br',
'root_helper': 'dummy_wrapper',
'polling_interval': 1}
- self.agent = nec_quantum_agent.NECQuantumAgent(**kwargs)
+ self.agent = nec_neutron_agent.NECNeutronAgent(**kwargs)
self.loopingcall = loopingcall
self.state_rpc_api = state_rpc_api
with contextlib.nested(
mock.patch.object(time, 'sleep', side_effect=sleep_mock),
mock.patch.object(ovs_lib.OVSBridge, 'get_vif_ports'),
- mock.patch.object(nec_quantum_agent.NECPluginApi, 'update_ports'),
+ mock.patch.object(nec_neutron_agent.NECPluginApi, 'update_ports'),
mock.patch.object(self.agent.sg_agent, 'prepare_devices_filter'),
mock.patch.object(self.agent.sg_agent, 'remove_devices_filter')
) as (sleep, get_vif_potrs, update_ports,
self.num_ports_hist.append(num_ports)
def _test_report_state(self, fail_mode):
- log_mocked = mock.patch.object(nec_quantum_agent, 'LOG')
+ log_mocked = mock.patch.object(nec_neutron_agent, 'LOG')
log_patched = log_mocked.start()
def record_state(*args, **kwargs):
self.num_ports_hist)):
rec, num_ports = x
expected_state = {
- 'binary': 'quantum-nec-agent',
+ 'binary': 'neutron-nec-agent',
'host': 'dummy-host',
'topic': 'N/A',
'configurations': {'devices': 0},
def _test_plugin_api(self, expected_failure=False):
with contextlib.nested(
- mock.patch.object(nec_quantum_agent.NECPluginApi, 'make_msg'),
- mock.patch.object(nec_quantum_agent.NECPluginApi, 'call'),
- mock.patch.object(nec_quantum_agent, 'LOG')
+ mock.patch.object(nec_neutron_agent.NECPluginApi, 'make_msg'),
+ mock.patch.object(nec_neutron_agent.NECPluginApi, 'call'),
+ mock.patch.object(nec_neutron_agent, 'LOG')
) as (make_msg, apicall, log):
agent_id = 'nec-q-agent.dummy-host'
if expected_failure:
class TestNecAgentMain(base.BaseTestCase):
def test_main(self):
with contextlib.nested(
- mock.patch.object(nec_quantum_agent, 'NECQuantumAgent'),
+ mock.patch.object(nec_neutron_agent, 'NECNeutronAgent'),
mock.patch('eventlet.monkey_patch'),
- mock.patch.object(nec_quantum_agent, 'logging_config'),
- mock.patch.object(nec_quantum_agent, 'config')
+ mock.patch.object(nec_neutron_agent, 'logging_config'),
+ mock.patch.object(nec_neutron_agent, 'config')
) as (agent, eventlet, logging_config, cfg):
cfg.OVS.integration_bridge = 'br-int-x'
cfg.AGENT.root_helper = 'dummy-helper'
cfg.AGENT.polling_interval = 10
- nec_quantum_agent.main()
+ nec_neutron_agent.main()
self.assertTrue(eventlet.called)
self.assertTrue(logging_config.setup_logging.called)
import mock
-from quantum.common import topics
-from quantum import context as q_context
-from quantum.extensions import portbindings
-from quantum import manager
-from quantum.plugins.nec.common import exceptions as nexc
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec import nec_plugin
-from quantum.tests.unit import _test_extension_portbindings as test_bindings
-from quantum.tests.unit import test_db_plugin as test_plugin
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.common import topics
+from neutron import context as q_context
+from neutron.extensions import portbindings
+from neutron import manager
+from neutron.plugins.nec.common import exceptions as nexc
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec import nec_plugin
+from neutron.tests.unit import _test_extension_portbindings as test_bindings
+from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
-PLUGIN_NAME = 'quantum.plugins.nec.nec_plugin.NECPluginV2'
-OFC_MANAGER = 'quantum.plugins.nec.nec_plugin.ofc_manager.OFCManager'
-OFC_DRIVER = 'quantum.tests.unit.nec.stub_ofc_driver.StubOFCDriver'
+PLUGIN_NAME = 'neutron.plugins.nec.nec_plugin.NECPluginV2'
+OFC_MANAGER = 'neutron.plugins.nec.nec_plugin.ofc_manager.OFCManager'
+OFC_DRIVER = 'neutron.tests.unit.nec.stub_ofc_driver.StubOFCDriver'
-class NecPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class NecPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = PLUGIN_NAME
PACKET_FILTER_ENABLE = False
ofc_driver.filter_supported.return_value = self.PACKET_FILTER_ENABLE
super(NecPluginV2TestCase, self).setUp(self._plugin_name)
self.context = q_context.get_admin_context()
- self.plugin = manager.QuantumManager.get_plugin()
+ self.plugin = manager.NeutronManager.get_plugin()
class TestNecBasicGet(test_plugin.TestBasicGet, NecPluginV2TestCase):
# under the License.
# @author: Ryota MIBU
-from quantum import context
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nec.common import config
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec.db import models as nmodels # noqa
-from quantum.plugins.nec import ofc_manager
-from quantum.tests import base
+from neutron import context
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nec.common import config
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec.db import models as nmodels # noqa
+from neutron.plugins.nec import ofc_manager
+from neutron.tests import base
class OFCManagerTestBase(base.BaseTestCase):
def setUp(self):
super(OFCManagerTestBase, self).setUp()
- driver = "quantum.tests.unit.nec.stub_ofc_driver.StubOFCDriver"
+ driver = "neutron.tests.unit.nec.stub_ofc_driver.StubOFCDriver"
config.CONF.set_override('driver', driver, 'OFC')
ndb.initialize()
self.addCleanup(ndb.clear_db)
import mox
-from quantum import context
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nec.common import ofc_client as ofc
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec.db import models as nmodels
-from quantum.plugins.nec import drivers
-from quantum.tests import base
+from neutron import context
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nec.common import ofc_client as ofc
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec.db import models as nmodels
+from neutron.plugins.nec import drivers
+from neutron.tests import base
class TestConfig(object):
class PFCDriverTestBase(base.BaseTestCase):
- driver = 'quantum.plugins.nec.drivers.pfc.PFCDriverBase'
+ driver = 'neutron.plugins.nec.drivers.pfc.PFCDriverBase'
def setUp(self):
super(PFCDriverTestBase, self).setUp()
class PFCDriverStringTest(base.BaseTestCase):
- driver = 'quantum.plugins.nec.drivers.pfc.PFCDriverBase'
+ driver = 'neutron.plugins.nec.drivers.pfc.PFCDriverBase'
def setUp(self):
super(PFCDriverStringTest, self).setUp()
class PFCIdConvertTest(base.BaseTestCase):
- driver = 'quantum.plugins.nec.drivers.pfc.PFCDriverBase'
+ driver = 'neutron.plugins.nec.drivers.pfc.PFCDriverBase'
def setUp(self):
super(PFCIdConvertTest, self).setUp()
import mock
-from quantum.api.v2 import attributes
-from quantum.extensions import securitygroup as ext_sg
-from quantum import manager
-from quantum.plugins.nec.db import api as ndb # noqa
-from quantum.tests.unit.nec import test_nec_plugin
-from quantum.tests.unit import test_extension_security_group as test_sg
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.api.v2 import attributes
+from neutron.extensions import securitygroup as ext_sg
+from neutron import manager
+from neutron.plugins.nec.db import api as ndb # noqa
+from neutron.tests.unit.nec import test_nec_plugin
+from neutron.tests.unit import test_extension_security_group as test_sg
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
PLUGIN_NAME = test_nec_plugin.PLUGIN_NAME
OFC_MANAGER = test_nec_plugin.OFC_MANAGER
-AGENT_NAME = ('quantum.plugins.nec.agent.nec_quantum_agent.NECQuantumAgent')
-NOTIFIER = ('quantum.plugins.nec.nec_plugin.NECPluginV2AgentNotifierApi')
+AGENT_NAME = ('neutron.plugins.nec.agent.nec_neutron_agent.NECNeutronAgent')
+NOTIFIER = ('neutron.plugins.nec.nec_plugin.NECPluginV2AgentNotifierApi')
class NecSecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
RESOURCE_ATTRIBUTE_MAP[item].
copy())
super(NecSecurityGroupsTestCase, self).setUp(PLUGIN_NAME)
- self.notifier = manager.QuantumManager.get_plugin().notifier
+ self.notifier = manager.NeutronManager.get_plugin().notifier
def tearDown(self):
super(NecSecurityGroupsTestCase, self).tearDown()
res = self.deserialize(self.fmt,
req.get_response(self.api))
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin.callback_sg.get_port_from_device(port_id)
self.assertEqual(port_id, port_dict['id'])
self.assertEqual([sg_id],
import mox
-from quantum import context
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nec.common import ofc_client
-from quantum.plugins.nec.db import api as ndb
-from quantum.plugins.nec.db import models as nmodels
-from quantum.plugins.nec import drivers
-from quantum.tests import base
+from neutron import context
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nec.common import ofc_client
+from neutron.plugins.nec.db import api as ndb
+from neutron.plugins.nec.db import models as nmodels
+from neutron.plugins.nec import drivers
+from neutron.tests import base
class TestConfig(object):
"admin_status_enabled": "%(admin_status_enabled)s",
"_href": "/ws.v1/lrouter/%(lr_uuid)s/lport/%(uuid)s",
"tags":
- [{"scope": "q_port_id", "tag": "%(quantum_port_id)s"},
+ [{"scope": "q_port_id", "tag": "%(neutron_port_id)s"},
{"scope": "os_tid", "tag": "%(tenant_id)s"}],
"ip_addresses": %(ip_addresses_json)s,
"_schema": "/ws.v1/schema/LogicalRouterPortConfig",
"type": "LogicalRouterPortConfig",
"uuid": "%(uuid)s"
-}
\ No newline at end of file
+}
"_schema": "/ws.v1/schema/LogicalSwitchPortStatus"}
},
"tags":
- [{"scope": "q_port_id", "tag": "%(quantum_port_id)s"},
- {"scope": "vm_id", "tag": "%(quantum_device_id)s"},
+ [{"scope": "q_port_id", "tag": "%(neutron_port_id)s"},
+ {"scope": "vm_id", "tag": "%(neutron_device_id)s"},
{"scope": "os_tid", "tag": "%(tenant_id)s"}],
"uuid": "%(uuid)s",
"admin_status_enabled": "%(admin_status_enabled)s",
"_href": "/ws.v1/lswitch/%(ls_uuid)s/lport/%(uuid)s",
"security_profiles": [],
"tags":
- [{"scope": "q_port_id", "tag": "%(quantum_port_id)s"},
- {"scope": "vm_id", "tag": "%(quantum_device_id)s"},
+ [{"scope": "q_port_id", "tag": "%(neutron_port_id)s"},
+ {"scope": "vm_id", "tag": "%(neutron_device_id)s"},
{"scope": "os_tid", "tag": "%(tenant_id)s"}],
"portno": 1,
"queue_uuid": null,
import json
import urlparse
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nicira import NvpApiClient
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nicira import NvpApiClient
LOG = logging.getLogger(__name__)
# for simplyfying templating
fake_lport['ls_uuid'] = ls_uuid
fake_lport['tenant_id'] = self._get_tag(fake_lport, 'os_tid')
- fake_lport['quantum_port_id'] = self._get_tag(fake_lport,
+ fake_lport['neutron_port_id'] = self._get_tag(fake_lport,
'q_port_id')
- fake_lport['quantum_device_id'] = self._get_tag(fake_lport, 'vm_id')
+ fake_lport['neutron_device_id'] = self._get_tag(fake_lport, 'vm_id')
self._fake_lswitch_lport_dict[fake_lport['uuid']] = fake_lport
fake_lswitch = self._fake_lswitch_dict[ls_uuid]
if lr_uuid:
fake_lport['lr_uuid'] = lr_uuid
fake_lport['tenant_id'] = self._get_tag(fake_lport, 'os_tid')
- fake_lport['quantum_port_id'] = self._get_tag(fake_lport,
+ fake_lport['neutron_port_id'] = self._get_tag(fake_lport,
'q_port_id')
# replace ip_address with its json dump
if 'ip_addresses' in fake_lport:
from oslo.config import cfg
-from quantum.api.v2 import attributes
-from quantum.common.test_lib import test_config
-from quantum import context
-from quantum.extensions import agent
-from quantum.openstack.common import log as logging
-import quantum.plugins.nicira as nvp_plugin
-from quantum.tests.unit.nicira import fake_nvpapiclient
-from quantum.tests.unit import test_db_plugin
+from neutron.api.v2 import attributes
+from neutron.common.test_lib import test_config
+from neutron import context
+from neutron.extensions import agent
+from neutron.openstack.common import log as logging
+import neutron.plugins.nicira as nvp_plugin
+from neutron.tests.unit.nicira import fake_nvpapiclient
+from neutron.tests.unit import test_db_plugin
LOG = logging.getLogger(__name__)
return []
-class MacLearningDBTestCase(test_db_plugin.QuantumDbPluginV2TestCase):
+class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
fmt = 'json'
def setUp(self):
self.adminContext = context.get_admin_context()
test_config['config_files'] = [NVP_INI_CONFIG_PATH]
test_config['plugin_name_v2'] = (
- 'quantum.plugins.nicira.QuantumPlugin.NvpPluginV2')
+ 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2')
cfg.CONF.set_override('api_extensions_path',
NVP_EXTENSIONS_PATH)
# Save the original RESOURCE_ATTRIBUTE_MAP
from webob import exc
import webtest
-from quantum.api import extensions
-from quantum.api.extensions import PluginAwareExtensionManager
-from quantum.api.v2 import attributes
-from quantum.common import config
-from quantum.common.test_lib import test_config
-from quantum import context
-from quantum.db import api as db_api
-from quantum.db import db_base_plugin_v2
-from quantum import manager
-from quantum.plugins.nicira.dbexts import nicira_networkgw_db
-from quantum.plugins.nicira.extensions import nvp_networkgw as networkgw
-from quantum.tests import base
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_db_plugin
-from quantum.tests.unit import test_extensions
+from neutron.api import extensions
+from neutron.api.extensions import PluginAwareExtensionManager
+from neutron.api.v2 import attributes
+from neutron.common import config
+from neutron.common.test_lib import test_config
+from neutron import context
+from neutron.db import api as db_api
+from neutron.db import db_base_plugin_v2
+from neutron import manager
+from neutron.plugins.nicira.dbexts import nicira_networkgw_db
+from neutron.plugins.nicira.extensions import nvp_networkgw as networkgw
+from neutron.tests import base
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit import test_extensions
_uuid = test_api_v2._uuid
networkgw.NetworkGatewayPluginBase.__name__)
self._resource = networkgw.RESOURCE_NAME.replace('-', '_')
# Ensure 'stale' patched copies of the plugin are never returned
- manager.QuantumManager._instance = None
+ manager.NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
# Create the default configurations
- args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
+ args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
# Update the plugin and extensions path
self.addCleanup(_plugin_patcher.stop)
# Instantiate mock plugin and enable extensions
- manager.QuantumManager.get_plugin().supported_extension_aliases = (
+ manager.NeutronManager.get_plugin().supported_extension_aliases = (
[networkgw.EXT_ALIAS])
ext_mgr = TestExtensionManager()
PluginAwareExtensionManager._instance = ext_mgr
self.assertEqual(res.status_int, exc.HTTPOk.code)
-class NetworkGatewayDbTestCase(test_db_plugin.QuantumDbPluginV2TestCase):
+class NetworkGatewayDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
"""Unit tests for Network Gateway DB support."""
def setUp(self):
data, fmt)
if (kwargs.get('set_context') and tenant_id):
# create a specific auth context for this request
- nw_gw_req.environ['quantum.context'] = context.Context(
+ nw_gw_req.environ['neutron.context'] = context.Context(
'', tenant_id)
return nw_gw_req.get_response(self.ext_api)
'vlan', 555)
-class TestNetworkGatewayPlugin(db_base_plugin_v2.QuantumDbPluginV2,
+class TestNetworkGatewayPlugin(db_base_plugin_v2.NeutronDbPluginV2,
nicira_networkgw_db.NetworkGatewayMixin):
"""Simple plugin class for testing db support for network gateway ext."""
from oslo.config import cfg
import webob.exc
-from quantum.common import constants
-import quantum.common.test_lib as test_lib
-from quantum import context
-from quantum.extensions import l3
-from quantum.extensions import providernet as pnet
-from quantum.extensions import securitygroup as secgrp
-from quantum import manager
-from quantum.openstack.common import uuidutils
-import quantum.plugins.nicira as nvp_plugin
-from quantum.plugins.nicira.extensions import nvp_networkgw
-from quantum.plugins.nicira.extensions import nvp_qos as ext_qos
-from quantum.plugins.nicira import NvpApiClient
-from quantum.plugins.nicira import nvplib
-from quantum.plugins.nicira import QuantumPlugin
-from quantum.tests.unit.nicira import fake_nvpapiclient
-import quantum.tests.unit.nicira.test_networkgw as test_l2_gw
-import quantum.tests.unit.test_db_plugin as test_plugin
-import quantum.tests.unit.test_extension_portsecurity as psec
-import quantum.tests.unit.test_extension_security_group as ext_sg
-from quantum.tests.unit import test_extensions
-import quantum.tests.unit.test_l3_plugin as test_l3_plugin
-from quantum.tests.unit import testlib_api
+from neutron.common import constants
+import neutron.common.test_lib as test_lib
+from neutron import context
+from neutron.extensions import l3
+from neutron.extensions import providernet as pnet
+from neutron.extensions import securitygroup as secgrp
+from neutron import manager
+from neutron.openstack.common import uuidutils
+import neutron.plugins.nicira as nvp_plugin
+from neutron.plugins.nicira.extensions import nvp_networkgw
+from neutron.plugins.nicira.extensions import nvp_qos as ext_qos
+from neutron.plugins.nicira import NeutronPlugin
+from neutron.plugins.nicira import NvpApiClient
+from neutron.plugins.nicira import nvplib
+from neutron.tests.unit.nicira import fake_nvpapiclient
+import neutron.tests.unit.nicira.test_networkgw as test_l2_gw
+import neutron.tests.unit.test_db_plugin as test_plugin
+import neutron.tests.unit.test_extension_portsecurity as psec
+import neutron.tests.unit.test_extension_security_group as ext_sg
+from neutron.tests.unit import test_extensions
+import neutron.tests.unit.test_l3_plugin as test_l3_plugin
+from neutron.tests.unit import testlib_api
NICIRA_PKG_PATH = nvp_plugin.__name__
NICIRA_EXT_PATH = "../../plugins/nicira/extensions"
-class NiciraPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class NiciraPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = ('%s.QuantumPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
+ _plugin_name = ('%s.NeutronPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
def _create_network(self, fmt, name, admin_state_up,
arg_list=None, providernet_args=None, **kwargs):
network_req = self.new_create_request('networks', data, fmt)
if (kwargs.get('set_context') and 'tenant_id' in kwargs):
# create a specific auth context for this request
- network_req.environ['quantum.context'] = context.Context(
+ network_req.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
return network_req.get_response(self.api)
with self.subnet(network=net) as sub:
with self.port(subnet=sub):
with self.port(subnet=sub):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
ls = nvplib.get_lswitches(plugin.cluster,
net['network']['id'])
self.assertEqual(len(ls), 2)
def test_create_port_name_exceeds_40_chars(self):
name = 'this_is_a_port_whose_name_is_longer_than_40_chars'
with self.port(name=name) as port:
- # Assert the Quantum name is not truncated
+ # Assert the neutron name is not truncated
self.assertEqual(name, port['port']['name'])
res = self.deserialize('json', req.get_response(self.api))
self.assertEqual(len(res['networks']), 2)
req_2 = self.new_list_request('networks')
- req_2.environ['quantum.context'] = context.Context('',
+ req_2.environ['neutron.context'] = context.Context('',
'somebody')
res = self.deserialize('json', req_2.get_response(self.api))
# tenant must see a single network
def test_create_network_name_exceeds_40_chars(self):
name = 'this_is_a_network_whose_name_is_longer_than_40_chars'
with self.network(name=name) as net:
- # Assert Quantum name is not truncated
+ # Assert neutron name is not truncated
self.assertEqual(net['network']['name'], name)
class NiciraPortSecurityTestCase(psec.PortSecurityDBTestCase):
- _plugin_name = ('%s.QuantumPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
+ _plugin_name = ('%s.NeutronPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
def setUp(self):
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
class NiciraSecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
- _plugin_name = ('%s.QuantumPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
+ _plugin_name = ('%s.NeutronPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
def setUp(self):
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
def test_create_security_group_name_exceeds_40_chars(self):
name = 'this_is_a_secgroup_whose_name_is_longer_than_40_chars'
with self.security_group(name=name) as sg:
- # Assert Quantum name is not truncated
+ # Assert Neutron name is not truncated
self.assertEqual(sg['security_group']['name'], name)
def _create_l3_ext_network(self, vlan_id=None):
name = 'l3_ext_net'
- net_type = QuantumPlugin.NetworkTypes.L3_EXT
+ net_type = NeutronPlugin.NetworkTypes.L3_EXT
providernet_args = {pnet.NETWORK_TYPE: net_type,
pnet.PHYSICAL_NETWORK: 'l3_gw_uuid'}
if vlan_id:
def _test_create_l3_ext_network(self, vlan_id=None):
name = 'l3_ext_net'
- net_type = QuantumPlugin.NetworkTypes.L3_EXT
+ net_type = NeutronPlugin.NetworkTypes.L3_EXT
expected = [('subnets', []), ('name', name), ('admin_state_up', True),
('status', 'ACTIVE'), ('shared', False),
(l3.EXTERNAL, True),
def test_floatingip_with_assoc_fails(self):
self._test_floatingip_with_assoc_fails(
- 'quantum.plugins.nicira.'
- 'QuantumPlugin.NvpPluginV2')
+ 'neutron.plugins.nicira.'
+ 'NeutronPlugin.NvpPluginV2')
def test_floatingip_with_invalid_create_port(self):
self._test_floatingip_with_invalid_create_port(
- 'quantum.plugins.nicira.'
- 'QuantumPlugin.NvpPluginV2')
+ 'neutron.plugins.nicira.'
+ 'NeutronPlugin.NvpPluginV2')
def _nvp_metadata_setup(self):
cfg.CONF.set_override('metadata_mode', 'access_network', 'NVP')
def test_create_router_name_exceeds_40_chars(self):
name = 'this_is_a_router_whose_name_is_longer_than_40_chars'
with self.router(name=name) as rtr:
- # Assert Quantum name is not truncated
+ # Assert Neutron name is not truncated
self.assertEqual(rtr['router']['name'], name)
def test_router_add_interface_subnet_with_metadata_access(self):
qos_queue = self.new_create_request('qos-queues', body)
if (kwargs.get('set_context') and 'tenant_id' in kwargs):
# create a specific auth context for this request
- qos_queue.environ['quantum.context'] = context.Context(
+ qos_queue.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
return qos_queue.get_response(self.ext_api)
def test_create_qos_queue_name_exceeds_40_chars(self):
name = 'this_is_a_queue_whose_name_is_longer_than_40_chars'
with self.qos_queue(name=name) as queue:
- # Assert Quantum name is not truncated
+ # Assert Neutron name is not truncated
self.assertEqual(queue['qos_queue']['name'], name)
def test_create_qos_queue_default(self):
port = self.deserialize('json', res)
device_id = "00fff4d0-e4a8-4a3a-8906-4c4cdafb59f1"
data = {'port': {'device_id': device_id}}
- quantum_context = context.Context('', 'not_admin')
+ neutron_context = context.Context('', 'not_admin')
port = self._update('ports', port['port']['id'], data,
- quantum_context=quantum_context)
+ neutron_context=neutron_context)
self.assertFalse(ext_qos.QUEUE in port['port'])
def test_rxtx_factor(self):
self.assertEqual(queue['qos_queue']['max'], 20)
-class NiciraQuantumNVPOutOfSync(test_l3_plugin.L3NatTestCaseBase,
+class NiciraNeutronNVPOutOfSync(test_l3_plugin.L3NatTestCaseBase,
NiciraPluginV2TestCase):
def test_delete_network_not_in_nvp(self):
def test_create_network_gateway_name_exceeds_40_chars(self):
name = 'this_is_a_gateway_whose_name_is_longer_than_40_chars'
with self._network_gateway(name=name) as nw_gw:
- # Assert Quantum name is not truncated
+ # Assert Neutron name is not truncated
self.assertEqual(nw_gw[self.resource]['name'], name)
def test_create_network_gateway_nvp_error_returns_500(self):
import httplib
# Local
-import quantum.plugins.nicira.api_client.common as naco
-from quantum.tests import base
+import neutron.plugins.nicira.api_client.common as naco
+from neutron.tests import base
class NvpApiCommonTest(base.BaseTestCase):
import logging
import urllib2
-from quantum.tests import base
+from neutron.tests import base
logging.basicConfig(level=logging.DEBUG)
lg = logging.getLogger("test_nvp_api_request")
from mock import Mock
from mock import patch
-from quantum.plugins.nicira.api_client import (
+from neutron.plugins.nicira.api_client import (
client_eventlet as nace,
request_eventlet as nare,
)
-from quantum.tests import base
+from neutron.tests import base
logging.basicConfig(level=logging.DEBUG)
self.assertTrue(retval is None)
def test_redirect_params_setup_https_with_cooki(self):
- with patch('quantum.plugins.nicira.api_client.'
+ with patch('neutron.plugins.nicira.api_client.'
'client_eventlet.NvpApiClientEventlet') as mock:
api_client = mock.return_value
self.req._api_client = api_client
self.assertTrue(api_client.acquire_redirect_connection.called)
def test_redirect_params_setup_htttps_and_query(self):
- with patch('quantum.plugins.nicira.api_client.'
+ with patch('neutron.plugins.nicira.api_client.'
'client_eventlet.NvpApiClientEventlet') as mock:
api_client = mock.return_value
self.req._api_client = api_client
self.assertTrue(api_client.acquire_redirect_connection.called)
def test_redirect_params_setup_https_connection_no_cookie(self):
- with patch('quantum.plugins.nicira.api_client.'
+ with patch('neutron.plugins.nicira.api_client.'
'client_eventlet.NvpApiClientEventlet') as mock:
api_client = mock.return_value
self.req._api_client = api_client
self.assertTrue(api_client.acquire_redirect_connection.called)
def test_redirect_params_setup_https_and_query_no_cookie(self):
- with patch('quantum.plugins.nicira.api_client.'
+ with patch('neutron.plugins.nicira.api_client.'
'client_eventlet.NvpApiClientEventlet') as mock:
api_client = mock.return_value
self.req._api_client = api_client
self.assertTrue(api_client.acquire_redirect_connection.called)
def test_redirect_params_path_only_with_query(self):
- with patch('quantum.plugins.nicira.api_client.'
+ with patch('neutron.plugins.nicira.api_client.'
'client_eventlet.NvpApiClientEventlet') as mock:
api_client = mock.return_value
api_client.wait_for_login.return_value = None
import mock
import os
-from quantum.common import constants
-from quantum.common import exceptions
-import quantum.plugins.nicira as nvp_plugin
-from quantum.plugins.nicira.common import config # noqa
-from quantum.plugins.nicira.common import exceptions as nvp_exc
-from quantum.plugins.nicira import nvp_cluster
-from quantum.plugins.nicira import NvpApiClient
-from quantum.plugins.nicira import nvplib
-from quantum.tests import base
-from quantum.tests.unit.nicira import fake_nvpapiclient
-from quantum.tests.unit import test_api_v2
+from neutron.common import constants
+from neutron.common import exceptions
+import neutron.plugins.nicira as nvp_plugin
+from neutron.plugins.nicira.common import config # noqa
+from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira import nvp_cluster
+from neutron.plugins.nicira import NvpApiClient
+from neutron.plugins.nicira import nvplib
+from neutron.tests import base
+from neutron.tests.unit.nicira import fake_nvpapiclient
+from neutron.tests.unit import test_api_v2
NICIRA_PKG_PATH = nvp_plugin.__name__
_uuid = test_api_v2._uuid
# Create secondary lswitch
nvplib.create_lswitch(
self.fake_cluster, tenant_id, 'fake-switch-2',
- quantum_net_id=main_lswitch['uuid'])
+ neutron_net_id=main_lswitch['uuid'])
res_lswitch = nvplib.get_lswitches(self.fake_cluster,
main_lswitch['uuid'])
self.assertEqual(len(res_lswitch), 2)
def test_query_lrouter_lports_nonexistent_lrouter_raises(self):
self.assertRaises(
exceptions.NotFound, nvplib.create_router_lport,
- self.fake_cluster, 'booo', 'pippo', 'quantum_port_id',
+ self.fake_cluster, 'booo', 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
def test_create_and_get_lrouter_port(self):
'fake-lrouter',
'10.0.0.1')
nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
ports = nvplib.query_lrouter_lports(self.fake_cluster, lrouter['uuid'])
self.assertEqual(len(ports), 1)
self.assertIn('os_tid', port_tags)
self.assertIn('q_port_id', port_tags)
self.assertEqual('pippo', port_tags['os_tid'])
- self.assertEqual('quantum_port_id', port_tags['q_port_id'])
+ self.assertEqual('neutron_port_id', port_tags['q_port_id'])
def test_create_lrouter_port_nonexistent_router_raises(self):
self.assertRaises(
exceptions.NotFound, nvplib.create_router_lport,
- self.fake_cluster, 'booo', 'pippo', 'quantum_port_id',
+ self.fake_cluster, 'booo', 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
def test_update_lrouter_port(self):
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
nvplib.update_router_lport(
self.fake_cluster, lrouter['uuid'], lrouter_port['uuid'],
self.assertRaises(
exceptions.NotFound, nvplib.update_router_lport,
self.fake_cluster, 'boo-router', 'boo-port', 'pippo',
- 'quantum_port_id', 'name', True, ['192.168.0.1'])
+ 'neutron_port_id', 'name', True, ['192.168.0.1'])
def test_update_lrouter_port_nonexistent_port_raises(self):
lrouter = nvplib.create_lrouter(self.fake_cluster,
self.assertRaises(
exceptions.NotFound, nvplib.update_router_lport,
self.fake_cluster, lrouter['uuid'], 'boo-port', 'pippo',
- 'quantum_port_id', 'name', True, ['192.168.0.1'])
+ 'neutron_port_id', 'name', True, ['192.168.0.1'])
def test_delete_lrouter_port(self):
lrouter = nvplib.create_lrouter(self.fake_cluster,
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
nvplib.update_lrouter_port_ips(
self.fake_cluster, lrouter['uuid'], lrouter_port['uuid'],
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1', '10.10.10.254'])
nvplib.update_lrouter_port_ips(
self.fake_cluster, lrouter['uuid'], lrouter_port['uuid'],
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
nvplib.update_lrouter_port_ips(
self.fake_cluster, lrouter['uuid'], lrouter_port['uuid'],
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
def raise_nvp_exc(*args, **kwargs):
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
result = nvplib.plug_router_port_attachment(
self.fake_cluster, lrouter['uuid'],
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
result = nvplib.plug_router_port_attachment(
self.fake_cluster, lrouter['uuid'],
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
result = nvplib.plug_router_port_attachment(
self.fake_cluster, lrouter['uuid'],
'fake-lrouter',
'10.0.0.1')
lrouter_port = nvplib.create_router_lport(
- self.fake_cluster, lrouter['uuid'], 'pippo', 'quantum_port_id',
+ self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
self.assertRaises(Exception,
nvplib.plug_router_port_attachment,
sec_prof_res['logical_port_ingress_rules'])
def test_update_non_existing_securityprofile_raises(self):
- self.assertRaises(exceptions.QuantumException,
+ self.assertRaises(exceptions.NeutronException,
nvplib.update_security_group_rules,
self.fake_cluster, 'whatever',
{'logical_port_egress_rules': [],
cluster=self.fake_cluster)
def test_delete_non_existing_securityprofile_raises(self):
- self.assertRaises(exceptions.QuantumException,
+ self.assertRaises(exceptions.NeutronException,
nvplib.delete_security_profile,
self.fake_cluster, 'whatever')
with mock.patch.object(nvplib, 'do_request', new=raise_nvp_exc):
self.assertRaises(
- exceptions.QuantumException, nvplib.create_lqueue,
+ exceptions.NeutronException, nvplib.create_lqueue,
self.fake_cluster, {})
def test_delete_lqueue(self):
cluster=self.fake_cluster)
def test_delete_non_existing_lqueue_raises(self):
- self.assertRaises(exceptions.QuantumException,
+ self.assertRaises(exceptions.NeutronException,
nvplib.delete_lqueue,
self.fake_cluster, 'whatever')
class TestNvplibLogicalPorts(NvplibTestCase):
def _create_switch_and_port(self, tenant_id='pippo',
- quantum_port_id='whatever'):
+ neutron_port_id='whatever'):
lswitch = nvplib.create_lswitch(self.fake_cluster,
tenant_id, 'fake-switch')
lport = nvplib.create_lport(self.fake_cluster, lswitch['uuid'],
- tenant_id, quantum_port_id,
+ tenant_id, neutron_port_id,
'name', 'device_id', True)
return lswitch, lport
def test_get_port_by_tag(self):
lswitch, lport = self._create_switch_and_port()
- lport2 = nvplib.get_port_by_quantum_tag(self.fake_cluster,
+ lport2 = nvplib.get_port_by_neutron_tag(self.fake_cluster,
lswitch['uuid'],
'whatever')
self.assertIsNotNone(lport2)
def test_get_port_by_tag_not_found_returns_None(self):
tenant_id = 'pippo'
- quantum_port_id = 'whatever'
+ neutron_port_id = 'whatever'
lswitch = nvplib.create_lswitch(self.fake_cluster, tenant_id,
'fake-switch')
- lport = nvplib.get_port_by_quantum_tag(self.fake_cluster,
+ lport = nvplib.get_port_by_neutron_tag(self.fake_cluster,
lswitch['uuid'],
- quantum_port_id)
+ neutron_port_id)
self.assertIsNone(lport)
def test_get_port_status(self):
lswitch, lport = self._create_switch_and_port()
nvplib.update_port(
self.fake_cluster, lswitch['uuid'], lport['uuid'],
- 'quantum_port_id', 'pippo2', 'new_name', 'device_id', False)
+ 'neutron_port_id', 'pippo2', 'new_name', 'device_id', False)
lport_res = nvplib.get_port(self.fake_cluster,
lswitch['uuid'], lport['uuid'])
self.assertEqual(lport['uuid'], lport_res['uuid'])
from oslo.config import cfg
-from quantum.common import config as q_config
-from quantum.manager import QuantumManager
-from quantum.openstack.common import uuidutils
-from quantum.plugins.nicira.common import config # noqa
-from quantum.plugins.nicira.common import exceptions
-from quantum.plugins.nicira import nvp_cluster
+from neutron.common import config as q_config
+from neutron.manager import NeutronManager
+from neutron.openstack.common import uuidutils
+from neutron.plugins.nicira.common import config # noqa
+from neutron.plugins.nicira.common import exceptions
+from neutron.plugins.nicira import nvp_cluster
BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
- '../../etc/quantum.conf.test')
+ '../../etc/neutron.conf.test')
NVP_BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
- 'etc/quantum.conf.test')
+ 'etc/neutron.conf.test')
NVP_INI_PATH = os.path.join(os.path.dirname(__file__),
'etc/nvp.ini.basic.test')
NVP_INI_FULL_PATH = os.path.join(os.path.dirname(__file__),
'etc/nvp.ini.full.test')
NVP_INI_DEPR_PATH = os.path.join(os.path.dirname(__file__),
'etc/nvp.ini.grizzly.test')
-NVP_PLUGIN_PATH = ('quantum.plugins.nicira.nicira_nvp_plugin.'
- 'QuantumPlugin.NvpPluginV2')
+NVP_PLUGIN_PATH = ('neutron.plugins.nicira.nicira_nvp_plugin.'
+ 'NeutronPlugin.NvpPluginV2')
class NVPClusterTest(testtools.TestCase):
super(ConfigurationTest, self).setUp()
self.addCleanup(cfg.CONF.reset)
self.useFixture(fixtures.MonkeyPatch(
- 'quantum.manager.QuantumManager._instance',
+ 'neutron.manager.NeutronManager._instance',
None))
def _assert_required_options(self, cluster):
q_config.parse(['--config-file', BASE_CONF_PATH,
'--config-file', NVP_INI_FULL_PATH])
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
- plugin = QuantumManager().get_plugin()
+ plugin = NeutronManager().get_plugin()
cluster = plugin.cluster
self._assert_required_options(cluster)
self._assert_extra_options(cluster)
q_config.parse(['--config-file', BASE_CONF_PATH,
'--config-file', NVP_INI_PATH])
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
- plugin = QuantumManager().get_plugin()
+ plugin = NeutronManager().get_plugin()
self._assert_required_options(plugin.cluster)
def test_defaults(self):
'--config-file', NVP_INI_FULL_PATH])
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
# Load the configuration, and initialize the plugin
- QuantumManager().get_plugin()
+ NeutronManager().get_plugin()
self.assertIn('extensions', cfg.CONF.api_extensions_path)
super(OldConfigurationTest, self).setUp()
self.addCleanup(cfg.CONF.reset)
self.useFixture(fixtures.MonkeyPatch(
- 'quantum.manager.QuantumManager._instance',
+ 'neutron.manager.NeutronManager._instance',
None))
def _assert_required_options(self, cluster):
q_config.parse(['--config-file', BASE_CONF_PATH,
'--config-file', NVP_INI_DEPR_PATH])
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
- plugin = QuantumManager().get_plugin()
+ plugin = NeutronManager().get_plugin()
cluster = plugin.cluster
self._assert_required_options(cluster)
# Verify nvp_controller_connection has been fully parsed
from oslo.config import cfg
from webob import exc
-from quantum.api import extensions
-from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.common import constants
-from quantum import context
-from quantum.db import agents_db
-from quantum.db import dhcp_rpc_base
-from quantum.db import l3_rpc_base
-from quantum.extensions import agent
-from quantum.extensions import agentscheduler
-from quantum import manager
-from quantum.openstack.common import timeutils
-from quantum.openstack.common import uuidutils
-from quantum.tests.unit import test_agent_ext_plugin
-from quantum.tests.unit import test_db_plugin as test_plugin
-from quantum.tests.unit import test_extensions
-from quantum.tests.unit import test_l3_plugin
-from quantum.tests.unit.testlib_api import create_request
-from quantum.wsgi import Serializer
+from neutron.api import extensions
+from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.common import constants
+from neutron import context
+from neutron.db import agents_db
+from neutron.db import dhcp_rpc_base
+from neutron.db import l3_rpc_base
+from neutron.extensions import agent
+from neutron.extensions import agentscheduler
+from neutron import manager
+from neutron.openstack.common import timeutils
+from neutron.openstack.common import uuidutils
+from neutron.tests.unit import test_agent_ext_plugin
+from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import test_extensions
+from neutron.tests.unit import test_l3_plugin
+from neutron.tests.unit.testlib_api import create_request
+from neutron.wsgi import Serializer
L3_HOSTA = 'hosta'
DHCP_HOSTA = 'hosta'
class OvsAgentSchedulerTestCase(test_l3_plugin.L3NatTestCaseMixin,
test_agent_ext_plugin.AgentDBTestMixIn,
AgentSchedulerTestMixIn,
- test_plugin.QuantumDbPluginV2TestCase):
+ test_plugin.NeutronDbPluginV2TestCase):
fmt = 'json'
- plugin_str = ('quantum.plugins.openvswitch.'
- 'ovs_quantum_plugin.OVSQuantumPluginV2')
+ plugin_str = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.OVSNeutronPluginV2')
def setUp(self):
# Save the global RESOURCE_ATTRIBUTE_MAP
attributes.RESOURCE_ATTRIBUTE_MAP.update(
agent.RESOURCE_ATTRIBUTE_MAP)
self.addCleanup(self.restore_attribute_map)
- self.agentscheduler_dbMinxin = manager.QuantumManager.get_plugin()
+ self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin()
def restore_attribute_map(self):
# Restore the original RESOURCE_ATTRIBUTE_MAP
# one agent hosts one network
dhcp_rpc = dhcp_rpc_base.DhcpRpcCallbackMixin()
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'DHCP_AGENT',
'configurations': {'dhcp_driver': 'dhcp_driver',
def test_network_scheduler_with_disabled_agent(self):
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'DHCP_AGENT',
'configurations': {'dhcp_driver': 'dhcp_driver',
def test_network_scheduler_with_down_agent(self):
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'DHCP_AGENT',
'configurations': {'dhcp_driver': 'dhcp_driver',
},
'agent_type': constants.AGENT_TYPE_DHCP}
self._register_one_agent_state(dhcp_hosta)
- is_agent_down_str = 'quantum.db.agents_db.AgentDbMixin.is_agent_down'
+ is_agent_down_str = 'neutron.db.agents_db.AgentDbMixin.is_agent_down'
with mock.patch(is_agent_down_str) as mock_is_agent_down:
mock_is_agent_down.return_value = False
with self.port() as port:
self.assertEqual(0, len(dhcp_agents['agents']))
def test_network_scheduler_with_hosted_network(self):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'DHCP_AGENT',
'configurations': {'dhcp_driver': 'dhcp_driver',
def test_network_remove_from_dhcp_agent(self):
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'DHCP_AGENT',
'configurations': {'dhcp_driver': 'dhcp_driver',
# one agent hosts one router
l3_rpc = l3_rpc_base.L3RpcCallbackMixin()
l3_hosta = {
- 'binary': 'quantum-l3-agent',
+ 'binary': 'neutron-l3-agent',
'host': L3_HOSTA,
'topic': 'L3_AGENT',
'configurations': {'use_namespaces': True,
def test_router_auto_schedule_with_candidates(self):
l3_hosta = {
- 'binary': 'quantum-l3-agent',
+ 'binary': 'neutron-l3-agent',
'host': L3_HOSTA,
'topic': 'L3_AGENT',
'configurations': {'use_namespaces': False,
def test_router_schedule_with_candidates(self):
l3_hosta = {
- 'binary': 'quantum-l3-agent',
+ 'binary': 'neutron-l3-agent',
'host': L3_HOSTA,
'topic': 'L3_AGENT',
'configurations': {'use_namespaces': False,
class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
test_agent_ext_plugin.AgentDBTestMixIn,
AgentSchedulerTestMixIn,
- test_plugin.QuantumDbPluginV2TestCase):
- plugin_str = ('quantum.plugins.openvswitch.'
- 'ovs_quantum_plugin.OVSQuantumPluginV2')
+ test_plugin.NeutronDbPluginV2TestCase):
+ plugin_str = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.OVSNeutronPluginV2')
def setUp(self):
self.dhcp_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
self.dhcp_notifier_cls_p = mock.patch(
- 'quantum.api.rpc.agentnotifiers.dhcp_rpc_agent_api.'
+ 'neutron.api.rpc.agentnotifiers.dhcp_rpc_agent_api.'
'DhcpAgentNotifyAPI')
self.dhcp_notifier_cls = self.dhcp_notifier_cls_p.start()
self.dhcp_notifier_cls.return_value = self.dhcp_notifier
# the global attribute map
attributes.RESOURCE_ATTRIBUTE_MAP.update(
agent.RESOURCE_ATTRIBUTE_MAP)
- self.agentscheduler_dbMinxin = manager.QuantumManager.get_plugin()
+ self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin()
self.addCleanup(self.dhcp_notifier_cls_p.stop)
self.addCleanup(self.restore_attribute_map)
def test_network_port_create_notification(self):
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'dhcp_agent',
'configurations': {'dhcp_driver': 'dhcp_driver',
def test_network_ha_port_create_notification(self):
cfg.CONF.set_override('dhcp_agents_per_network', 2)
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'dhcp_agent',
'configurations': {'dhcp_driver': 'dhcp_driver',
class OvsL3AgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
test_agent_ext_plugin.AgentDBTestMixIn,
AgentSchedulerTestMixIn,
- test_plugin.QuantumDbPluginV2TestCase):
- plugin_str = ('quantum.plugins.openvswitch.'
- 'ovs_quantum_plugin.OVSQuantumPluginV2')
+ test_plugin.NeutronDbPluginV2TestCase):
+ plugin_str = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.OVSNeutronPluginV2')
def setUp(self):
self.dhcp_notifier_cls_p = mock.patch(
- 'quantum.api.rpc.agentnotifiers.dhcp_rpc_agent_api.'
+ 'neutron.api.rpc.agentnotifiers.dhcp_rpc_agent_api.'
'DhcpAgentNotifyAPI')
self.dhcp_notifier = mock.Mock(name='dhcp_notifier')
self.dhcp_notifier_cls = self.dhcp_notifier_cls_p.start()
# the global attribute map
attributes.RESOURCE_ATTRIBUTE_MAP.update(
agent.RESOURCE_ATTRIBUTE_MAP)
- self.agentscheduler_dbMinxin = manager.QuantumManager.get_plugin()
+ self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin()
self.addCleanup(self.dhcp_notifier_cls_p.stop)
self.addCleanup(self.restore_attribute_map)
attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map
def test_router_add_to_l3_agent_notification(self):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
with mock.patch.object(plugin.l3_agent_notifier, 'cast') as mock_l3:
with self.router() as router1:
self._register_agent_states()
topic='l3_agent.hosta')
def test_router_remove_from_l3_agent_notification(self):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
with mock.patch.object(plugin.l3_agent_notifier, 'cast') as mock_l3:
with self.router() as router1:
self._register_agent_states()
topic='l3_agent.hosta')
def test_agent_updated_l3_agent_notification(self):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
with mock.patch.object(plugin.l3_agent_notifier, 'cast') as mock_l3:
self._register_agent_states()
hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3,
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.extensions import portbindings
-from quantum.tests.unit import _test_extension_portbindings as test_bindings
-from quantum.tests.unit import test_db_plugin as test_plugin
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.extensions import portbindings
+from neutron.tests.unit import _test_extension_portbindings as test_bindings
+from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
-class OpenvswitchPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class OpenvswitchPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = ('quantum.plugins.openvswitch.'
- 'ovs_quantum_plugin.OVSQuantumPluginV2')
+ _plugin_name = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.OVSNeutronPluginV2')
def setUp(self):
super(OpenvswitchPluginV2TestCase, self).setUp(self._plugin_name)
import testtools
from testtools import matchers
-from quantum.common import exceptions as q_exc
-from quantum.db import api as db
-from quantum.plugins.openvswitch import ovs_db_v2
-from quantum.tests import base
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.common import exceptions as q_exc
+from neutron.db import api as db
+from neutron.plugins.openvswitch import ovs_db_v2
+from neutron.tests import base
+from neutron.tests.unit import test_db_plugin as test_plugin
PHYS_NET = 'physnet1'
PHYS_NET_2 = 'physnet2'
self.assertIsNone(ovs_db_v2.get_tunnel_allocation(tunnel_id))
-class NetworkBindingsTest(test_plugin.QuantumDbPluginV2TestCase):
+class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
def setUp(self):
super(NetworkBindingsTest, self).setUp()
ovs_db_v2.initialize()
from oslo.config import cfg
-from quantum.plugins.openvswitch.common import config # noqa
-from quantum.tests import base
+from neutron.plugins.openvswitch.common import config # noqa
+from neutron.tests import base
class ConfigurationTest(base.BaseTestCase):
import mox
import testtools
-from quantum.agent.linux import ovs_lib
-from quantum.agent.linux import utils
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import uuidutils
-from quantum.tests import base
+from neutron.agent.linux import ovs_lib
+from neutron.agent.linux import utils
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import uuidutils
+from neutron.tests import base
class OVS_Lib_Test(base.BaseTestCase):
- """A test suite to excercise the OVS libraries shared by Quantum agents.
+ """A test suite to excercise the OVS libraries shared by Neutron agents.
Note: these tests do not actually execute ovs-* utilities, and thus
can run on any system. That does, however, limit their scope.
self.br.delete_ports(all_ports=True)
self.mox.VerifyAll()
- def test_delete_quantum_ports(self):
+ def test_delete_neutron_ports(self):
port1 = ovs_lib.VifPort('tap1234', 1, uuidutils.generate_uuid(),
'ca:fe:de:ad:be:ef', 'br')
port2 = ovs_lib.VifPort('tap5678', 2, uuidutils.generate_uuid(),
self.mox.VerifyAll()
def test_get_local_port_mac_succeeds(self):
- with mock.patch('quantum.agent.linux.ip_lib.IpLinkCommand',
+ with mock.patch('neutron.agent.linux.ip_lib.IpLinkCommand',
return_value=mock.Mock(address='foo')):
self.assertEqual('foo', self.br.get_local_port_mac())
def test_get_local_port_mac_raises_exception_for_missing_mac(self):
- with mock.patch('quantum.agent.linux.ip_lib.IpLinkCommand',
+ with mock.patch('neutron.agent.linux.ip_lib.IpLinkCommand',
return_value=mock.Mock(address=None)):
with testtools.ExpectedException(Exception):
self.br.get_local_port_mac()
from oslo.config import cfg
import testtools
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import ovs_lib
-from quantum.openstack.common.rpc import common as rpc_common
-from quantum.plugins.openvswitch.agent import ovs_quantum_agent
-from quantum.plugins.openvswitch.common import constants
-from quantum.tests import base
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import ovs_lib
+from neutron.openstack.common.rpc import common as rpc_common
+from neutron.plugins.openvswitch.agent import ovs_neutron_agent
+from neutron.plugins.openvswitch.common import constants
+from neutron.tests import base
-NOTIFIER = ('quantum.plugins.openvswitch.'
- 'ovs_quantum_plugin.AgentNotifierApi')
+NOTIFIER = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.AgentNotifierApi')
class CreateAgentConfigMap(base.BaseTestCase):
def test_create_agent_config_map_succeeds(self):
- self.assertTrue(ovs_quantum_agent.create_agent_config_map(cfg.CONF))
+ self.assertTrue(ovs_neutron_agent.create_agent_config_map(cfg.CONF))
def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
self.addCleanup(cfg.CONF.reset)
cfg.CONF.set_override('tunnel_type', constants.TYPE_GRE,
group='AGENT')
with testtools.ExpectedException(ValueError):
- ovs_quantum_agent.create_agent_config_map(cfg.CONF)
+ ovs_neutron_agent.create_agent_config_map(cfg.CONF)
def test_create_agent_config_map_enable_tunneling(self):
self.addCleanup(cfg.CONF.reset)
cfg.CONF.set_override('tunnel_type', None, group='AGENT')
cfg.CONF.set_override('enable_tunneling', True, group='OVS')
cfg.CONF.set_override('local_ip', '10.10.10.10', group='OVS')
- cfgmap = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
+ cfgmap = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
self.assertEqual(cfgmap['tunnel_type'], constants.TYPE_GRE)
def test_create_agent_config_map_fails_no_local_ip(self):
# An ip address is required for tunneling but there is no default
cfg.CONF.set_override('enable_tunneling', True, group='OVS')
with testtools.ExpectedException(ValueError):
- ovs_quantum_agent.create_agent_config_map(cfg.CONF)
+ ovs_neutron_agent.create_agent_config_map(cfg.CONF)
-class TestOvsQuantumAgent(base.BaseTestCase):
+class TestOvsNeutronAgent(base.BaseTestCase):
def setUp(self):
- super(TestOvsQuantumAgent, self).setUp()
+ super(TestOvsNeutronAgent, self).setUp()
self.addCleanup(cfg.CONF.reset)
self.addCleanup(mock.patch.stopall)
notifier_p = mock.patch(NOTIFIER)
notifier_cls.return_value = self.notifier
# Avoid rpc initialization for unit tests
cfg.CONF.set_override('rpc_backend',
- 'quantum.openstack.common.rpc.impl_fake')
+ 'neutron.openstack.common.rpc.impl_fake')
cfg.CONF.set_override('report_interval', 0, 'AGENT')
- kwargs = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
+ kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
with contextlib.nested(
- mock.patch('quantum.plugins.openvswitch.agent.ovs_quantum_agent.'
- 'OVSQuantumAgent.setup_integration_br',
+ mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
+ 'OVSNeutronAgent.setup_integration_br',
return_value=mock.Mock()),
- mock.patch('quantum.agent.linux.utils.get_interface_mac',
+ mock.patch('neutron.agent.linux.utils.get_interface_mac',
return_value='00:00:00:00:00:01')):
- self.agent = ovs_quantum_agent.OVSQuantumAgent(**kwargs)
+ self.agent = ovs_neutron_agent.OVSNeutronAgent(**kwargs)
self.agent.tun_br = mock.Mock()
self.agent.sg_agent = mock.Mock()
'network_id': 1,
'admin_state_up': True}
with contextlib.nested(
- mock.patch.object(ovs_quantum_agent.LOG, 'error'),
+ mock.patch.object(ovs_neutron_agent.LOG, 'error'),
mock.patch.object(self.agent.int_br, "get_vif_port_by_id"),
mock.patch.object(self.agent.plugin_rpc, 'update_device_up'),
mock.patch.object(self.agent, 'port_bound'),
def _check_ovs_vxlan_version(self, installed_version, min_vers,
expecting_ok):
with mock.patch(
- 'quantum.agent.linux.ovs_lib.get_installed_ovs_klm_version'
+ 'neutron.agent.linux.ovs_lib.get_installed_ovs_klm_version'
) as klm_cmd:
with mock.patch(
- 'quantum.agent.linux.ovs_lib.get_installed_ovs_usr_version'
+ 'neutron.agent.linux.ovs_lib.get_installed_ovs_usr_version'
) as usr_cmd:
try:
klm_cmd.return_value = installed_version
usr_cmd.return_value = installed_version
self.agent.tunnel_type = 'vxlan'
- ovs_quantum_agent.check_ovs_version(min_vers,
+ ovs_neutron_agent.check_ovs_version(min_vers,
root_helper='sudo')
version_ok = True
except SystemExit as e:
import stubout
-from quantum.agent import rpc as agent_rpc
-from quantum.common import topics
-from quantum.openstack.common import context
-from quantum.openstack.common import rpc
-from quantum.plugins.openvswitch.common import constants
-from quantum.plugins.openvswitch import ovs_quantum_plugin as povs
-from quantum.tests import base
+from neutron.agent import rpc as agent_rpc
+from neutron.common import topics
+from neutron.openstack.common import context
+from neutron.openstack.common import rpc
+from neutron.plugins.openvswitch.common import constants
+from neutron.plugins.openvswitch import ovs_neutron_plugin as povs
+from neutron.tests import base
class rpcApiTestCase(base.BaseTestCase):
import mock
-from quantum.api.v2 import attributes
-from quantum.extensions import securitygroup as ext_sg
-from quantum import manager
-from quantum.tests.unit import test_extension_security_group as test_sg
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.api.v2 import attributes
+from neutron.extensions import securitygroup as ext_sg
+from neutron import manager
+from neutron.tests.unit import test_extension_security_group as test_sg
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
-PLUGIN_NAME = ('quantum.plugins.openvswitch.'
- 'ovs_quantum_plugin.OVSQuantumPluginV2')
-AGENT_NAME = ('quantum.plugins.openvswitch.'
- 'agent.ovs_quantum_agent.OVSQuantumAgent')
-NOTIFIER = ('quantum.plugins.openvswitch.'
- 'ovs_quantum_plugin.AgentNotifierApi')
+PLUGIN_NAME = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.OVSNeutronPluginV2')
+AGENT_NAME = ('neutron.plugins.openvswitch.'
+ 'agent.ovs_neutron_agent.OVSNeutronAgent')
+NOTIFIER = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.AgentNotifierApi')
class OpenvswitchSecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
res = self.deserialize(self.fmt,
req.get_response(self.api))
port_id = res['port']['id']
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin.callbacks.get_port_from_device(port_id)
self.assertEqual(port_id, port_dict['id'])
self.assertEqual([security_group_id],
self._delete('ports', port_id)
def test_security_group_get_port_from_device_with_no_port(self):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin.callbacks.get_port_from_device('bad_device_id')
self.assertEqual(None, port_dict)
import mox
from oslo.config import cfg
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import ovs_lib
-from quantum.openstack.common import log
-from quantum.plugins.openvswitch.agent import ovs_quantum_agent
-from quantum.plugins.openvswitch.common import constants
-from quantum.tests import base
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import ovs_lib
+from neutron.openstack.common import log
+from neutron.plugins.openvswitch.agent import ovs_neutron_agent
+from neutron.plugins.openvswitch.common import constants
+from neutron.tests import base
# Useful global dummy variables.
VIF_PORT = ovs_lib.VifPort('port', OFPORT_NUM,
VIF_ID, VIF_MAC, 'switch')
VIF_PORTS = {LV_ID: VIF_PORT}
-LVM = ovs_quantum_agent.LocalVLANMapping(LV_ID, 'gre', None, LS_ID, VIF_PORTS)
-LVM_FLAT = ovs_quantum_agent.LocalVLANMapping(
+LVM = ovs_neutron_agent.LocalVLANMapping(LV_ID, 'gre', None, LS_ID, VIF_PORTS)
+LVM_FLAT = ovs_neutron_agent.LocalVLANMapping(
LV_ID, 'flat', 'net1', LS_ID, VIF_PORTS)
-LVM_VLAN = ovs_quantum_agent.LocalVLANMapping(
+LVM_VLAN = ovs_neutron_agent.LocalVLANMapping(
LV_ID, 'vlan', 'net1', LS_ID, VIF_PORTS)
BCAST_MAC = "01:00:00:00:00:00/01:00:00:00:00:00"
def setUp(self):
super(TunnelTest, self).setUp()
cfg.CONF.set_override('rpc_backend',
- 'quantum.openstack.common.rpc.impl_fake')
+ 'neutron.openstack.common.rpc.impl_fake')
cfg.CONF.set_override('report_interval', 0, 'AGENT')
self.mox = mox.Mox()
self.addCleanup(self.mox.UnsetStubs)
def testConstruct(self):
self.mox.ReplayAll()
- ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
self.mox.StubOutWithMock(ovs_lib, 'get_installed_ovs_usr_version')
ovs_lib.get_installed_ovs_usr_version('sudo').AndReturn("1.10")
self.mox.ReplayAll()
- ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'vxlan')
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
def testProvisionLocalVlanFlatFail(self):
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
dl_vlan=LV_ID, actions=action_string)
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
def testProvisionLocalVlanVlanFail(self):
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
self.mock_tun_bridge.delete_flows(dl_vlan=LVM.vlan)
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
dl_vlan=65535, in_port=self.INT_OFPORT)
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
dl_vlan=LV_ID, in_port=self.INT_OFPORT)
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
actions=action_string)
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
self.mock_tun_bridge.delete_flows(dl_dst=VIF_MAC, tun_id=LS_ID)
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
def testPortDead(self):
self.mock_int_bridge.set_db_attribute(
- 'Port', VIF_PORT.port_name, 'tag', ovs_quantum_agent.DEAD_VLAN_TAG)
+ 'Port', VIF_PORT.port_name, 'tag', ovs_neutron_agent.DEAD_VLAN_TAG)
self.mock_int_bridge.add_flow(priority=2, in_port=VIF_PORT.ofport,
actions='drop')
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
def testTunnelUpdate(self):
self.mock_tun_bridge.add_tunnel_port('gre-1', '10.0.10.1', 'gre', 4789)
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
def testTunnelUpdateSelf(self):
self.mox.ReplayAll()
- a = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1', self.NET_MAPPING,
'sudo', 2, 'gre')
Exception('Fake exception to get out of the loop'))
self.mox.StubOutWithMock(
- ovs_quantum_agent.OVSQuantumAgent, 'update_ports')
- ovs_quantum_agent.OVSQuantumAgent.update_ports(set()).AndReturn(reply2)
- ovs_quantum_agent.OVSQuantumAgent.update_ports(
+ ovs_neutron_agent.OVSNeutronAgent, 'update_ports')
+ ovs_neutron_agent.OVSNeutronAgent.update_ports(set()).AndReturn(reply2)
+ ovs_neutron_agent.OVSNeutronAgent.update_ports(
set(['tap0'])).AndReturn(reply3)
self.mox.StubOutWithMock(
- ovs_quantum_agent.OVSQuantumAgent, 'process_network_ports')
- ovs_quantum_agent.OVSQuantumAgent.process_network_ports(
+ ovs_neutron_agent.OVSNeutronAgent, 'process_network_ports')
+ ovs_neutron_agent.OVSNeutronAgent.process_network_ports(
{'current': set(['tap0']),
'removed': set([]),
'added': set([])}).AndReturn(False)
- ovs_quantum_agent.OVSQuantumAgent.process_network_ports(
+ ovs_neutron_agent.OVSNeutronAgent.process_network_ports(
{'current': set(['tap0']),
'removed': set([]),
'added': set([])}).AndRaise(
Exception('Fake exception to get out of the loop'))
self.mox.ReplayAll()
- q_agent = ovs_quantum_agent.OVSQuantumAgent(self.INT_BRIDGE,
+ q_agent = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
self.TUN_BRIDGE,
'10.0.0.1',
self.NET_MAPPING,
# @author: Edgar Magana, emagana@plumgrid.com, PLUMgrid, Inc.
"""
-Test cases for Quantum PLUMgrid Plug-in
+Test cases for Neutron PLUMgrid Plug-in
"""
from mock import patch
-from quantum.manager import QuantumManager
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.manager import NeutronManager
+from neutron.tests.unit import test_db_plugin as test_plugin
-class PLUMgridPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class PLUMgridPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = ('quantum.plugins.plumgrid.plumgrid_nos_plugin.'
- 'plumgrid_plugin.QuantumPluginPLUMgridV2')
+ _plugin_name = ('neutron.plugins.plumgrid.plumgrid_nos_plugin.'
+ 'plumgrid_plugin.NeutronPluginPLUMgridV2')
def setUp(self):
self.restHTTPConnection = patch('httplib.HTTPConnection')
network = {'network': {'name': name,
'admin_state_up': admin_status_up,
'tenant_id': tenant_id}}
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
self.assertEqual(plugin._network_admin_state(network), network)
from oslo.config import cfg
-from quantum.plugins.ryu.common import config # noqa
-from quantum.tests import base
+from neutron.plugins.ryu.common import config # noqa
+from neutron.tests import base
class ConfigurationTest(base.BaseTestCase):
import mock
-from quantum.openstack.common import importutils
-from quantum.tests import base
-from quantum.tests.unit.ryu import fake_ryu
+from neutron.openstack.common import importutils
+from neutron.tests import base
+from neutron.tests.unit.ryu import fake_ryu
class RyuAgentTestCase(base.BaseTestCase):
- _AGENT_NAME = 'quantum.plugins.ryu.agent.ryu_quantum_agent'
+ _AGENT_NAME = 'neutron.plugins.ryu.agent.ryu_neutron_agent'
def setUp(self):
super(RyuAgentTestCase, self).setUp()
self.mod_agent = importutils.import_module(self._AGENT_NAME)
-class TestOVSQuantumOFPRyuAgent(RyuAgentTestCase):
+class TestOVSNeutronOFPRyuAgent(RyuAgentTestCase):
def setUp(self):
- super(TestOVSQuantumOFPRyuAgent, self).setUp()
+ super(TestOVSNeutronOFPRyuAgent, self).setUp()
self.plugin_api = mock.patch(
self._AGENT_NAME + '.RyuPluginApi').start()
self.ovsbridge = mock.patch(
mock_rest_addr = mock.Mock(return_value=rest_addr)
self.plugin_api.return_value.get_ofp_rest_api_addr = mock_rest_addr
- # Instantiate OVSQuantumOFPRyuAgent
- return self.mod_agent.OVSQuantumOFPRyuAgent(
+ # Instantiate OVSNeutronOFPRyuAgent
+ return self.mod_agent.OVSNeutronOFPRyuAgent(
integ_br, tunnel_ip, ovsdb_ip, ovsdb_port, interval, root_helper)
def test_valid_rest_addr(self):
def setUp(self):
super(TestOVSBridge, self).setUp()
self.lib_ovs = mock.patch(
- 'quantum.agent.linux.ovs_lib.OVSBridge').start()
+ 'neutron.agent.linux.ovs_lib.OVSBridge').start()
def test_find_datapath_id(self):
with mock.patch(self._AGENT_NAME + '.OVSBridge.get_datapath_id',
])
-class TestRyuQuantumAgent(RyuAgentTestCase):
+class TestRyuNeutronAgent(RyuAgentTestCase):
def test_get_my_ip(self):
sock_attrs = {
'return_value.getsockname.return_value': ['1.2.3.4', '']}
def test_main(self):
agent_attrs = {'daemon_loop.side_effect': SystemExit(0)}
- with mock.patch(self._AGENT_NAME + '.OVSQuantumOFPRyuAgent',
+ with mock.patch(self._AGENT_NAME + '.OVSNeutronOFPRyuAgent',
**agent_attrs) as mock_agent:
self.assertRaises(SystemExit, self.mock_main)
def test_main_raise(self):
with nested(
- mock.patch(self._AGENT_NAME + '.OVSQuantumOFPRyuAgent',
+ mock.patch(self._AGENT_NAME + '.OVSNeutronOFPRyuAgent',
side_effect=httplib.HTTPException('boom')),
mock.patch('sys.exit', side_effect=SystemExit(0))
) as (mock_agent, mock_exit):
from contextlib import nested
import operator
-from quantum.db import api as db
-from quantum.plugins.ryu.common import config # noqa
-from quantum.plugins.ryu.db import api_v2 as db_api_v2
-from quantum.plugins.ryu.db import models_v2 as ryu_models_v2 # noqa
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.db import api as db
+from neutron.plugins.ryu.common import config # noqa
+from neutron.plugins.ryu.db import api_v2 as db_api_v2
+from neutron.plugins.ryu.db import models_v2 as ryu_models_v2 # noqa
+from neutron.tests.unit import test_db_plugin as test_plugin
-class RyuDBTest(test_plugin.QuantumDbPluginV2TestCase):
+class RyuDBTest(test_plugin.NeutronDbPluginV2TestCase):
@staticmethod
def _tunnel_key_sort(key_list):
key_list.sort(key=operator.attrgetter('tunnel_key'))
# See the License for the specific language governing permissions and
# limitations under the License.
-from quantum.plugins.ryu.db import models_v2 as ryu_models_v2 # noqa
-from quantum.tests.unit.ryu import fake_ryu
-from quantum.tests.unit import test_db_plugin as test_plugin
+from neutron.plugins.ryu.db import models_v2 as ryu_models_v2 # noqa
+from neutron.tests.unit.ryu import fake_ryu
+from neutron.tests.unit import test_db_plugin as test_plugin
-class RyuPluginV2TestCase(test_plugin.QuantumDbPluginV2TestCase):
+class RyuPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
- _plugin_name = 'quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2'
+ _plugin_name = 'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2'
def setUp(self):
self.ryu_patcher = fake_ryu.patch_fake_ryu_client()
import mock
-from quantum.api.v2 import attributes
-from quantum.extensions import securitygroup as ext_sg
-from quantum import manager
-from quantum.tests.unit.ryu import fake_ryu
-from quantum.tests.unit import test_extension_security_group as test_sg
-from quantum.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.api.v2 import attributes
+from neutron.extensions import securitygroup as ext_sg
+from neutron import manager
+from neutron.tests.unit.ryu import fake_ryu
+from neutron.tests.unit import test_extension_security_group as test_sg
+from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
-PLUGIN_NAME = ('quantum.plugins.ryu.'
- 'ryu_quantum_plugin.RyuQuantumPluginV2')
-AGENT_NAME = ('quantum.plugins.ryu.'
- 'agent.ryu_quantum_agent.OVSQuantumOFPRyuAgent')
-NOTIFIER = ('quantum.plugins.ryu.'
- 'ryu_quantum_plugin.AgentNotifierApi')
+PLUGIN_NAME = ('neutron.plugins.ryu.'
+ 'ryu_neutron_plugin.RyuNeutronPluginV2')
+AGENT_NAME = ('neutron.plugins.ryu.'
+ 'agent.ryu_neutron_agent.OVSNeutronOFPRyuAgent')
+NOTIFIER = ('neutron.plugins.ryu.'
+ 'ryu_neutron_plugin.AgentNotifierApi')
class RyuSecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
res = self.deserialize(self.fmt,
req.get_response(self.api))
port_id = res['port']['id']
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin.callbacks.get_port_from_device(port_id)
self.assertEqual(port_id, port_dict['id'])
self.assertEqual([security_group_id],
self._delete('ports', port_id)
def test_security_group_get_port_from_device_with_no_port(self):
- plugin = manager.QuantumManager.get_plugin()
+ plugin = manager.NeutronManager.get_plugin()
port_dict = plugin.callbacks.get_port_from_device('bad_device_id')
self.assertEqual(None, port_dict)
import mock
from oslo.config import cfg
-from quantum.services.loadbalancer.drivers.haproxy import agent
-from quantum.tests import base
+from neutron.services.loadbalancer.drivers.haproxy import agent
+from neutron.tests import base
class TestLbaasService(base.BaseTestCase):
self.assertTrue(mock_start.called)
def test_main(self):
- logging_str = 'quantum.agent.common.config.setup_logging'
+ logging_str = 'neutron.agent.common.config.setup_logging'
with contextlib.nested(
mock.patch(logging_str),
mock.patch.object(agent.service, 'launch'),
import mock
-from quantum.services.loadbalancer.drivers.haproxy import (
+from neutron.services.loadbalancer.drivers.haproxy import (
agent_manager as manager
)
-from quantum.tests import base
+from neutron.tests import base
class TestLogicalDeviceCache(base.BaseTestCase):
self.mock_importer = mock.patch.object(manager, 'importutils').start()
rpc_mock_cls = mock.patch(
- 'quantum.services.loadbalancer.drivers'
+ 'neutron.services.loadbalancer.drivers'
'.haproxy.agent_api.LbaasAgentApi'
).start()
import mock
-from quantum.services.loadbalancer.drivers.haproxy import (
+from neutron.services.loadbalancer.drivers.haproxy import (
agent_api as api
)
-from quantum.tests import base
+from neutron.tests import base
class TestApiCache(base.BaseTestCase):
from oslo.config import cfg as config
-from quantum.services.loadbalancer.drivers.haproxy import cfg
-from quantum.tests import base
+from neutron.services.loadbalancer.drivers.haproxy import cfg
+from neutron.tests import base
class TestHaproxyCfg(base.BaseTestCase):
def test_save_config(self):
with contextlib.nested(
- mock.patch('quantum.services.loadbalancer.'
+ mock.patch('neutron.services.loadbalancer.'
'drivers.haproxy.cfg._build_global'),
- mock.patch('quantum.services.loadbalancer.'
+ mock.patch('neutron.services.loadbalancer.'
'drivers.haproxy.cfg._build_defaults'),
- mock.patch('quantum.services.loadbalancer.'
+ mock.patch('neutron.services.loadbalancer.'
'drivers.haproxy.cfg._build_frontend'),
- mock.patch('quantum.services.loadbalancer.'
+ mock.patch('neutron.services.loadbalancer.'
'drivers.haproxy.cfg._build_backend'),
- mock.patch('quantum.agent.linux.utils.replace_file')
+ mock.patch('neutron.agent.linux.utils.replace_file')
) as (b_g, b_d, b_f, b_b, replace):
test_config = ['globals', 'defaults', 'frontend', 'backend']
b_g.return_value = [test_config[0]]
import contextlib
import mock
-from quantum.common import exceptions
-from quantum.services.loadbalancer.drivers.haproxy import (
+from neutron.common import exceptions
+from neutron.services.loadbalancer.drivers.haproxy import (
namespace_driver
)
-from quantum.tests import base
+from neutron.tests import base
class TestHaproxyNSDriver(base.BaseTestCase):
with contextlib.nested(
mock.patch.object(namespace_driver.hacfg, 'save_config'),
mock.patch.object(self.driver, '_get_state_file_path'),
- mock.patch('quantum.agent.linux.ip_lib.IPWrapper')
+ mock.patch('neutron.agent.linux.ip_lib.IPWrapper')
) as (mock_save, gsp, ip_wrap):
gsp.side_effect = lambda x, y: y
mock.patch.object(self.driver, '_get_state_file_path'),
mock.patch.object(namespace_driver, 'kill_pids_in_file'),
mock.patch.object(self.driver, '_unplug'),
- mock.patch('quantum.agent.linux.ip_lib.IPWrapper'),
+ mock.patch('neutron.agent.linux.ip_lib.IPWrapper'),
mock.patch('os.path.isdir'),
mock.patch('shutil.rmtree')
) as (gsp, kill, unplug, ip_wrap, isdir, rmtree):
def test_exists(self):
with contextlib.nested(
mock.patch.object(self.driver, '_get_state_file_path'),
- mock.patch('quantum.agent.linux.ip_lib.IPWrapper'),
+ mock.patch('neutron.agent.linux.ip_lib.IPWrapper'),
mock.patch('socket.socket'),
mock.patch('os.path.exists'),
) as (gsp, ip_wrap, socket, path_exists):
'subnet': {'cidr': '10.0.0.0/24',
'gateway_ip': '10.0.0.1'}}]}
with contextlib.nested(
- mock.patch('quantum.agent.linux.ip_lib.device_exists'),
+ mock.patch('neutron.agent.linux.ip_lib.device_exists'),
mock.patch('netaddr.IPNetwork'),
- mock.patch('quantum.agent.linux.ip_lib.IPWrapper'),
+ mock.patch('neutron.agent.linux.ip_lib.IPWrapper'),
) as (dev_exists, ip_net, ip_wrap):
self.vif_driver.get_device_name.return_value = 'test_interface'
dev_exists.return_value = False
'fixed_ips': [{'ip_address': '10.0.0.2',
'subnet': {'cidr': '10.0.0.0/24'}}]}
with contextlib.nested(
- mock.patch('quantum.agent.linux.ip_lib.device_exists'),
+ mock.patch('neutron.agent.linux.ip_lib.device_exists'),
mock.patch('netaddr.IPNetwork'),
- mock.patch('quantum.agent.linux.ip_lib.IPWrapper'),
+ mock.patch('neutron.agent.linux.ip_lib.IPWrapper'),
) as (dev_exists, ip_net, ip_wrap):
self.vif_driver.get_device_name.return_value = 'test_interface'
dev_exists.return_value = False
with contextlib.nested(
mock.patch('os.path.exists'),
mock.patch('__builtin__.open'),
- mock.patch('quantum.agent.linux.utils.execute')
+ mock.patch('neutron.agent.linux.utils.execute')
) as (path_exists, mock_open, mock_execute):
file_mock = mock.MagicMock()
mock_open.return_value = file_mock
import mock
-from quantum.common import exceptions
-from quantum import context
-from quantum.db.loadbalancer import loadbalancer_db as ldb
-from quantum import manager
-from quantum.openstack.common import uuidutils
-from quantum.plugins.common import constants
-from quantum.services.loadbalancer.drivers.haproxy import (
+from neutron.common import exceptions
+from neutron import context
+from neutron.db.loadbalancer import loadbalancer_db as ldb
+from neutron import manager
+from neutron.openstack.common import uuidutils
+from neutron.plugins.common import constants
+from neutron.services.loadbalancer.drivers.haproxy import (
plugin_driver
)
-from quantum.tests import base
-from quantum.tests.unit.db.loadbalancer import test_db_loadbalancer
+from neutron.tests import base
+from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
class TestLoadBalancerPluginBase(
# pass a mock to our API instance
# we need access to loaded plugins to modify models
- loaded_plugins = manager.QuantumManager().get_service_plugins()
+ loaded_plugins = manager.NeutronManager().get_service_plugins()
self.plugin_instance = loaded_plugins[constants.LOADBALANCER]
def test_plug_vip_port(self):
exp = {
- 'device_owner': 'quantum:' + constants.LOADBALANCER,
+ 'device_owner': 'neutron:' + constants.LOADBALANCER,
'device_id': 'c596ce11-db30-5c72-8243-15acaae8690f',
'admin_state_up': True
}
from webob import exc
import webtest
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.common import config
-from quantum.extensions import loadbalancer
-from quantum import manager
-from quantum.openstack.common import uuidutils
-from quantum.plugins.common import constants
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_extensions
-from quantum.tests.unit import testlib_api
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.common import config
+from neutron.extensions import loadbalancer
+from neutron import manager
+from neutron.openstack.common import uuidutils
+from neutron.plugins.common import constants
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_extensions
+from neutron.tests.unit import testlib_api
_uuid = uuidutils.generate_uuid
def setUp(self):
super(LoadBalancerExtensionTestCase, self).setUp()
- plugin = 'quantum.extensions.loadbalancer.LoadBalancerPluginBase'
+ plugin = 'neutron.extensions.loadbalancer.LoadBalancerPluginBase'
# Ensure 'stale' patched copies of the plugin are never returned
- manager.QuantumManager._instance = None
+ manager.NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
# Create the default configurations
- args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
+ args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args)
#just stubbing core plugin with LoadBalancer plugin
# License for the specific language governing permissions and limitations
# under the License.
-from quantum.agent.common import config
-from quantum.tests import base
+from neutron.agent.common import config
+from neutron.tests import base
def test_setup_conf():
conf = config.setup_conf()
- assert conf.state_path.endswith('/var/lib/quantum')
+ assert conf.state_path.endswith('/var/lib/neutron')
class TestRootHelper(base.BaseTestCase):
from oslo.config import cfg
from webob import exc
-from quantum.api.v2 import attributes
-from quantum.common import constants
-from quantum.common.test_lib import test_config
-from quantum.common import topics
-from quantum import context
-from quantum.db import agents_db
-from quantum.db import db_base_plugin_v2
-from quantum.extensions import agent
-from quantum.openstack.common import log as logging
-from quantum.openstack.common import timeutils
-from quantum.openstack.common import uuidutils
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_db_plugin
+from neutron.api.v2 import attributes
+from neutron.common import constants
+from neutron.common.test_lib import test_config
+from neutron.common import topics
+from neutron import context
+from neutron.db import agents_db
+from neutron.db import db_base_plugin_v2
+from neutron.extensions import agent
+from neutron.openstack.common import log as logging
+from neutron.openstack.common import timeutils
+from neutron.openstack.common import uuidutils
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_db_plugin
LOG = logging.getLogger(__name__)
# This plugin class is just for testing
-class TestAgentPlugin(db_base_plugin_v2.QuantumDbPluginV2,
+class TestAgentPlugin(db_base_plugin_v2.NeutronDbPluginV2,
agents_db.AgentDbMixin):
supported_extension_aliases = ["agent"]
class AgentDBTestMixIn(object):
def _list_agents(self, expected_res_status=None,
- quantum_context=None,
+ neutron_context=None,
query_string=None):
agent_res = self._list('agents',
- quantum_context=quantum_context,
+ neutron_context=neutron_context,
query_params=query_string)
if expected_res_status:
self.assertEqual(agent_res.status_int, expected_res_status)
def _register_agent_states(self):
"""Register two L3 agents and two DHCP agents."""
l3_hosta = {
- 'binary': 'quantum-l3-agent',
+ 'binary': 'neutron-l3-agent',
'host': L3_HOSTA,
'topic': topics.L3_AGENT,
'configurations': {'use_namespaces': True,
l3_hostb = copy.deepcopy(l3_hosta)
l3_hostb['host'] = L3_HOSTB
dhcp_hosta = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOSTA,
'topic': 'DHCP_AGENT',
'configurations': {'dhcp_driver': 'dhcp_driver',
def _register_one_dhcp_agent(self):
"""Register one DHCP agent."""
dhcp_host = {
- 'binary': 'quantum-dhcp-agent',
+ 'binary': 'neutron-dhcp-agent',
'host': DHCP_HOST1,
'topic': 'DHCP_AGENT',
'configurations': {'dhcp_driver': 'dhcp_driver',
class AgentDBTestCase(AgentDBTestMixIn,
- test_db_plugin.QuantumDbPluginV2TestCase):
+ test_db_plugin.NeutronDbPluginV2TestCase):
fmt = 'json'
def setUp(self):
self.adminContext = context.get_admin_context()
test_config['plugin_name_v2'] = (
- 'quantum.tests.unit.test_agent_ext_plugin.TestAgentPlugin')
+ 'neutron.tests.unit.test_agent_ext_plugin.TestAgentPlugin')
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
# Save the original RESOURCE_ATTRIBUTE_MAP
def test_create_agent(self):
data = {'agent': {}}
_req = self.new_create_request('agents', data, self.fmt)
- _req.environ['quantum.context'] = context.Context(
+ _req.environ['neutron.context'] = context.Context(
'', 'tenant_id')
res = _req.get_response(self.ext_api)
self.assertEqual(res.status_int, exc.HTTPBadRequest.code)
def test_show_agent(self):
self._register_agent_states()
agents = self._list_agents(
- query_string='binary=quantum-l3-agent')
+ query_string='binary=neutron-l3-agent')
self.assertEqual(2, len(agents['agents']))
agent = self._show('agents', agents['agents'][0]['id'])
- self.assertEqual('quantum-l3-agent', agent['agent']['binary'])
+ self.assertEqual('neutron-l3-agent', agent['agent']['binary'])
def test_update_agent(self):
self._register_agent_states()
agents = self._list_agents(
- query_string='binary=quantum-l3-agent&host=' + L3_HOSTB)
+ query_string='binary=neutron-l3-agent&host=' + L3_HOSTB)
self.assertEqual(1, len(agents['agents']))
com_id = agents['agents'][0]['id']
agent = self._show('agents', com_id)
self._register_agent_states()
time.sleep(1.5)
agents = self._list_agents(
- query_string='binary=quantum-l3-agent&host=' + L3_HOSTB)
+ query_string='binary=neutron-l3-agent&host=' + L3_HOSTB)
self.assertFalse(agents['agents'][0]['alive'])
import fixtures
import mock
-from quantum.agent.linux import utils
-from quantum.tests import base
+from neutron.agent.linux import utils
+from neutron.tests import base
class AgentUtilsExecuteTest(base.BaseTestCase):
import mock
from oslo.config import cfg
-from quantum.agent import netns_cleanup_util as util
-from quantum.tests import base
+from neutron.agent import netns_cleanup_util as util
+from neutron.tests import base
class TestNullDelegate(base.BaseTestCase):
conf.AGENT.root_helper = 'sudo',
conf.dhcp_driver = 'driver'
- method_to_patch = 'quantum.openstack.common.importutils.import_object'
+ method_to_patch = 'neutron.openstack.common.importutils.import_object'
with mock.patch(method_to_patch) as import_object:
driver = mock.Mock()
ns = prefix + '6e322ac7-ab50-4f53-9cdc-d1d3c1164b6d'
conf = mock.Mock()
- with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap:
+ with mock.patch('neutron.agent.linux.ip_lib.IPWrapper') as ip_wrap:
ip_wrap.return_value.namespace_is_empty.return_value = is_empty
self.assertEqual(util.eligible_for_deletion(conf, ns, force),
expected)
device.name = 'tap1'
device.link.delete.side_effect = RuntimeError
- with mock.patch('quantum.agent.linux.ovs_lib.OVSBridge') as ovs_br_cls:
+ with mock.patch('neutron.agent.linux.ovs_lib.OVSBridge') as ovs_br_cls:
br_patch = mock.patch(
- 'quantum.agent.linux.ovs_lib.get_bridge_for_iface')
+ 'neutron.agent.linux.ovs_lib.get_bridge_for_iface')
with br_patch as mock_get_bridge_for_iface:
mock_get_bridge_for_iface.return_value = 'br-int'
ovs_bridge = mock.Mock()
device.name = 'tap1'
device.link.delete.side_effect = RuntimeError
- with mock.patch('quantum.agent.linux.ovs_lib.OVSBridge') as ovs_br_cls:
+ with mock.patch('neutron.agent.linux.ovs_lib.OVSBridge') as ovs_br_cls:
br_patch = mock.patch(
- 'quantum.agent.linux.ovs_lib.get_bridge_for_iface')
+ 'neutron.agent.linux.ovs_lib.get_bridge_for_iface')
with br_patch as mock_get_bridge_for_iface:
with mock.patch.object(util.LOG, 'debug') as debug:
mock_get_bridge_for_iface.return_value = None
devices.append(dev)
num_devices -= 1
- with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap:
+ with mock.patch('neutron.agent.linux.ip_lib.IPWrapper') as ip_wrap:
ip_wrap.return_value.get_devices.return_value = devices
ip_wrap.return_value.netns.exists.return_value = True
ns = 'qrouter-6e322ac7-ab50-4f53-9cdc-d1d3c1164b6d'
conf = mock.Mock()
conf.AGENT.root_helper = 'sudo'
- with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap:
+ with mock.patch('neutron.agent.linux.ip_lib.IPWrapper') as ip_wrap:
ip_wrap.side_effect = Exception()
util.destroy_namespace(conf, ns)
def test_main(self):
namespaces = ['ns1', 'ns2']
- with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap:
+ with mock.patch('neutron.agent.linux.ip_lib.IPWrapper') as ip_wrap:
ip_wrap.get_namespaces.return_value = namespaces
with mock.patch('eventlet.sleep') as eventlet_sleep:
with mock.patch.multiple(util, **methods_to_mock) as mocks:
mocks['eligible_for_deletion'].return_value = True
mocks['setup_conf'].return_value = conf
- with mock.patch('quantum.common.config.setup_logging'):
+ with mock.patch('neutron.common.config.setup_logging'):
util.main()
mocks['eligible_for_deletion'].assert_has_calls(
def test_main_no_candidates(self):
namespaces = ['ns1', 'ns2']
- with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap:
+ with mock.patch('neutron.agent.linux.ip_lib.IPWrapper') as ip_wrap:
ip_wrap.get_namespaces.return_value = namespaces
with mock.patch('eventlet.sleep') as eventlet_sleep:
with mock.patch.multiple(util, **methods_to_mock) as mocks:
mocks['eligible_for_deletion'].return_value = False
mocks['setup_conf'].return_value = conf
- with mock.patch('quantum.common.config.setup_logging'):
+ with mock.patch('neutron.common.config.setup_logging'):
util.main()
ip_wrap.assert_has_calls(
import mock
from oslo.config import cfg
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import ovs_lib
-from quantum.agent import ovs_cleanup_util as util
-from quantum.openstack.common import uuidutils
-from quantum.tests import base
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import ovs_lib
+from neutron.agent import ovs_cleanup_util as util
+from neutron.openstack.common import uuidutils
+from neutron.tests import base
class TestOVSCleanup(base.BaseTestCase):
conf.ovs_integration_bridge = 'br-int'
conf.external_network_bridge = 'br-ex'
with contextlib.nested(
- mock.patch('quantum.common.config.setup_logging'),
- mock.patch('quantum.agent.ovs_cleanup_util.setup_conf',
+ mock.patch('neutron.common.config.setup_logging'),
+ mock.patch('neutron.agent.ovs_cleanup_util.setup_conf',
return_value=conf),
- mock.patch('quantum.agent.linux.ovs_lib.get_bridges',
+ mock.patch('neutron.agent.linux.ovs_lib.get_bridges',
return_value=bridges),
- mock.patch('quantum.agent.linux.ovs_lib.OVSBridge'),
- mock.patch.object(util, 'collect_quantum_ports',
+ mock.patch('neutron.agent.linux.ovs_lib.OVSBridge'),
+ mock.patch.object(util, 'collect_neutron_ports',
return_value=ports),
- mock.patch.object(util, 'delete_quantum_ports')
+ mock.patch.object(util, 'delete_neutron_ports')
) as (_log, _conf, _get, ovs, collect, delete):
- with mock.patch('quantum.common.config.setup_logging'):
+ with mock.patch('neutron.common.config.setup_logging'):
util.main()
ovs.assert_has_calls([mock.call().delete_ports(
all_ports=False)])
collect.assert_called_once_with(set(bridges), 'dummy_sudo')
delete.assert_called_once_with(ports, 'dummy_sudo')
- def test_collect_quantum_ports(self):
+ def test_collect_neutron_ports(self):
port1 = ovs_lib.VifPort('tap1234', 1, uuidutils.generate_uuid(),
'11:22:33:44:55:66', 'br')
port2 = ovs_lib.VifPort('tap5678', 2, uuidutils.generate_uuid(),
'99:00:aa:bb:cc:dd', 'br')
ports = [[port1, port2], [port3]]
portnames = [p.port_name for p in itertools.chain(*ports)]
- with mock.patch('quantum.agent.linux.ovs_lib.OVSBridge') as ovs:
+ with mock.patch('neutron.agent.linux.ovs_lib.OVSBridge') as ovs:
ovs.return_value.get_vif_ports.side_effect = ports
bridges = ['br-int', 'br-ex']
- ret = util.collect_quantum_ports(bridges, 'dummy_sudo')
+ ret = util.collect_neutron_ports(bridges, 'dummy_sudo')
self.assertEqual(ret, portnames)
- def test_delete_quantum_ports(self):
+ def test_delete_neutron_ports(self):
ports = ['tap1234', 'tap5678', 'tap09ab']
port_found = [True, False, True]
with contextlib.nested(
side_effect=port_found),
mock.patch.object(ip_lib, 'IPDevice')
) as (device_exists, ip_dev):
- util.delete_quantum_ports(ports, 'dummy_sudo')
+ util.delete_neutron_ports(ports, 'dummy_sudo')
device_exists.assert_has_calls([mock.call(p) for p in ports])
ip_dev.assert_has_calls(
[mock.call('tap1234', 'dummy_sudo'),
import mock
-from quantum.agent import rpc
-from quantum.openstack.common import context
-from quantum.tests import base
+from neutron.agent import rpc
+from neutron.openstack.common import context
+from neutron.tests import base
class AgentRPCPluginApi(base.BaseTestCase):
agent = rpc.PluginApi('fake_topic')
ctxt = context.RequestContext('fake_user', 'fake_project')
expect_val = 'foo'
- with mock.patch('quantum.openstack.common.rpc.call') as rpc_call:
+ with mock.patch('neutron.openstack.common.rpc.call') as rpc_call:
rpc_call.return_value = expect_val
func_obj = getattr(agent, method)
if method == 'tunnel_sync':
mock.call().consume_in_thread()
]
- call_to_patch = 'quantum.openstack.common.rpc.create_connection'
+ call_to_patch = 'neutron.openstack.common.rpc.create_connection'
with mock.patch(call_to_patch) as create_connection:
rpc.create_consumers(dispatcher, 'foo', [('topic', 'op')])
create_connection.assert_has_calls(expected)
from testtools import matchers
from webob import exc
-from quantum.api import api_common as common
-from quantum.tests import base
+from neutron.api import api_common as common
+from neutron.tests import base
-class FakeController(common.QuantumController):
+class FakeController(common.NeutronController):
_resource_name = 'fake'
from webob import exc
import webtest
-from quantum.api import api_common
-from quantum.api.extensions import PluginAwareExtensionManager
-from quantum.api.v2 import attributes
-from quantum.api.v2 import base as v2_base
-from quantum.api.v2 import router
-from quantum.common import config
-from quantum.common import exceptions as q_exc
-from quantum import context
-from quantum.manager import QuantumManager
-from quantum.openstack.common.notifier import api as notifer_api
-from quantum.openstack.common import policy as common_policy
-from quantum.openstack.common import uuidutils
-from quantum.tests import base
-from quantum.tests.unit import testlib_api
+from neutron.api import api_common
+from neutron.api.extensions import PluginAwareExtensionManager
+from neutron.api.v2 import attributes
+from neutron.api.v2 import base as v2_base
+from neutron.api.v2 import router
+from neutron.common import config
+from neutron.common import exceptions as q_exc
+from neutron import context
+from neutron.manager import NeutronManager
+from neutron.openstack.common.notifier import api as notifer_api
+from neutron.openstack.common import policy as common_policy
+from neutron.openstack.common import uuidutils
+from neutron.tests import base
+from neutron.tests.unit import testlib_api
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
def setUp(self):
super(APIv2TestBase, self).setUp()
- plugin = 'quantum.quantum_plugin_base_v2.QuantumPluginBaseV2'
+ plugin = 'neutron.neutron_plugin_base_v2.NeutronPluginBaseV2'
# Ensure 'stale' patched copies of the plugin are never returned
- QuantumManager._instance = None
+ NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
PluginAwareExtensionManager._instance = None
# Create the default configurations
- args = ['--config-file', etcdir('quantum.conf.test')]
+ args = ['--config-file', etcdir('neutron.conf.test')]
config.parse(args=args)
# Update the plugin
cfg.CONF.set_override('core_plugin', plugin)
self._plugin_patcher = mock.patch(plugin, autospec=True)
self.plugin = self._plugin_patcher.start()
instance = self.plugin.return_value
- instance._QuantumPluginBaseV2__native_pagination_support = True
- instance._QuantumPluginBaseV2__native_sorting_support = True
+ instance._NeutronPluginBaseV2__native_pagination_support = True
+ instance._NeutronPluginBaseV2__native_sorting_support = True
self.addCleanup(self._plugin_patcher.stop)
self.addCleanup(cfg.CONF.reset)
def test_emulated_sort(self):
instance = self.plugin.return_value
- instance._QuantumPluginBaseV2__native_pagination_support = False
- instance._QuantumPluginBaseV2__native_sorting_support = False
+ instance._NeutronPluginBaseV2__native_pagination_support = False
+ instance._NeutronPluginBaseV2__native_sorting_support = False
instance.get_networks.return_value = []
api = webtest.TestApp(router.APIRouter())
api.get(_get_path('networks'), {'sort_key': ['name', 'status'],
def test_emulated_sort_without_sort_field(self):
instance = self.plugin.return_value
- instance._QuantumPluginBaseV2__native_pagination_support = False
- instance._QuantumPluginBaseV2__native_sorting_support = False
+ instance._NeutronPluginBaseV2__native_pagination_support = False
+ instance._NeutronPluginBaseV2__native_sorting_support = False
instance.get_networks.return_value = []
api = webtest.TestApp(router.APIRouter())
api.get(_get_path('networks'), {'sort_key': ['name', 'status'],
def test_emulated_pagination(self):
instance = self.plugin.return_value
- instance._QuantumPluginBaseV2__native_pagination_support = False
+ instance._NeutronPluginBaseV2__native_pagination_support = False
instance.get_networks.return_value = []
api = webtest.TestApp(router.APIRouter())
api.get(_get_path('networks'), {'limit': 10,
def test_native_pagination_without_native_sorting(self):
instance = self.plugin.return_value
- instance._QuantumPluginBaseV2__native_sorting_support = False
+ instance._NeutronPluginBaseV2__native_sorting_support = False
self.assertRaises(q_exc.Invalid, router.APIRouter)
def test_native_pagination_without_allow_sorting(self):
def _test_list(self, req_tenant_id, real_tenant_id):
env = {}
if req_tenant_id:
- env = {'quantum.context': context.Context('', req_tenant_id)}
+ env = {'neutron.context': context.Context('', req_tenant_id)}
input_dict = {'id': uuidutils.generate_uuid(),
'name': 'net1',
'admin_state_up': True,
def test_create_with_keystone_env(self):
tenant_id = _uuid()
net_id = _uuid()
- env = {'quantum.context': context.Context('', tenant_id)}
+ env = {'neutron.context': context.Context('', tenant_id)}
# tenant_id should be fetched from env
initial_input = {'network': {'name': 'net1'}}
full_input = {'network': {'admin_state_up': True,
def test_create_bad_keystone_tenant(self):
tenant_id = _uuid()
data = {'network': {'name': 'net1', 'tenant_id': tenant_id}}
- env = {'quantum.context': context.Context('', tenant_id + "bad")}
+ env = {'neutron.context': context.Context('', tenant_id + "bad")}
res = self.api.post(_get_path('networks', fmt=self.fmt),
self.serialize(data),
content_type='application/' + self.fmt,
expect_errors=False):
env = {}
if req_tenant_id:
- env = {'quantum.context': context.Context('', req_tenant_id)}
+ env = {'neutron.context': context.Context('', req_tenant_id)}
instance = self.plugin.return_value
instance.get_network.return_value = {'tenant_id': real_tenant_id,
'shared': False}
env = {}
shared = False
if req_tenant_id:
- env = {'quantum.context': context.Context('', req_tenant_id)}
+ env = {'neutron.context': context.Context('', req_tenant_id)}
if req_tenant_id.endswith('another'):
shared = True
- env['quantum.context'].roles = ['tenant_admin']
+ env['neutron.context'].roles = ['tenant_admin']
data = {'tenant_id': real_tenant_id, 'shared': shared}
instance = self.plugin.return_value
expect_errors=False):
env = {}
if req_tenant_id:
- env = {'quantum.context': context.Context('', req_tenant_id)}
+ env = {'neutron.context': context.Context('', req_tenant_id)}
# leave out 'name' field intentionally
data = {'network': {'admin_state_up': True}}
return_value = {'subnets': []}
def setUp(self):
super(SubresourceTest, self).setUp()
- plugin = 'quantum.tests.unit.test_api_v2.TestSubresourcePlugin'
- QuantumManager._instance = None
+ plugin = 'neutron.tests.unit.test_api_v2.TestSubresourcePlugin'
+ NeutronManager._instance = None
PluginAwareExtensionManager._instance = None
# Save the global RESOURCE_ATTRIBUTE_MAP
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
self.saved_attr_map[resource] = attrs.copy()
- args = ['--config-file', etcdir('quantum.conf.test')]
+ args = ['--config-file', etcdir('neutron.conf.test')]
config.parse(args=args)
cfg.CONF.set_override('core_plugin', plugin)
instance.get_networks_count.assert_called_with(mock.ANY,
filters=mock.ANY)
self.assertTrue("Quota exceeded for resources" in
- res.json['QuantumError'])
+ res.json['NeutronError'])
def test_create_network_quota_no_counts(self):
cfg.CONF.set_override('quota_network', 1, group='QUOTAS')
instance.get_networks_count.assert_called_with(mock.ANY,
filters=mock.ANY)
self.assertTrue("Quota exceeded for resources" in
- res.json['QuantumError'])
+ res.json['NeutronError'])
def test_create_network_quota_without_limit(self):
cfg.CONF.set_override('quota_network', -1, group='QUOTAS')
class ExtensionTestCase(base.BaseTestCase):
def setUp(self):
super(ExtensionTestCase, self).setUp()
- plugin = 'quantum.quantum_plugin_base_v2.QuantumPluginBaseV2'
+ plugin = 'neutron.neutron_plugin_base_v2.NeutronPluginBaseV2'
# Ensure 'stale' patched copies of the plugin are never returned
- QuantumManager._instance = None
+ NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
PluginAwareExtensionManager._instance = None
self.saved_attr_map[resource] = attrs.copy()
# Create the default configurations
- args = ['--config-file', etcdir('quantum.conf.test')]
+ args = ['--config-file', etcdir('neutron.conf.test')]
config.parse(args=args)
# Update the plugin and extensions path
self.plugin = self._plugin_patcher.start()
# Instantiate mock plugin and enable the V2attributes extension
- QuantumManager.get_plugin().supported_extension_aliases = ["v2attrs"]
+ NeutronManager.get_plugin().supported_extension_aliases = ["v2attrs"]
api = router.APIRouter()
self.api = webtest.TestApp(api)
from webob import exc
import webtest
-from quantum.api.v2 import resource as wsgi_resource
-from quantum.common import exceptions as q_exc
-from quantum import context
-from quantum.tests import base
-from quantum import wsgi
+from neutron.api.v2 import resource as wsgi_resource
+from neutron.common import exceptions as q_exc
+from neutron import context
+from neutron.tests import base
+from neutron import wsgi
class RequestTestCase(base.BaseTestCase):
result = request.best_match_content_type()
self.assertEqual(result, "application/json")
- def test_context_with_quantum_context(self):
+ def test_context_with_neutron_context(self):
ctxt = context.Context('fake_user', 'fake_tenant')
- self.req.environ['quantum.context'] = ctxt
+ self.req.environ['neutron.context'] = ctxt
self.assertEqual(self.req.context, ctxt)
- def test_context_without_quantum_context(self):
+ def test_context_without_neutron_context(self):
self.assertTrue(self.req.context.is_admin)
class ResourceTestCase(base.BaseTestCase):
- def test_unmapped_quantum_error_with_json(self):
+ def test_unmapped_neutron_error_with_json(self):
msg = u'\u7f51\u7edc'
- class TestException(q_exc.QuantumException):
+ class TestException(q_exc.NeutronException):
message = msg
- expected_res = {'body': {'QuantumError': msg}}
+ expected_res = {'body': {'NeutronError': msg}}
controller = mock.MagicMock()
controller.test.side_effect = TestException()
self.assertEqual(wsgi.JSONDeserializer().deserialize(res.body),
expected_res)
- def test_unmapped_quantum_error_with_xml(self):
+ def test_unmapped_neutron_error_with_xml(self):
msg = u'\u7f51\u7edc'
- class TestException(q_exc.QuantumException):
+ class TestException(q_exc.NeutronException):
message = msg
- expected_res = {'body': {'QuantumError': msg}}
+ expected_res = {'body': {'NeutronError': msg}}
controller = mock.MagicMock()
controller.test.side_effect = TestException()
self.assertEqual(wsgi.XMLDeserializer().deserialize(res.body),
expected_res)
- def test_mapped_quantum_error_with_json(self):
+ def test_mapped_neutron_error_with_json(self):
msg = u'\u7f51\u7edc'
- class TestException(q_exc.QuantumException):
+ class TestException(q_exc.NeutronException):
message = msg
- expected_res = {'body': {'QuantumError': msg}}
+ expected_res = {'body': {'NeutronError': msg}}
controller = mock.MagicMock()
controller.test.side_effect = TestException()
self.assertEqual(wsgi.JSONDeserializer().deserialize(res.body),
expected_res)
- def test_mapped_quantum_error_with_xml(self):
+ def test_mapped_neutron_error_with_xml(self):
msg = u'\u7f51\u7edc'
- class TestException(q_exc.QuantumException):
+ class TestException(q_exc.NeutronException):
message = msg
- expected_res = {'body': {'QuantumError': msg}}
+ expected_res = {'body': {'NeutronError': msg}}
controller = mock.MagicMock()
controller.test.side_effect = TestException()
self.assertEqual(res.status_int, exc.HTTPGatewayTimeout.code)
def test_unhandled_error_with_json(self):
- expected_res = {'body': {'QuantumError':
+ expected_res = {'body': {'NeutronError':
_('Request Failed: internal server error '
'while processing your request.')}}
controller = mock.MagicMock()
expected_res)
def test_unhandled_error_with_xml(self):
- expected_res = {'body': {'QuantumError':
+ expected_res = {'body': {'NeutronError':
_('Request Failed: internal server error '
'while processing your request.')}}
controller = mock.MagicMock()
import testtools
-from quantum.api.v2 import attributes
-from quantum.common import exceptions as q_exc
-from quantum.tests import base
+from neutron.api.v2 import attributes
+from neutron.common import exceptions as q_exc
+from neutron.tests import base
class TestAttributes(base.BaseTestCase):
import webob
-from quantum import auth
-from quantum.tests import base
+from neutron import auth
+from neutron.tests import base
-class QuantumKeystoneContextTestCase(base.BaseTestCase):
+class NeutronKeystoneContextTestCase(base.BaseTestCase):
def setUp(self):
- super(QuantumKeystoneContextTestCase, self).setUp()
+ super(NeutronKeystoneContextTestCase, self).setUp()
@webob.dec.wsgify
def fake_app(req):
- self.context = req.environ['quantum.context']
+ self.context = req.environ['neutron.context']
return webob.Response()
self.context = None
- self.middleware = auth.QuantumKeystoneContext(fake_app)
+ self.middleware = auth.NeutronKeystoneContext(fake_app)
self.request = webob.Request.blank('/')
self.request.headers['X_AUTH_TOKEN'] = 'testauthtoken'
import testtools
-from quantum.common import exceptions as q_exc
-from quantum.common import utils
-from quantum.plugins.common import utils as plugin_utils
-from quantum.tests import base
+from neutron.common import exceptions as q_exc
+from neutron.common import utils
+from neutron.plugins.common import utils as plugin_utils
+from neutron.tests import base
class TestParseMappings(base.BaseTestCase):
from oslo.config import cfg
-from quantum.common import config # noqa
-from quantum.tests import base
+from neutron.common import config # noqa
+from neutron.tests import base
class ConfigurationTest(base.BaseTestCase):
self.assertEqual(absolute_dir, cfg.CONF.state_path)
self.assertEqual(120, cfg.CONF.dhcp_lease_duration)
self.assertFalse(cfg.CONF.allow_overlapping_ips)
- self.assertEqual('quantum', cfg.CONF.control_exchange)
+ self.assertEqual('neutron', cfg.CONF.control_exchange)
import mock
-from quantum.db import migration
-from quantum.db.migration import cli
-from quantum.tests import base
+from neutron.db import migration
+from neutron.db.migration import cli
+from neutron.tests import base
class TestDbMigration(base.BaseTestCase):
from testtools import matchers
import webob.exc
-import quantum
-from quantum.api import api_common
-from quantum.api.extensions import PluginAwareExtensionManager
-from quantum.api.v2 import attributes
-from quantum.api.v2.attributes import ATTR_NOT_SPECIFIED
-from quantum.api.v2.router import APIRouter
-from quantum.common import config
-from quantum.common import exceptions as q_exc
-from quantum.common.test_lib import test_config
-from quantum import context
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import models_v2
-from quantum.manager import QuantumManager
-from quantum.openstack.common import timeutils
-from quantum.tests import base
-from quantum.tests.unit import test_extensions
-from quantum.tests.unit import testlib_api
-
-DB_PLUGIN_KLASS = 'quantum.db.db_base_plugin_v2.QuantumDbPluginV2'
+import neutron
+from neutron.api import api_common
+from neutron.api.extensions import PluginAwareExtensionManager
+from neutron.api.v2 import attributes
+from neutron.api.v2.attributes import ATTR_NOT_SPECIFIED
+from neutron.api.v2.router import APIRouter
+from neutron.common import config
+from neutron.common import exceptions as q_exc
+from neutron.common.test_lib import test_config
+from neutron import context
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import models_v2
+from neutron.manager import NeutronManager
+from neutron.openstack.common import timeutils
+from neutron.tests import base
+from neutron.tests.unit import test_extensions
+from neutron.tests.unit import testlib_api
+
+DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
return api_common.SortingEmulatedHelper(request, self._attr_info)
-class QuantumDbPluginV2TestCase(testlib_api.WebTestCase):
+class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
fmt = 'json'
resource_prefix_map = {}
def setUp(self, plugin=None, service_plugins=None):
- super(QuantumDbPluginV2TestCase, self).setUp()
+ super(NeutronDbPluginV2TestCase, self).setUp()
# Make sure at each test a new instance of the plugin is returned
- QuantumManager._instance = None
+ NeutronManager._instance = None
# Make sure at each test according extensions for the plugin is loaded
PluginAwareExtensionManager._instance = None
# Save the attributes map in case the plugin will alter it
plugin = test_config.get('plugin_name_v2', DB_PLUGIN_KLASS)
# Create the default configurations
- args = ['--config-file', etcdir('quantum.conf.test')]
+ args = ['--config-file', etcdir('neutron.conf.test')]
# If test_config specifies some config-file, use it, as well
for config_file in test_config.get('config_files', []):
args.extend(['--config-file', config_file])
self.port_create_status = 'ACTIVE'
def _is_native_bulk_supported():
- plugin_obj = QuantumManager.get_plugin()
+ plugin_obj = NeutronManager.get_plugin()
native_bulk_attr_name = ("_%s__native_bulk_support"
% plugin_obj.__class__.__name__)
return getattr(plugin_obj, native_bulk_attr_name, False)
def _is_native_pagination_support():
native_pagination_attr_name = (
"_%s__native_pagination_support" %
- QuantumManager.get_plugin().__class__.__name__)
+ NeutronManager.get_plugin().__class__.__name__)
return (cfg.CONF.allow_pagination and
- getattr(QuantumManager.get_plugin(),
+ getattr(NeutronManager.get_plugin(),
native_pagination_attr_name, False))
self._skip_native_pagination = not _is_native_pagination_support()
def _is_native_sorting_support():
native_sorting_attr_name = (
"_%s__native_sorting_support" %
- QuantumManager.get_plugin().__class__.__name__)
+ NeutronManager.get_plugin().__class__.__name__)
return (cfg.CONF.allow_sorting and
- getattr(QuantumManager.get_plugin(),
+ getattr(NeutronManager.get_plugin(),
native_sorting_attr_name, False))
self._skip_native_sorting = not _is_native_sorting_support()
self._skip_native_pagination = None
self._skip_native_sortin = None
self.ext_api = None
- # NOTE(jkoelker) for a 'pluggable' framework, Quantum sure
+ # NOTE(jkoelker) for a 'pluggable' framework, Neutron sure
# doesn't like when the plugin changes ;)
db.clear_db()
cfg.CONF.reset()
# Restore the original attribute map
attributes.RESOURCE_ATTRIBUTE_MAP = self._attribute_map_bk
- super(QuantumDbPluginV2TestCase, self).tearDown()
+ super(NeutronDbPluginV2TestCase, self).tearDown()
def _req(self, method, resource, data=None, fmt=None, id=None, params=None,
action=None, subresource=None, sub_id=None):
kwargs['set_context'] is True and
'tenant_id' in kwargs):
# create a specific auth context for this request
- req.environ['quantum.context'] = context.Context(
+ req.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
elif 'context' in kwargs:
- req.environ['quantum.context'] = kwargs['context']
+ req.environ['neutron.context'] = kwargs['context']
return req.get_response(self.api)
def _create_bulk(self, fmt, number, resource, data, name='test', **kwargs):
kwargs['set_context'] is True and
'tenant_id' in kwargs):
# create a specific auth context for this request
- req.environ['quantum.context'] = context.Context(
+ req.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
elif 'context' in kwargs:
- req.environ['quantum.context'] = kwargs['context']
+ req.environ['neutron.context'] = kwargs['context']
return req.get_response(self.api)
def _create_network(self, fmt, name, admin_state_up,
network_req = self.new_create_request('networks', data, fmt)
if (kwargs.get('set_context') and 'tenant_id' in kwargs):
# create a specific auth context for this request
- network_req.environ['quantum.context'] = context.Context(
+ network_req.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
return network_req.get_response(self.api)
subnet_req = self.new_create_request('subnets', data, fmt)
if (kwargs.get('set_context') and 'tenant_id' in kwargs):
# create a specific auth context for this request
- subnet_req.environ['quantum.context'] = context.Context(
+ subnet_req.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
subnet_res = subnet_req.get_response(self.api)
port_req = self.new_create_request('ports', data, fmt)
if (kwargs.get('set_context') and 'tenant_id' in kwargs):
# create a specific auth context for this request
- port_req.environ['quantum.context'] = context.Context(
+ port_req.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
port_res = port_req.get_response(self.api)
kwargs['set_context'] is True and
'tenant_id' in kwargs):
# create a specific auth context for this request
- port_req.environ['quantum.context'] = context.Context(
+ port_req.environ['neutron.context'] = context.Context(
'', kwargs['tenant_id'])
port_res = port_req.get_response(self.api)
def _delete(self, collection, id,
expected_code=webob.exc.HTTPNoContent.code,
- quantum_context=None):
+ neutron_context=None):
req = self.new_delete_request(collection, id)
- if quantum_context:
+ if neutron_context:
# create a specific auth context for this request
- req.environ['quantum.context'] = quantum_context
+ req.environ['neutron.context'] = neutron_context
res = req.get_response(self._api_for_resource(collection))
self.assertEqual(res.status_int, expected_code)
def _show(self, resource, id,
expected_code=webob.exc.HTTPOk.code,
- quantum_context=None):
+ neutron_context=None):
req = self.new_show_request(resource, id)
- if quantum_context:
+ if neutron_context:
# create a specific auth context for this request
- req.environ['quantum.context'] = quantum_context
+ req.environ['neutron.context'] = neutron_context
res = req.get_response(self._api_for_resource(resource))
self.assertEqual(res.status_int, expected_code)
return self.deserialize(self.fmt, res)
def _update(self, resource, id, new_data,
expected_code=webob.exc.HTTPOk.code,
- quantum_context=None):
+ neutron_context=None):
req = self.new_update_request(resource, new_data, id)
- if quantum_context:
+ if neutron_context:
# create a specific auth context for this request
- req.environ['quantum.context'] = quantum_context
+ req.environ['neutron.context'] = neutron_context
res = req.get_response(self._api_for_resource(resource))
self.assertEqual(res.status_int, expected_code)
return self.deserialize(self.fmt, res)
- def _list(self, resource, fmt=None, quantum_context=None,
+ def _list(self, resource, fmt=None, neutron_context=None,
query_params=None):
fmt = fmt or self.fmt
req = self.new_list_request(resource, fmt, query_params)
- if quantum_context:
- req.environ['quantum.context'] = quantum_context
+ if neutron_context:
+ req.environ['neutron.context'] = neutron_context
res = req.get_response(self._api_for_resource(resource))
self.assertEqual(res.status_int, webob.exc.HTTPOk.code)
return self.deserialize(fmt, res)
def _do_side_effect(self, patched_plugin, orig, *args, **kwargs):
"""Invoked by test cases for injecting failures in plugin."""
def second_call(*args, **kwargs):
- raise q_exc.QuantumException
+ raise q_exc.NeutronException
patched_plugin.side_effect = second_call
return orig(*args, **kwargs)
self.assertEqual(items[0]['name'], 'test_0')
self.assertEqual(items[1]['name'], 'test_1')
- def _test_list_resources(self, resource, items, quantum_context=None,
+ def _test_list_resources(self, resource, items, neutron_context=None,
query_params=None):
res = self._list('%ss' % resource,
- quantum_context=quantum_context,
+ neutron_context=neutron_context,
query_params=query_params)
resource = resource.replace('-', '_')
self.assertEqual(sorted([i['id'] for i in res['%ss' % resource]]),
sorted(expected_res))
-class TestBasicGet(QuantumDbPluginV2TestCase):
+class TestBasicGet(NeutronDbPluginV2TestCase):
def test_single_get_admin(self):
- plugin = quantum.db.db_base_plugin_v2.QuantumDbPluginV2()
+ plugin = neutron.db.db_base_plugin_v2.NeutronDbPluginV2()
with self.network() as network:
net_id = network['network']['id']
ctx = context.get_admin_context()
self.assertEqual(net_id, n.id)
def test_single_get_tenant(self):
- plugin = quantum.db.db_base_plugin_v2.QuantumDbPluginV2()
+ plugin = neutron.db.db_base_plugin_v2.NeutronDbPluginV2()
with self.network() as network:
net_id = network['network']['id']
ctx = context.get_admin_context()
self.assertEqual(net_id, n.id)
-class TestV2HTTPResponse(QuantumDbPluginV2TestCase):
+class TestV2HTTPResponse(NeutronDbPluginV2TestCase):
def test_create_returns_201(self):
res = self._create_network(self.fmt, 'net2', True)
self.assertEqual(res.status_int, 201)
tenant_id=tenant_id,
set_context=True)
req = self.new_list_request('networks', params="fields=name")
- req.environ['quantum.context'] = context.Context('', tenant_id)
+ req.environ['neutron.context'] = context.Context('', tenant_id)
res = req.get_response(self.api)
self._check_list_with_fields(res, 'name')
tenant_id=tenant_id,
set_context=True)
req = self.new_list_request('networks', params="fields=tenant_id")
- req.environ['quantum.context'] = context.Context('', tenant_id)
+ req.environ['neutron.context'] = context.Context('', tenant_id)
res = req.get_response(self.api)
self._check_list_with_fields(res, 'tenant_id')
self.assertEqual(res.status_int, 404)
-class TestPortsV2(QuantumDbPluginV2TestCase):
+class TestPortsV2(NeutronDbPluginV2TestCase):
def test_create_port_json(self):
keys = [('admin_state_up', True), ('status', self.port_create_status)]
with self.port(name='myname') as port:
with mock.patch('__builtin__.hasattr',
new=fakehasattr):
- orig = QuantumManager.get_plugin().create_port
- with mock.patch.object(QuantumManager.get_plugin(),
+ orig = NeutronManager.get_plugin().create_port
+ with mock.patch.object(NeutronManager.get_plugin(),
'create_port') as patched_plugin:
def side_effect(*args, **kwargs):
self.skipTest("Plugin does not support native bulk port create")
ctx = context.get_admin_context()
with self.network() as net:
- orig = QuantumManager._instance.plugin.create_port
- with mock.patch.object(QuantumManager._instance.plugin,
+ orig = NeutronManager._instance.plugin.create_port
+ with mock.patch.object(NeutronManager._instance.plugin,
'create_port') as patched_plugin:
def side_effect(*args, **kwargs):
# Tenant_1 request - must return single port
q_context = context.Context('', 'tenant_1')
self._test_list_resources('port', [port1],
- quantum_context=q_context)
+ neutron_context=q_context)
# Tenant_2 request - must return single port
q_context = context.Context('', 'tenant_2')
self._test_list_resources('port', [port2],
- quantum_context=q_context)
+ neutron_context=q_context)
def test_list_ports_with_sort_native(self):
if self._skip_native_sorting:
def test_list_ports_with_sort_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_sorting_helper',
+ 'neutron.api.v2.base.Controller._get_sorting_helper',
new=_fake_get_sorting_helper)
helper_patcher.start()
try:
def test_list_ports_with_pagination_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_pagination_helper',
+ 'neutron.api.v2.base.Controller._get_pagination_helper',
new=_fake_get_pagination_helper)
helper_patcher.start()
try:
def test_list_ports_with_pagination_reverse_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_pagination_helper',
+ 'neutron.api.v2.base.Controller._get_pagination_helper',
new=_fake_get_pagination_helper)
helper_patcher.start()
try:
tenant_id='not_admin', set_context=True)
port = self.deserialize(self.fmt, res)
data = {'port': {'admin_state_up': False}}
- quantum_context = context.Context('', 'not_admin')
+ neutron_context = context.Context('', 'not_admin')
port = self._update('ports', port['port']['id'], data,
- quantum_context=quantum_context)
+ neutron_context=neutron_context)
self.assertEqual(port['port']['admin_state_up'], False)
def test_update_device_id_null(self):
res = self._create_port(self.fmt, id)
data = self.deserialize(self.fmt, res)
msg = str(q_exc.IpAddressGenerationFailure(net_id=id))
- self.assertEqual(data['QuantumError'], msg)
+ self.assertEqual(data['NeutronError'], msg)
self.assertEqual(res.status_int, 409)
def test_update_port_update_ip(self):
def fake_gen_mac(context, net_id):
raise q_exc.MacAddressGenerationFailure(net_id=net_id)
- with mock.patch.object(quantum.db.db_base_plugin_v2.QuantumDbPluginV2,
+ with mock.patch.object(neutron.db.db_base_plugin_v2.NeutronDbPluginV2,
'_generate_mac', new=fake_gen_mac):
res = self._create_network(fmt=self.fmt, name='net1',
admin_state_up=True)
with mock.patch.object(timeutils, 'utcnow') as mock_utcnow:
mock_utcnow.return_value = reference
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
expires = plugin._default_allocation_expiration()
self.assertEqual(expires,
reference + datetime.timedelta(seconds=120))
def test_update_fixed_ip_lease_expiration(self):
cfg.CONF.set_override('dhcp_lease_duration', 10)
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
with self.subnet() as subnet:
with self.port(subnet=subnet) as port:
update_context = context.Context('', port['port']['tenant_id'])
matchers.GreaterThan(datetime.timedelta(seconds=10)))
def test_port_delete_holds_ip(self):
- base_class = db_base_plugin_v2.QuantumDbPluginV2
+ base_class = db_base_plugin_v2.NeutronDbPluginV2
with mock.patch.object(base_class, '_hold_ip') as hold_ip:
with self.subnet() as subnet:
with self.port(subnet=subnet, no_delete=True) as port:
def test_update_fixed_ip_lease_expiration_invalid_address(self):
cfg.CONF.set_override('dhcp_lease_duration', 10)
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
with self.subnet() as subnet:
with self.port(subnet=subnet) as port:
update_context = context.Context('', port['port']['tenant_id'])
self.assertTrue(log.mock_calls)
def test_hold_ip_address(self):
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
with self.subnet() as subnet:
with self.port(subnet=subnet) as port:
update_context = context.Context('', port['port']['tenant_id'])
self.assertEqual(q.count(), 1)
def test_recycle_held_ip_address(self):
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
with self.subnet() as subnet:
with self.port(subnet=subnet) as port:
update_context = context.Context('', port['port']['tenant_id'])
set([subnet['subnet']['network_id']]))
def test_recycle_expired_previously_run_within_context(self):
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
with self.subnet() as subnet:
with self.port(subnet=subnet) as port:
update_context = context.Context('', port['port']['tenant_id'])
self.assertEqual(res.status_int, 400)
-class TestNetworksV2(QuantumDbPluginV2TestCase):
+class TestNetworksV2(NeutronDbPluginV2TestCase):
# NOTE(cerberus): successful network update and delete are
# effectively tested above
def test_create_network(self):
req = self.new_update_request('networks',
data,
network['network']['id'])
- req.environ['quantum.context'] = context.Context('', 'somebody')
+ req.environ['neutron.context'] = context.Context('', 'somebody')
res = req.get_response(self.api)
# The API layer always returns 404 on updates in place of 403
self.assertEqual(res.status_int, 404)
# must query db to see whether subnet's shared attribute
# has been updated or not
ctx = context.Context('', '', is_admin=True)
- subnet_db = QuantumManager.get_plugin()._get_subnet(
+ subnet_db = NeutronManager.get_plugin()._get_subnet(
ctx, subnet['subnet']['id'])
self.assertEqual(subnet_db['shared'], True)
return False
return real_has_attr(item, attr)
- orig = QuantumManager.get_plugin().create_network
+ orig = NeutronManager.get_plugin().create_network
#ensures the API choose the emulation code path
with mock.patch('__builtin__.hasattr',
new=fakehasattr):
- with mock.patch.object(QuantumManager.get_plugin(),
+ with mock.patch.object(NeutronManager.get_plugin(),
'create_network') as patched_plugin:
def side_effect(*args, **kwargs):
def test_create_networks_bulk_native_plugin_failure(self):
if self._skip_native_bulk:
self.skipTest("Plugin does not support native bulk network create")
- orig = QuantumManager.get_plugin().create_network
- with mock.patch.object(QuantumManager.get_plugin(),
+ orig = NeutronManager.get_plugin().create_network
+ with mock.patch.object(NeutronManager.get_plugin(),
'create_network') as patched_plugin:
def side_effect(*args, **kwargs):
def test_list_networks_with_sort_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_sorting_helper',
+ 'neutron.api.v2.base.Controller._get_sorting_helper',
new=_fake_get_sorting_helper)
helper_patcher.start()
try:
def test_list_networks_with_pagination_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_pagination_helper',
+ 'neutron.api.v2.base.Controller._get_pagination_helper',
new=_fake_get_pagination_helper)
helper_patcher.start()
try:
def test_list_networks_without_pk_in_fields_pagination_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_pagination_helper',
+ 'neutron.api.v2.base.Controller._get_pagination_helper',
new=_fake_get_pagination_helper)
helper_patcher.start()
try:
def test_list_networks_with_pagination_reverse_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_pagination_helper',
+ 'neutron.api.v2.base.Controller._get_pagination_helper',
new=_fake_get_pagination_helper)
helper_patcher.start()
try:
self.assertEqual(res['network']['admin_state_up'], v[1])
-class TestSubnetsV2(QuantumDbPluginV2TestCase):
+class TestSubnetsV2(NeutronDbPluginV2TestCase):
def _test_create_subnet(self, network=None, expected=None, **kwargs):
keys = kwargs.copy()
with mock.patch('__builtin__.hasattr',
new=fakehasattr):
- orig = QuantumManager.get_plugin().create_subnet
- with mock.patch.object(QuantumManager.get_plugin(),
+ orig = NeutronManager.get_plugin().create_subnet
+ with mock.patch.object(NeutronManager.get_plugin(),
'create_subnet') as patched_plugin:
def side_effect(*args, **kwargs):
def test_create_subnets_bulk_native_plugin_failure(self):
if self._skip_native_bulk:
self.skipTest("Plugin does not support native bulk subnet create")
- orig = QuantumManager._instance.plugin.create_subnet
- with mock.patch.object(QuantumManager._instance.plugin,
+ orig = NeutronManager._instance.plugin.create_subnet
+ with mock.patch.object(NeutronManager._instance.plugin,
'create_subnet') as patched_plugin:
def side_effect(*args, **kwargs):
return self._do_side_effect(patched_plugin, orig,
data = self.deserialize(self.fmt, res)
self.assertEqual(res.status_int, 409)
msg = str(q_exc.SubnetInUse(subnet_id=id))
- self.assertEqual(data['QuantumError'], msg)
+ self.assertEqual(data['NeutronError'], msg)
def test_delete_network(self):
gateway_ip = '10.0.0.1'
with self.subnet(cidr='10.0.1.0/24') as priv_subnet:
# normal user should see only 1 subnet
req = self.new_list_request('subnets')
- req.environ['quantum.context'] = context.Context(
+ req.environ['neutron.context'] = context.Context(
'', 'some_tenant')
res = self.deserialize(self.fmt,
req.get_response(self.api))
def test_list_subnets_with_sort_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_sorting_helper',
+ 'neutron.api.v2.base.Controller._get_sorting_helper',
new=_fake_get_sorting_helper)
helper_patcher.start()
try:
def test_list_subnets_with_pagination_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_pagination_helper',
+ 'neutron.api.v2.base.Controller._get_pagination_helper',
new=_fake_get_pagination_helper)
helper_patcher.start()
try:
def test_list_subnets_with_pagination_reverse_emulated(self):
helper_patcher = mock.patch(
- 'quantum.api.v2.base.Controller._get_pagination_helper',
+ 'neutron.api.v2.base.Controller._get_pagination_helper',
new=_fake_get_pagination_helper)
helper_patcher.start()
try:
network = models_v2.Network(name="net_net", status="OK",
admin_state_up=True)
actual_repr_output = repr(network)
- exp_start_with = "<quantum.db.models_v2.Network"
+ exp_start_with = "<neutron.db.models_v2.Network"
exp_middle = "[object at %x]" % id(network)
exp_end_with = (" {tenant_id=None, id=None, "
"name='net_net', status='OK', "
import mock
-from quantum.db import dhcp_rpc_base
-from quantum.tests import base
+from neutron.db import dhcp_rpc_base
+from neutron.tests import base
class TestDhcpRpcCallackMixin(base.BaseTestCase):
def setUp(self):
super(TestDhcpRpcCallackMixin, self).setUp()
- self.plugin_p = mock.patch('quantum.manager.QuantumManager.get_plugin')
+ self.plugin_p = mock.patch('neutron.manager.NeutronManager.get_plugin')
get_plugin = self.plugin_p.start()
self.plugin = mock.MagicMock()
get_plugin.return_value = self.plugin
self.callbacks = dhcp_rpc_base.DhcpRpcCallbackMixin()
- self.log_p = mock.patch('quantum.db.dhcp_rpc_base.LOG')
+ self.log_p = mock.patch('neutron.db.dhcp_rpc_base.LOG')
self.log = self.log_p.start()
def tearDown(self):
import mock
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.linux import interface
-from quantum.debug import commands
-from quantum.debug.debug_agent import DEVICE_OWNER_COMPUTE_PROBE
-from quantum.debug.debug_agent import DEVICE_OWNER_NETWORK_PROBE
-from quantum.debug.debug_agent import QuantumDebugAgent
-from quantum.tests import base
+from neutron.agent.common import config
+from neutron.agent.linux import interface
+from neutron.debug import commands
+from neutron.debug.debug_agent import DEVICE_OWNER_COMPUTE_PROBE
+from neutron.debug.debug_agent import DEVICE_OWNER_NETWORK_PROBE
+from neutron.debug.debug_agent import NeutronDebugAgent
+from neutron.tests import base
class MyApp(object):
def setUp(self):
super(TestDebugCommands, self).setUp()
cfg.CONF.register_opts(interface.OPTS)
- cfg.CONF.register_opts(QuantumDebugAgent.OPTS)
- cfg.CONF(args=[], project='quantum')
+ cfg.CONF.register_opts(NeutronDebugAgent.OPTS)
+ cfg.CONF(args=[], project='neutron')
cfg.CONF.set_override('use_namespaces', True)
config.register_root_helper(cfg.CONF)
self.addCleanup(mock.patch.stopall)
device_exists_p = mock.patch(
- 'quantum.agent.linux.ip_lib.device_exists', return_value=False)
+ 'neutron.agent.linux.ip_lib.device_exists', return_value=False)
device_exists_p.start()
namespace_p = mock.patch(
- 'quantum.agent.linux.ip_lib.IpNetnsCommand')
+ 'neutron.agent.linux.ip_lib.IpNetnsCommand')
namespace_p.start()
ensure_namespace_p = mock.patch(
- 'quantum.agent.linux.ip_lib.IPWrapper.ensure_namespace')
+ 'neutron.agent.linux.ip_lib.IPWrapper.ensure_namespace')
ensure_namespace_p.start()
- dvr_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver')
+ dvr_cls_p = mock.patch('neutron.agent.linux.interface.NullDriver')
driver_cls = dvr_cls_p.start()
mock_driver = mock.MagicMock()
mock_driver.DEV_NAME_LEN = (
driver_cls.return_value = mock_driver
self.driver = mock_driver
- client_cls_p = mock.patch('quantumclient.v2_0.client.Client')
+ client_cls_p = mock.patch('neutronclient.v2_0.client.Client')
client_cls = client_cls_p.start()
client_inst = mock.Mock()
client_cls.return_value = client_inst
self.client = client_inst
mock_std = mock.Mock()
self.app = MyApp(mock_std)
- self.app.debug_agent = QuantumDebugAgent(cfg.CONF,
+ self.app.debug_agent = NeutronDebugAgent(cfg.CONF,
client_inst,
mock_driver)
cmd_parser = cmd.get_parser('exec_command')
args = ['fake_port', 'fake_command']
parsed_args = cmd_parser.parse_args(args)
- with mock.patch('quantum.agent.linux.ip_lib.IpNetnsCommand') as ns:
+ with mock.patch('neutron.agent.linux.ip_lib.IpNetnsCommand') as ns:
cmd.run(parsed_args)
ns.assert_has_calls([mock.call.execute(mock.ANY)])
self.client.assert_has_calls([mock.call.show_port('fake_port')])
cmd_parser = cmd.get_parser('exec_command')
args = ['fake_port', 'fake_command']
parsed_args = cmd_parser.parse_args(args)
- with mock.patch('quantum.agent.linux.utils.execute') as exe:
+ with mock.patch('neutron.agent.linux.utils.execute') as exe:
cmd.run(parsed_args)
exe.assert_has_calls([mock.call.execute(mock.ANY)])
self.client.assert_has_calls([mock.call.show_port('fake_port')])
args = []
parsed_args = cmd_parser.parse_args(args)
namespace = 'qprobe-fake_port'
- with mock.patch('quantum.agent.linux.ip_lib.IpNetnsCommand') as ns:
+ with mock.patch('neutron.agent.linux.ip_lib.IpNetnsCommand') as ns:
cmd.run(parsed_args)
ns.assert_has_calls([mock.call.execute(mock.ANY)])
fake_port = {'port':
cmd_parser = cmd.get_parser('ping_all')
args = []
parsed_args = cmd_parser.parse_args(args)
- with mock.patch('quantum.agent.linux.ip_lib.IpNetnsCommand') as ns:
+ with mock.patch('neutron.agent.linux.ip_lib.IpNetnsCommand') as ns:
cmd.run(parsed_args)
ns.assert_has_calls([mock.call.execute(mock.ANY)])
expected = [mock.call.list_ports(),
cmd_parser = cmd.get_parser('ping_all')
args = []
parsed_args = cmd_parser.parse_args(args)
- with mock.patch('quantum.agent.linux.ip_lib.IpNetnsCommand') as ns:
+ with mock.patch('neutron.agent.linux.ip_lib.IpNetnsCommand') as ns:
cmd.run(parsed_args)
ns.assert_has_calls([mock.call.execute(mock.ANY)])
self.client.assert_has_calls([mock.call.list_ports()])
from oslo.config import cfg
import testtools
-from quantum.agent.common import config
-from quantum.agent import dhcp_agent
-from quantum.agent.dhcp_agent import DhcpAgentWithStateReport
-from quantum.agent.linux import dhcp
-from quantum.agent.linux import interface
-from quantum.common import constants
-from quantum.common import exceptions
-from quantum.openstack.common import jsonutils
-from quantum.tests import base
+from neutron.agent.common import config
+from neutron.agent import dhcp_agent
+from neutron.agent.dhcp_agent import DhcpAgentWithStateReport
+from neutron.agent.linux import dhcp
+from neutron.agent.linux import interface
+from neutron.common import constants
+from neutron.common import exceptions
+from neutron.openstack.common import jsonutils
+from neutron.tests import base
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
super(TestDhcpAgent, self).setUp()
dhcp_agent.register_options()
cfg.CONF.set_override('interface_driver',
- 'quantum.agent.linux.interface.NullDriver')
+ 'neutron.agent.linux.interface.NullDriver')
self.driver_cls_p = mock.patch(
- 'quantum.agent.dhcp_agent.importutils.import_class')
+ 'neutron.agent.dhcp_agent.importutils.import_class')
self.driver = mock.Mock(name='driver')
self.driver.existing_dhcp_networks.return_value = []
self.driver_cls = self.driver_cls_p.start()
super(TestDhcpAgent, self).tearDown()
def test_dhcp_agent_manager(self):
- state_rpc_str = 'quantum.agent.rpc.PluginReportStateAPI'
- lease_relay_str = 'quantum.agent.dhcp_agent.DhcpLeaseRelay'
+ state_rpc_str = 'neutron.agent.rpc.PluginReportStateAPI'
+ lease_relay_str = 'neutron.agent.dhcp_agent.DhcpLeaseRelay'
with mock.patch.object(DhcpAgentWithStateReport,
'sync_state',
autospec=True) as mock_sync_state:
with mock.patch.object(sys, 'argv') as sys_argv:
sys_argv.return_value = [
'dhcp', '--config-file',
- etcdir('quantum.conf.test')]
+ etcdir('neutron.conf.test')]
cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
config.register_agent_state_opts_helper(cfg.CONF)
config.register_root_helper(cfg.CONF)
dhcp_agent.DhcpLeaseRelay.OPTS)
cfg.CONF.register_opts(dhcp.OPTS)
cfg.CONF.register_opts(interface.OPTS)
- cfg.CONF(project='quantum')
+ cfg.CONF(project='neutron')
agent_mgr = DhcpAgentWithStateReport('testhost')
eventlet.greenthread.sleep(1)
agent_mgr.after_start()
mock.call().start()])
def test_dhcp_agent_main_agent_manager(self):
- logging_str = 'quantum.agent.common.config.setup_logging'
- launcher_str = 'quantum.openstack.common.service.ServiceLauncher'
+ logging_str = 'neutron.agent.common.config.setup_logging'
+ launcher_str = 'neutron.openstack.common.service.ServiceLauncher'
with mock.patch(logging_str):
with mock.patch.object(sys, 'argv') as sys_argv:
with mock.patch(launcher_str) as launcher:
sys_argv.return_value = ['dhcp', '--config-file',
- etcdir('quantum.conf.test')]
+ etcdir('neutron.conf.test')]
dhcp_agent.main()
launcher.assert_has_calls(
[mock.call(), mock.call().launch_service(mock.ANY),
mock.call().wait()])
def test_run_completes_single_pass(self):
- with mock.patch('quantum.agent.dhcp_agent.DeviceManager'):
+ with mock.patch('neutron.agent.dhcp_agent.DeviceManager'):
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
attrs_to_mock = dict(
[(a, mock.DEFAULT) for a in
[mock.call.start()])
def test_ns_name(self):
- with mock.patch('quantum.agent.dhcp_agent.DeviceManager'):
+ with mock.patch('neutron.agent.dhcp_agent.DeviceManager'):
mock_net = mock.Mock(id='foo')
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
self.assertEqual(dhcp._ns_name(mock_net), 'qdhcp-foo')
def test_ns_name_disabled_namespace(self):
- with mock.patch('quantum.agent.dhcp_agent.DeviceManager'):
+ with mock.patch('neutron.agent.dhcp_agent.DeviceManager'):
cfg.CONF.set_override('use_namespaces', False)
mock_net = mock.Mock(id='foo')
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
def test_call_driver(self):
network = mock.Mock()
network.id = '1'
- with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:
+ with mock.patch('neutron.agent.dhcp_agent.DeviceManager') as dev_mgr:
dhcp = dhcp_agent.DhcpAgent(cfg.CONF)
self.assertTrue(dhcp.call_driver('foo', network))
self.assertTrue(dev_mgr.called)
network = mock.Mock()
network.id = '1'
self.driver.return_value.foo.side_effect = Exception
- with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:
+ with mock.patch('neutron.agent.dhcp_agent.DeviceManager') as dev_mgr:
with mock.patch.object(dhcp_agent.LOG, 'exception') as log:
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
self.assertIsNone(dhcp.call_driver('foo', network))
self.assertTrue(dhcp.needs_resync)
def test_update_lease(self):
- with mock.patch('quantum.agent.dhcp_agent.DhcpPluginApi') as plug:
+ with mock.patch('neutron.agent.dhcp_agent.DhcpPluginApi') as plug:
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
dhcp.update_lease('net_id', '192.168.1.1', 120)
plug.assert_has_calls(
'net_id', '192.168.1.1', 120)])
def test_update_lease_failure(self):
- with mock.patch('quantum.agent.dhcp_agent.DhcpPluginApi') as plug:
+ with mock.patch('neutron.agent.dhcp_agent.DhcpPluginApi') as plug:
plug.return_value.update_lease_expiration.side_effect = Exception
with mock.patch.object(dhcp_agent.LOG, 'exception') as log:
self.assertTrue(dhcp.needs_resync)
def _test_sync_state_helper(self, known_networks, active_networks):
- with mock.patch('quantum.agent.dhcp_agent.DhcpPluginApi') as plug:
+ with mock.patch('neutron.agent.dhcp_agent.DhcpPluginApi') as plug:
mock_plugin = mock.Mock()
mock_plugin.get_active_networks.return_value = active_networks
plug.return_value = mock_plugin
self._test_sync_state_helper(['b'], ['a'])
def test_sync_state_plugin_error(self):
- with mock.patch('quantum.agent.dhcp_agent.DhcpPluginApi') as plug:
+ with mock.patch('neutron.agent.dhcp_agent.DhcpPluginApi') as plug:
mock_plugin = mock.Mock()
mock_plugin.get_active_networks.side_effect = Exception
plug.return_value = mock_plugin
cfg.CONF.register_opts(dhcp_agent.DhcpLeaseRelay.OPTS)
cfg.CONF.register_opts(dhcp.OPTS)
cfg.CONF.set_override('interface_driver',
- 'quantum.agent.linux.interface.NullDriver')
+ 'neutron.agent.linux.interface.NullDriver')
config.register_root_helper(cfg.CONF)
cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
- self.plugin_p = mock.patch('quantum.agent.dhcp_agent.DhcpPluginApi')
+ self.plugin_p = mock.patch('neutron.agent.dhcp_agent.DhcpPluginApi')
plugin_cls = self.plugin_p.start()
self.plugin = mock.Mock()
plugin_cls.return_value = self.plugin
- self.cache_p = mock.patch('quantum.agent.dhcp_agent.NetworkCache')
+ self.cache_p = mock.patch('neutron.agent.dhcp_agent.NetworkCache')
cache_cls = self.cache_p.start()
self.cache = mock.Mock()
cache_cls.return_value = self.cache
self.call_driver = self.call_driver_p.start()
self.external_process_p = mock.patch(
- 'quantum.agent.linux.external_process.ProcessManager'
+ 'neutron.agent.linux.external_process.ProcessManager'
)
self.external_process = self.external_process_p.start()
self._disable_dhcp_helper_driver_failure()
def test_enable_isolated_metadata_proxy(self):
- class_path = 'quantum.agent.linux.external_process.ProcessManager'
+ class_path = 'neutron.agent.linux.external_process.ProcessManager'
with mock.patch(class_path) as ext_process:
self.dhcp.enable_isolated_metadata_proxy(fake_network)
ext_process.assert_has_calls([
])
def test_disable_isolated_metadata_proxy(self):
- class_path = 'quantum.agent.linux.external_process.ProcessManager'
+ class_path = 'neutron.agent.linux.external_process.ProcessManager'
with mock.patch(class_path) as ext_process:
self.dhcp.disable_isolated_metadata_proxy(fake_network)
ext_process.assert_has_calls([
cfg.CONF.set_override('enable_metadata_network', True)
cfg.CONF.set_override('debug', True)
cfg.CONF.set_override('log_file', 'test.log')
- class_path = 'quantum.agent.linux.ip_lib.IPWrapper'
+ class_path = 'neutron.agent.linux.ip_lib.IPWrapper'
self.external_process_p.stop()
# Ensure the mock is restored if this test fail
try:
'sudo',
'qdhcp-12345678-1234-5678-1234567890ab'),
mock.call().netns.execute([
- 'quantum-ns-metadata-proxy',
+ 'neutron-ns-metadata-proxy',
mock.ANY,
'--router_id=forzanapoli',
mock.ANY,
mock.ANY,
'--debug',
- ('--log-file=quantum-ns-metadata-proxy-%s.log' %
+ ('--log-file=neutron-ns-metadata-proxy-%s.log' %
fake_meta_network.id)])
])
finally:
cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
cfg.CONF.set_override('interface_driver',
- 'quantum.agent.linux.interface.NullDriver')
+ 'neutron.agent.linux.interface.NullDriver')
config.register_root_helper(cfg.CONF)
cfg.CONF.set_override('use_namespaces', True)
cfg.CONF.set_override('enable_isolated_metadata', True)
self.device_exists_p = mock.patch(
- 'quantum.agent.linux.ip_lib.device_exists')
+ 'neutron.agent.linux.ip_lib.device_exists')
self.device_exists = self.device_exists_p.start()
- self.dvr_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver')
- self.iproute_cls_p = mock.patch('quantum.agent.linux.'
+ self.dvr_cls_p = mock.patch('neutron.agent.linux.interface.NullDriver')
+ self.iproute_cls_p = mock.patch('neutron.agent.linux.'
'ip_lib.IpRouteCommand')
driver_cls = self.dvr_cls_p.start()
iproute_cls = self.iproute_cls_p.start()
fake_port = FakeModel('12345678-1234-aaaa-1234567890ab',
mac_address='aa:bb:cc:dd:ee:ff')
- with mock.patch('quantum.agent.linux.interface.NullDriver') as dvr_cls:
+ with mock.patch('neutron.agent.linux.interface.NullDriver') as dvr_cls:
mock_driver = mock.MagicMock()
#mock_driver.DEV_NAME_LEN = (
# interface.LinuxInterfaceDriver.DEV_NAME_LEN)
fake_port = FakeModel('12345678-1234-aaaa-1234567890ab',
mac_address='aa:bb:cc:dd:ee:ff')
- with mock.patch('quantum.agent.linux.interface.NullDriver') as dvr_cls:
+ with mock.patch('neutron.agent.linux.interface.NullDriver') as dvr_cls:
mock_driver = mock.MagicMock()
mock_driver.get_device_name.return_value = 'tap12345678-12'
dvr_cls.return_value = mock_driver
fake_port = FakeModel('12345678-1234-aaaa-1234567890ab',
mac_address='aa:bb:cc:dd:ee:ff')
- with mock.patch('quantum.agent.linux.interface.NullDriver') as dvr_cls:
+ with mock.patch('neutron.agent.linux.interface.NullDriver') as dvr_cls:
mock_driver = mock.MagicMock()
mock_driver.get_device_name.return_value = 'tap12345678-12'
dvr_cls.return_value = mock_driver
relay = dhcp_agent.DhcpLeaseRelay(handler)
- with mock.patch('quantum.openstack.common.'
+ with mock.patch('neutron.openstack.common.'
'uuidutils.is_uuid_like') as validate:
validate.return_value = False
from oslo.config import cfg
from webob import exc
-from quantum.common import constants
-from quantum.common.test_lib import test_config
-from quantum.db import api as db_api
-from quantum.db import l3_db
-from quantum.db import l3_gwmode_db
-from quantum.db import models_v2
-from quantum.extensions import l3
-from quantum.extensions import l3_ext_gw_mode
-from quantum.openstack.common import uuidutils
-from quantum.tests import base
-from quantum.tests.unit import test_db_plugin
-from quantum.tests.unit import test_l3_plugin
+from neutron.common import constants
+from neutron.common.test_lib import test_config
+from neutron.db import api as db_api
+from neutron.db import l3_db
+from neutron.db import l3_gwmode_db
+from neutron.db import models_v2
+from neutron.extensions import l3
+from neutron.extensions import l3_ext_gw_mode
+from neutron.openstack.common import uuidutils
+from neutron.tests import base
+from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit import test_l3_plugin
_uuid = uuidutils.generate_uuid
FAKE_GW_PORT_ID = _uuid()
self.stubs = stubout_fixture.stubs
self.target_object = TestDbPlugin()
# Patch the context
- ctx_patcher = mock.patch('quantum.context', autospec=True)
+ ctx_patcher = mock.patch('neutron.context', autospec=True)
mock_context = ctx_patcher.start()
self.addCleanup(db_api.clear_db)
self.addCleanup(ctx_patcher.stop)
self.assertFalse(router.get('enable_snat'))
-class ExtGwModeTestCase(test_db_plugin.QuantumDbPluginV2TestCase,
+class ExtGwModeTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
test_l3_plugin.L3NatTestCaseMixin):
def setUp(self):
self._l3_attribute_map_bk[item] = (
l3.RESOURCE_ATTRIBUTE_MAP[item].copy())
test_config['plugin_name_v2'] = (
- 'quantum.tests.unit.test_extension_ext_gw_mode.TestDbPlugin')
+ 'neutron.tests.unit.test_extension_ext_gw_mode.TestDbPlugin')
test_config['extension_manager'] = TestExtensionManager()
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
def _set_router_external_gateway(self, router_id, network_id,
snat_enabled=None,
expected_code=exc.HTTPOk.code,
- quantum_context=None):
+ neutron_context=None):
ext_gw_info = {'network_id': network_id}
if snat_enabled in (True, False):
ext_gw_info['enable_snat'] = snat_enabled
{'router': {'external_gateway_info':
ext_gw_info}},
expected_code=expected_code,
- quantum_context=quantum_context)
+ neutron_context=neutron_context)
def test_router_create_show_no_ext_gwinfo(self):
name = 'router1'
from oslo.config import cfg
import webob.exc as webexc
-import quantum
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.common import config
-from quantum import manager
-from quantum.plugins.common import constants
-from quantum.plugins.openvswitch import ovs_quantum_plugin
-from quantum.tests import base
-from quantum.tests.unit.extensions import extendedattribute as extattr
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import testlib_api
-from quantum import wsgi
+import neutron
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.common import config
+from neutron import manager
+from neutron.plugins.common import constants
+from neutron.plugins.openvswitch import ovs_neutron_plugin
+from neutron.tests import base
+from neutron.tests.unit.extensions import extendedattribute as extattr
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import testlib_api
+from neutron import wsgi
_uuid = test_api_v2._uuid
_get_path = test_api_v2._get_path
-extensions_path = ':'.join(quantum.tests.unit.extensions.__path__)
+extensions_path = ':'.join(neutron.tests.unit.extensions.__path__)
class ExtensionExtendedAttributeTestPlugin(
- ovs_quantum_plugin.OVSQuantumPluginV2):
+ ovs_neutron_plugin.OVSNeutronPluginV2):
supported_extension_aliases = [
'ext-obj-test', "extended-ext-attr"
def setUp(self):
super(ExtensionExtendedAttributeTestCase, self).setUp()
plugin = (
- "quantum.tests.unit.test_extension_extended_attribute."
+ "neutron.tests.unit.test_extension_extended_attribute."
"ExtensionExtendedAttributeTestPlugin"
)
- # point config file to: quantum/tests/etc/quantum.conf.test
- args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
+ # point config file to: neutron/tests/etc/neutron.conf.test
+ args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
cfg.CONF.set_override('core_plugin', plugin)
- manager.QuantumManager._instance = None
+ manager.NeutronManager._instance = None
ext_mgr = extensions.PluginAwareExtensionManager(
extensions_path,
# the global attribute map
attributes.RESOURCE_ATTRIBUTE_MAP.update(
extattr.EXTENDED_ATTRIBUTES_2_0)
- self.agentscheduler_dbMinxin = manager.QuantumManager.get_plugin()
+ self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin()
self.addCleanup(cfg.CONF.reset)
self.addCleanup(self.restore_attribute_map)
from oslo.config import cfg
from webob import exc
-from quantum.common.test_lib import test_config
-from quantum.db import extraroute_db
-from quantum.extensions import extraroute
-from quantum.extensions import l3
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.notifier import api as notifier_api
-from quantum.openstack.common.notifier import test_notifier
-from quantum.openstack.common import uuidutils
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_l3_plugin as test_l3
+from neutron.common.test_lib import test_config
+from neutron.db import extraroute_db
+from neutron.extensions import extraroute
+from neutron.extensions import l3
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.notifier import api as notifier_api
+from neutron.openstack.common.notifier import test_notifier
+from neutron.openstack.common import uuidutils
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_l3_plugin as test_l3
LOG = logging.getLogger(__name__)
def setUp(self):
test_config['plugin_name_v2'] = (
- 'quantum.tests.unit.'
+ 'neutron.tests.unit.'
'test_extension_extraroute.TestExtraRoutePlugin')
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
from webob import exc as web_exc
import webtest
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.api.v2 import router
-from quantum import context
-from quantum.extensions import providernet as pnet
-from quantum.manager import QuantumManager
-from quantum.openstack.common import uuidutils
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_extensions
-from quantum.tests.unit import testlib_api
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.api.v2 import router
+from neutron import context
+from neutron.extensions import providernet as pnet
+from neutron.manager import NeutronManager
+from neutron.openstack.common import uuidutils
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_extensions
+from neutron.tests.unit import testlib_api
class ProviderExtensionManager(object):
def setUp(self):
super(ProvidernetExtensionTestCase, self).setUp()
- plugin = 'quantum.quantum_plugin_base_v2.QuantumPluginBaseV2'
+ plugin = 'neutron.neutron_plugin_base_v2.NeutronPluginBaseV2'
# Ensure 'stale' patched copies of the plugin are never returned
- QuantumManager._instance = None
+ NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
instance = self.plugin.return_value
instance.get_networks_count.return_value = 1
# Instantiate mock plugin and enable the 'provider' extension
- QuantumManager.get_plugin().supported_extension_aliases = (
+ NeutronManager.get_plugin().supported_extension_aliases = (
["provider"])
ext_mgr = ProviderExtensionManager()
self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
def _put_network_with_provider_attrs(self, ctx, expect_errors=False):
data = self._prepare_net_data()
- env = {'quantum.context': ctx}
+ env = {'neutron.context': ctx}
instance = self.plugin.return_value
instance.get_network.return_value = {'tenant_id': ctx.tenant_id,
'shared': False}
def _post_network_with_provider_attrs(self, ctx, expect_errors=False):
data = self._prepare_net_data()
- env = {'quantum.context': ctx}
+ env = {'neutron.context': ctx}
res = self.api.post(test_api_v2._get_path('networks', fmt=self.fmt),
self.serialize({'network': data}),
content_type='application/' + self.fmt,
# limitations under the License.
-from quantum.api.v2 import attributes as attr
-from quantum.common.test_lib import test_config
-from quantum import context
-from quantum.db import db_base_plugin_v2
-from quantum.db import portsecurity_db
-from quantum.db import securitygroups_db
-from quantum.extensions import portsecurity as psec
-from quantum.extensions import securitygroup as ext_sg
-from quantum.manager import QuantumManager
-from quantum import policy
-from quantum.tests.unit import test_db_plugin
-
-DB_PLUGIN_KLASS = ('quantum.tests.unit.test_extension_portsecurity.'
+from neutron.api.v2 import attributes as attr
+from neutron.common.test_lib import test_config
+from neutron import context
+from neutron.db import db_base_plugin_v2
+from neutron.db import portsecurity_db
+from neutron.db import securitygroups_db
+from neutron.extensions import portsecurity as psec
+from neutron.extensions import securitygroup as ext_sg
+from neutron.manager import NeutronManager
+from neutron import policy
+from neutron.tests.unit import test_db_plugin
+
+DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_portsecurity.'
'PortSecurityTestPlugin')
-class PortSecurityTestCase(test_db_plugin.QuantumDbPluginV2TestCase):
+class PortSecurityTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
def setUp(self, plugin=None):
super(PortSecurityTestCase, self).setUp()
# Check if a plugin supports security groups
- plugin_obj = QuantumManager.get_plugin()
+ plugin_obj = NeutronManager.get_plugin()
self._skip_security_group = ('security-group' not in
plugin_obj.supported_extension_aliases)
self._skip_security_group = None
-class PortSecurityTestPlugin(db_base_plugin_v2.QuantumDbPluginV2,
+class PortSecurityTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
securitygroups_db.SecurityGroupDbMixin,
portsecurity_db.PortSecurityDbMixin):
tenant_id = self._get_tenant_id_for_create(context, network['network'])
self._ensure_default_security_group(context, tenant_id)
with context.session.begin(subtransactions=True):
- quantum_db = super(PortSecurityTestPlugin, self).create_network(
+ neutron_db = super(PortSecurityTestPlugin, self).create_network(
context, network)
- quantum_db.update(network['network'])
+ neutron_db.update(network['network'])
self._process_network_create_port_security(
- context, quantum_db)
- self._extend_network_port_security_dict(context, quantum_db)
- return quantum_db
+ context, neutron_db)
+ self._extend_network_port_security_dict(context, neutron_db)
+ return neutron_db
def update_network(self, context, id, network):
with context.session.begin(subtransactions=True):
- quantum_db = super(PortSecurityTestPlugin, self).update_network(
+ neutron_db = super(PortSecurityTestPlugin, self).update_network(
context, id, network)
if psec.PORTSECURITY in network['network']:
self._update_network_security_binding(
context, id, network['network'][psec.PORTSECURITY])
self._extend_network_port_security_dict(
- context, quantum_db)
- return quantum_db
+ context, neutron_db)
+ return neutron_db
def get_network(self, context, id, fields=None):
with context.session.begin(subtransactions=True):
with context.session.begin(subtransactions=True):
p[ext_sg.SECURITYGROUPS] = self._get_security_groups_on_port(
context, port)
- quantum_db = super(PortSecurityTestPlugin, self).create_port(
+ neutron_db = super(PortSecurityTestPlugin, self).create_port(
context, port)
- p.update(quantum_db)
+ p.update(neutron_db)
(port_security, has_ip) = self._determine_port_security_and_has_ip(
context, p)
psec.PORTSECURITY: False}}
req = self.new_update_request('ports', update_port,
port['port']['id'])
- req.environ['quantum.context'] = context.Context(
+ req.environ['neutron.context'] = context.Context(
'', 'not_network_owner')
res = req.get_response(self.api)
# TODO(salvatore-orlando): Expected error is 404 because
import mock
import webob.exc
-from quantum.api.v2 import attributes as attr
-from quantum.common.test_lib import test_config
-from quantum import context
-from quantum.db import db_base_plugin_v2
-from quantum.db import securitygroups_db
-from quantum.extensions import securitygroup as ext_sg
-from quantum.tests.unit import test_db_plugin
-
-DB_PLUGIN_KLASS = ('quantum.tests.unit.test_extension_security_group.'
+from neutron.api.v2 import attributes as attr
+from neutron.common.test_lib import test_config
+from neutron import context
+from neutron.db import db_base_plugin_v2
+from neutron.db import securitygroups_db
+from neutron.extensions import securitygroup as ext_sg
+from neutron.tests.unit import test_db_plugin
+
+DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_security_group.'
'SecurityGroupTestPlugin')
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
return []
-class SecurityGroupsTestCase(test_db_plugin.QuantumDbPluginV2TestCase):
+class SecurityGroupsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
def _create_security_group(self, fmt, name, description, **kwargs):
fmt)
if (kwargs.get('set_context') and 'tenant_id' in kwargs):
# create a specific auth context for this request
- security_group_req.environ['quantum.context'] = (
+ security_group_req.environ['neutron.context'] = (
context.Context('', kwargs['tenant_id']))
return security_group_req.get_response(self.ext_api)
if (kwargs.get('set_context') and 'tenant_id' in kwargs):
# create a specific auth context for this request
- security_group_rule_req.environ['quantum.context'] = (
+ security_group_rule_req.environ['neutron.context'] = (
context.Context('', kwargs['tenant_id']))
return security_group_rule_req.get_response(self.ext_api)
fmt = 'xml'
-class SecurityGroupTestPlugin(db_base_plugin_v2.QuantumDbPluginV2,
+class SecurityGroupTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
securitygroups_db.SecurityGroupDbMixin):
"""Test plugin that implements necessary calls on create/delete port for
associating ports with security groups.
def get_ports(self, context, filters=None, fields=None,
sorts=[], limit=None, marker=None,
page_reverse=False):
- quantum_lports = super(SecurityGroupTestPlugin, self).get_ports(
+ neutron_lports = super(SecurityGroupTestPlugin, self).get_ports(
context, filters, sorts=sorts, limit=limit, marker=marker,
page_reverse=page_reverse)
- return quantum_lports
+ return neutron_lports
class SecurityGroupDBTestCase(SecurityGroupsTestCase):
req = self.new_update_request('security-groups',
data,
sg['security_group']['id'])
- req.environ['quantum.context'] = context.Context('', 'somebody')
+ req.environ['neutron.context'] = context.Context('', 'somebody')
res = req.get_response(self.ext_api)
self.assertEqual(res.status_int, 409)
req = self.new_update_request('security-groups',
data,
sg['security_groups'][0]['id'])
- req.environ['quantum.context'] = context.Context('', 'somebody')
+ req.environ['neutron.context'] = context.Context('', 'somebody')
res = req.get_response(self.ext_api)
self.assertEqual(res.status_int, 404)
with self.network():
res = self.new_list_request('security-groups')
sg = self.deserialize(self.fmt, res.get_response(self.ext_api))
- quantum_context = context.Context('', 'test-tenant')
+ neutron_context = context.Context('', 'test-tenant')
self._delete('security-groups', sg['security_groups'][0]['id'],
- 409, quantum_context=quantum_context)
+ 409, neutron_context=neutron_context)
def test_security_group_list_creates_default_security_group(self):
- quantum_context = context.Context('', 'test-tenant')
+ neutron_context = context.Context('', 'test-tenant')
sg = self._list('security-groups',
- quantum_context=quantum_context).get('security_groups')
+ neutron_context=neutron_context).get('security_groups')
self.assertEqual(len(sg), 1)
def test_default_security_group_rules(self):
import webob
import webtest
-from quantum.api import extensions
-from quantum.common import config
-from quantum.db import db_base_plugin_v2
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
-from quantum.plugins.common import constants
-from quantum.tests import base
-from quantum.tests.unit import extension_stubs as ext_stubs
-import quantum.tests.unit.extensions
-from quantum.tests.unit import testlib_api
-from quantum import wsgi
+from neutron.api import extensions
+from neutron.common import config
+from neutron.db import db_base_plugin_v2
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
+from neutron.plugins.common import constants
+from neutron.tests import base
+from neutron.tests.unit import extension_stubs as ext_stubs
+import neutron.tests.unit.extensions
+from neutron.tests.unit import testlib_api
+from neutron import wsgi
LOG = logging.getLogger(__name__)
def etcdir(*p):
return os.path.join(ETCDIR, *p)
-extensions_path = ':'.join(quantum.tests.unit.extensions.__path__)
+extensions_path = ':'.join(neutron.tests.unit.extensions.__path__)
class ExtensionsTestApp(wsgi.Router):
super(ExtensionsTestApp, self).__init__(mapper)
-class FakePluginWithExtension(db_base_plugin_v2.QuantumDbPluginV2):
+class FakePluginWithExtension(db_base_plugin_v2.NeutronDbPluginV2):
"""A fake plugin used only for extension testing in this file."""
supported_extension_aliases = ["FOXNSOX"]
self.assertTrue("supported_extension" in ext_mgr.extensions)
- def test_extensions_expecting_quantum_plugin_interface_are_loaded(self):
+ def test_extensions_expecting_neutron_plugin_interface_are_loaded(self):
class ExtensionForQuamtumPluginInterface(ext_stubs.StubExtension):
"""This Extension does not implement get_plugin_interface method.
- This will work with any plugin implementing QuantumPluginBase
+ This will work with any plugin implementing NeutronPluginBase
"""
pass
stub_plugin = ext_stubs.StubPlugin(supported_extensions=["e1"])
class ExtensionWithNoNeedForPluginInterface(ext_stubs.StubExtension):
"""This Extension does not need any plugin interface.
- This will work with any plugin implementing QuantumPluginBase
+ This will work with any plugin implementing NeutronPluginBase
"""
def get_plugin_interface(self):
return None
def setup_base_app():
- config_file = 'quantum.conf.test'
+ config_file = 'neutron.conf.test'
args = ['--config-file', etcdir(config_file)]
config.parse(args=args)
app = config.load_paste_app('extensions_test_app')
extensions.PluginAwareExtensionManager(
extensions_path,
{constants.CORE: FakePluginWithExtension()}))
- config_file = 'quantum.conf.test'
+ config_file = 'neutron.conf.test'
args = ['--config-file', etcdir(config_file)]
config.parse(args=args)
app = config.load_paste_app('extensions_test_app')
from mock import call
from oslo.config import cfg
-from quantum.agent.common import config as a_cfg
-from quantum.agent.linux.iptables_firewall import IptablesFirewallDriver
-from quantum.tests import base
-from quantum.tests.unit import test_api_v2
+from neutron.agent.common import config as a_cfg
+from neutron.agent.linux.iptables_firewall import IptablesFirewallDriver
+from neutron.tests import base
+from neutron.tests.unit import test_api_v2
_uuid = test_api_v2._uuid
super(IptablesFirewallTestCase, self).setUp()
cfg.CONF.register_opts(a_cfg.ROOT_HELPER_OPTS, 'AGENT')
self.utils_exec_p = mock.patch(
- 'quantum.agent.linux.utils.execute')
+ 'neutron.agent.linux.utils.execute')
self.utils_exec = self.utils_exec_p.start()
self.addCleanup(self.utils_exec_p.stop)
self.iptables_cls_p = mock.patch(
- 'quantum.agent.linux.iptables_manager.IptablesManager')
+ 'neutron.agent.linux.iptables_manager.IptablesManager')
iptables_cls = self.iptables_cls_p.start()
self.addCleanup(self.iptables_cls_p.stop)
self.iptables_inst = mock.Mock()
import mox
-from quantum.agent.linux import iptables_manager
-from quantum.tests import base
+from neutron.agent.linux import iptables_manager
+from neutron.tests import base
class IptablesManagerStateFulTestCase(base.BaseTestCase):
nat_dump = (':%s-OUTPUT - [0:0]\n:%s-snat - [0:0]\n:%s-PREROUTING -'
' [0:0]\n:%s-float-snat - [0:0]\n:%s-POSTROUTING - [0:0]'
- '\n:quantum-postrouting-bottom - [0:0]\n-A PREROUTING -j'
+ '\n:neutron-postrouting-bottom - [0:0]\n-A PREROUTING -j'
' %s-PREROUTING\n-A OUTPUT -j %s-OUTPUT\n-A POSTROUTING '
- '-j %s-POSTROUTING\n-A POSTROUTING -j quantum-postroutin'
- 'g-bottom\n-A quantum-postrouting-bottom -j %s-snat\n-A '
+ '-j %s-POSTROUTING\n-A POSTROUTING -j neutron-postroutin'
+ 'g-bottom\n-A neutron-postrouting-bottom -j %s-snat\n-A '
'%s-snat -j %s-float-snat\n' % (bn, bn, bn, bn, bn, bn,
bn, bn, bn, bn, bn))
self.iptables.execute(['iptables-restore'],
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
' - [0:0]\n:%s-local - [0:0]\n:%s-filter - [0:'
- '0]\n:%s-OUTPUT - [0:0]\n:quantum-filter-top -'
- ' [0:0]\n-A FORWARD -j quantum-filter-top\n-A '
- 'OUTPUT -j quantum-filter-top\n-A quantum-filt'
+ '0]\n:%s-OUTPUT - [0:0]\n:neutron-filter-top -'
+ ' [0:0]\n-A FORWARD -j neutron-filter-top\n-A '
+ 'OUTPUT -j neutron-filter-top\n-A neutron-filt'
'er-top -j %s-local\n-A INPUT -j %s-INPUT\n-A '
'OUTPUT -j %s-OUTPUT\n-A FORWARD -j %s-FORWARD'
'\n' % (bn, bn, bn, bn, bn, bn, bn, bn, bn)
self.iptables.execute(['iptables-restore'],
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
' - [0:0]\n:%s-local - [0:0]\n:%s-OUTPUT - [0:'
- '0]\n:quantum-filter-top - [0:0]\n-A FORWARD -'
- 'j quantum-filter-top\n-A OUTPUT -j quantum-fi'
- 'lter-top\n-A quantum-filter-top -j %s-local\n'
+ '0]\n:neutron-filter-top - [0:0]\n-A FORWARD -'
+ 'j neutron-filter-top\n-A OUTPUT -j neutron-fi'
+ 'lter-top\n-A neutron-filter-top -j %s-local\n'
'-A INPUT -j %s-INPUT\n-A OUTPUT -j %s-OUTPUT'
'\n-A FORWARD -j %s-FORWARD\n' % (bn, bn, bn, bn,
bn, bn, bn, bn)), root_helper=self.root_helper
nat_dump = (':%s-OUTPUT - [0:0]\n:%s-snat - [0:0]\n:%s-PREROUTING -'
' [0:0]\n:%s-float-snat - [0:0]\n:%s-POSTROUTING - [0:0]'
- '\n:quantum-postrouting-bottom - [0:0]\n-A PREROUTING -j'
+ '\n:neutron-postrouting-bottom - [0:0]\n-A PREROUTING -j'
' %s-PREROUTING\n-A OUTPUT -j %s-OUTPUT\n-A POSTROUTING '
- '-j %s-POSTROUTING\n-A POSTROUTING -j quantum-postroutin'
- 'g-bottom\n-A quantum-postrouting-bottom -j %s-snat\n-A '
+ '-j %s-POSTROUTING\n-A POSTROUTING -j neutron-postroutin'
+ 'g-bottom\n-A neutron-postrouting-bottom -j %s-snat\n-A '
'%s-snat -j %s-float-snat\n' % (bn, bn, bn, bn, bn, bn,
bn, bn, bn, bn, bn))
self.iptables.execute(['iptables-restore'],
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
' - [0:0]\n:%s-local - [0:0]\n:%s-filter - [0:'
- '0]\n:%s-OUTPUT - [0:0]\n:quantum-filter-top -'
- ' [0:0]\n-A FORWARD -j quantum-filter-top\n-A '
- 'OUTPUT -j quantum-filter-top\n-A quantum-filt'
+ '0]\n:%s-OUTPUT - [0:0]\n:neutron-filter-top -'
+ ' [0:0]\n-A FORWARD -j neutron-filter-top\n-A '
+ 'OUTPUT -j neutron-filter-top\n-A neutron-filt'
'er-top -j %s-local\n-A INPUT -j %s-INPUT\n-A '
'OUTPUT -j %s-OUTPUT\n-A FORWARD -j %s-FORWARD'
'\n-A %s-filter -j DROP\n-A %s-INPUT -s 0/0 -d'
self.iptables.execute(['iptables-restore'],
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT -'
' [0:0]\n:%s-local - [0:0]\n:%s-OUTPUT - [0:0]\n'
- ':quantum-filter-top - [0:0]\n-A FORWARD -j quan'
- 'tum-filter-top\n-A OUTPUT -j quantum-filter-top'
- '\n-A quantum-filter-top -j %s-local\n-A INPUT -'
+ ':neutron-filter-top - [0:0]\n-A FORWARD -j neut'
+ 'ron-filter-top\n-A OUTPUT -j neutron-filter-top'
+ '\n-A neutron-filter-top -j %s-local\n-A INPUT -'
'j %s-INPUT\n-A OUTPUT -j %s-OUTPUT\n-A FORWARD '
'-j %s-FORWARD\n' % (bn, bn, bn, bn, bn, bn, bn,
bn)), root_helper=self.root_helper
bn = iptables_manager.binary_name
filter_dump = (':%s-FORWARD - [0:0]\n:%s-INPUT - [0:0]\n:%s-local - '
- '[0:0]\n:%s-OUTPUT - [0:0]\n:quantum-filter-top - [0:'
- '0]\n-A FORWARD -j quantum-filter-top\n-A OUTPUT -j q'
- 'uantum-filter-top\n-A quantum-filter-top -j %s-local'
+ '[0:0]\n:%s-OUTPUT - [0:0]\n:neutron-filter-top - [0:'
+ '0]\n-A FORWARD -j neutron-filter-top\n-A OUTPUT -j n'
+ 'eutron-filter-top\n-A neutron-filter-top -j %s-local'
'\n-A INPUT -j %s-INPUT\n-A OUTPUT -j %s-OUTPUT\n-A F'
'ORWARD -j %s-FORWARD\n' % (bn, bn, bn, bn, bn,
bn, bn, bn))
process_input=(':%s-float-snat - [0:0]\n:%s-POS'
'TROUTING - [0:0]\n:%s-PREROUTING - [0:0]\n:%s-'
'nat - [0:0]\n:%s-OUTPUT - [0:0]\n:%s-snat - [0'
- ':0]\n:quantum-postrouting-bottom - [0:0]\n-A P'
+ ':0]\n:neutron-postrouting-bottom - [0:0]\n-A P'
'REROUTING -j %s-PREROUTING\n-A OUTPUT -j %s-OU'
'TPUT\n-A POSTROUTING -j %s-POSTROUTING\n-A POS'
- 'TROUTING -j quantum-postrouting-bottom\n-A qua'
- 'ntum-postrouting-bottom -j %s-snat\n-A %s-snat'
+ 'TROUTING -j neutron-postrouting-bottom\n-A neu'
+ 'tron-postrouting-bottom -j %s-snat\n-A %s-snat'
' -j %s-float-snat\n-A %s-PREROUTING -d 192.168'
'.0.3 -j %s-nat\n-A %s-nat -p tcp --dport 8080 '
'-j REDIRECT --to-port 80\n' % (bn, bn, bn, bn,
self.iptables.execute(['iptables-restore'],
process_input=(':%s-float-snat - [0:0]\n:%s-POST'
'ROUTING - [0:0]\n:%s-PREROUTING - [0:0]\n:%s-OU'
- 'TPUT - [0:0]\n:%s-snat - [0:0]\n:quantum-postro'
+ 'TPUT - [0:0]\n:%s-snat - [0:0]\n:neutron-postro'
'uting-bottom - [0:0]\n-A PREROUTING -j %s-PRERO'
'UTING\n-A OUTPUT -j %s-OUTPUT\n-A POSTROUTING -'
- 'j %s-POSTROUTING\n-A POSTROUTING -j quantum-pos'
- 'trouting-bottom\n-A quantum-postrouting-bottom '
+ 'j %s-POSTROUTING\n-A POSTROUTING -j neutron-pos'
+ 'trouting-bottom\n-A neutron-postrouting-bottom '
'-j %s-snat\n-A %s-snat -j %s-float-snat\n' % (
bn, bn, bn, bn, bn, bn, bn, bn, bn, bn, bn)
), root_helper=self.root_helper).AndReturn(None)
import mock
from oslo.config import cfg
-from quantum.agent.common import config as agent_config
-from quantum.agent import l3_agent
-from quantum.agent.linux import interface
-from quantum.common import config as base_config
-from quantum.common import constants as l3_constants
-from quantum.openstack.common import uuidutils
-from quantum.tests import base
+from neutron.agent.common import config as agent_config
+from neutron.agent import l3_agent
+from neutron.agent.linux import interface
+from neutron.common import config as base_config
+from neutron.common import constants as l3_constants
+from neutron.openstack.common import uuidutils
+from neutron.tests import base
_uuid = uuidutils.generate_uuid
agent_config.register_root_helper(self.conf)
self.conf.register_opts(interface.OPTS)
self.conf.set_override('interface_driver',
- 'quantum.agent.linux.interface.NullDriver')
+ 'neutron.agent.linux.interface.NullDriver')
self.conf.root_helper = 'sudo'
self.device_exists_p = mock.patch(
- 'quantum.agent.linux.ip_lib.device_exists')
+ 'neutron.agent.linux.ip_lib.device_exists')
self.device_exists = self.device_exists_p.start()
self.utils_exec_p = mock.patch(
- 'quantum.agent.linux.utils.execute')
+ 'neutron.agent.linux.utils.execute')
self.utils_exec = self.utils_exec_p.start()
self.external_process_p = mock.patch(
- 'quantum.agent.linux.external_process.ProcessManager')
+ 'neutron.agent.linux.external_process.ProcessManager')
self.external_process = self.external_process_p.start()
- self.dvr_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver')
+ self.dvr_cls_p = mock.patch('neutron.agent.linux.interface.NullDriver')
driver_cls = self.dvr_cls_p.start()
self.mock_driver = mock.MagicMock()
self.mock_driver.DEV_NAME_LEN = (
interface.LinuxInterfaceDriver.DEV_NAME_LEN)
driver_cls.return_value = self.mock_driver
- self.ip_cls_p = mock.patch('quantum.agent.linux.ip_lib.IPWrapper')
+ self.ip_cls_p = mock.patch('neutron.agent.linux.ip_lib.IPWrapper')
ip_cls = self.ip_cls_p.start()
self.mock_ip = mock.MagicMock()
ip_cls.return_value = self.mock_ip
self.l3pluginApi_cls_p = mock.patch(
- 'quantum.agent.l3_agent.L3PluginApi')
+ 'neutron.agent.l3_agent.L3PluginApi')
l3pluginApi_cls = self.l3pluginApi_cls_p.start()
self.plugin_api = mock.Mock()
l3pluginApi_cls.return_value = self.plugin_api
super(TestL3AgentEventHandler, self).setUp()
cfg.CONF.register_opts(l3_agent.L3NATAgent.OPTS)
cfg.CONF.set_override(
- 'interface_driver', 'quantum.agent.linux.interface.NullDriver'
+ 'interface_driver', 'neutron.agent.linux.interface.NullDriver'
)
cfg.CONF.set_override('use_namespaces', True)
agent_config.register_root_helper(cfg.CONF)
self.device_exists_p = mock.patch(
- 'quantum.agent.linux.ip_lib.device_exists')
+ 'neutron.agent.linux.ip_lib.device_exists')
self.device_exists = self.device_exists_p.start()
self.utils_exec_p = mock.patch(
- 'quantum.agent.linux.utils.execute')
+ 'neutron.agent.linux.utils.execute')
self.utils_exec = self.utils_exec_p.start()
- self.drv_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver')
+ self.drv_cls_p = mock.patch('neutron.agent.linux.interface.NullDriver')
driver_cls = self.drv_cls_p.start()
self.mock_driver = mock.MagicMock()
self.mock_driver.DEV_NAME_LEN = (
driver_cls.return_value = self.mock_driver
self.l3_plugin_p = mock.patch(
- 'quantum.agent.l3_agent.L3PluginApi')
+ 'neutron.agent.l3_agent.L3PluginApi')
l3_plugin_cls = self.l3_plugin_p.start()
self.plugin_api = mock.Mock()
l3_plugin_cls.return_value = self.plugin_api
self.external_process_p = mock.patch(
- 'quantum.agent.linux.external_process.ProcessManager'
+ 'neutron.agent.linux.external_process.ProcessManager'
)
self.external_process = self.external_process_p.start()
def test_spawn_metadata_proxy(self):
router_id = _uuid()
metadata_port = 8080
- ip_class_path = 'quantum.agent.linux.ip_lib.IPWrapper'
+ ip_class_path = 'neutron.agent.linux.ip_lib.IPWrapper'
cfg.CONF.set_override('metadata_port', metadata_port)
cfg.CONF.set_override('log_file', 'test.log')
'qrouter-' + router_id
),
mock.call().netns.execute([
- 'quantum-ns-metadata-proxy',
+ 'neutron-ns-metadata-proxy',
mock.ANY,
'--router_id=%s' % router_id,
mock.ANY,
'--metadata_port=%s' % metadata_port,
'--debug',
- '--log-file=quantum-ns-metadata-proxy-%s.log' %
+ '--log-file=neutron-ns-metadata-proxy-%s.log' %
router_id
])
])
from webob import exc
import webtest
-from quantum.api import extensions
-from quantum.api.rpc.agentnotifiers import l3_rpc_agent_api
-from quantum.api.v2 import attributes
-from quantum.common import config
-from quantum.common import constants as l3_constants
-from quantum.common import exceptions as q_exc
-from quantum.common.test_lib import test_config
-from quantum import context
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_db
-from quantum.db import models_v2
-from quantum.extensions import l3
-from quantum.manager import QuantumManager
-from quantum.openstack.common import log as logging
-from quantum.openstack.common.notifier import api as notifier_api
-from quantum.openstack.common.notifier import test_notifier
-from quantum.openstack.common import uuidutils
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_db_plugin
-from quantum.tests.unit import test_extensions
-from quantum.tests.unit import testlib_api
+from neutron.api import extensions
+from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
+from neutron.api.v2 import attributes
+from neutron.common import config
+from neutron.common import constants as l3_constants
+from neutron.common import exceptions as q_exc
+from neutron.common.test_lib import test_config
+from neutron import context
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_db
+from neutron.db import models_v2
+from neutron.extensions import l3
+from neutron.manager import NeutronManager
+from neutron.openstack.common import log as logging
+from neutron.openstack.common.notifier import api as notifier_api
+from neutron.openstack.common.notifier import test_notifier
+from neutron.openstack.common import uuidutils
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit import test_extensions
+from neutron.tests.unit import testlib_api
LOG = logging.getLogger(__name__)
def setUp(self):
super(L3NatExtensionTestCase, self).setUp()
- plugin = 'quantum.extensions.l3.RouterPluginBase'
+ plugin = 'neutron.extensions.l3.RouterPluginBase'
# Ensure 'stale' patched copies of the plugin are never returned
- QuantumManager._instance = None
+ NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
self.saved_attr_map[resource] = attrs.copy()
# Create the default configurations
- args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
+ args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
# Update the plugin and extensions path
instances._RouterPluginBase__native_pagination_support = True
instances._RouterPluginBase__native_sorting_support = True
# Instantiate mock plugin and enable the 'router' extension
- QuantumManager.get_plugin().supported_extension_aliases = (
+ NeutronManager.get_plugin().supported_extension_aliases = (
["router"])
ext_mgr = L3TestExtensionManager()
self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
# This plugin class is just for testing
-class TestL3NatPlugin(db_base_plugin_v2.QuantumDbPluginV2,
+class TestL3NatPlugin(db_base_plugin_v2.NeutronDbPluginV2,
l3_db.L3_NAT_db_mixin):
__native_pagination_support = True
router_req = self.new_create_request('routers', data, fmt)
if set_context and tenant_id:
# create a specific auth context for this request
- router_req.environ['quantum.context'] = context.Context(
+ router_req.environ['neutron.context'] = context.Context(
'', tenant_id)
return router_req.get_response(self.ext_api)
def _add_external_gateway_to_router(self, router_id, network_id,
expected_code=exc.HTTPOk.code,
- quantum_context=None):
+ neutron_context=None):
return self._update('routers', router_id,
{'router': {'external_gateway_info':
{'network_id': network_id}}},
expected_code=expected_code,
- quantum_context=quantum_context)
+ neutron_context=neutron_context)
def _remove_external_gateway_from_router(self, router_id, network_id,
expected_code=exc.HTTPOk.code):
floatingip_req = self.new_create_request('floatingips', data, fmt)
if set_context and self._tenant_id:
# create a specific auth context for this request
- floatingip_req.environ['quantum.context'] = context.Context(
+ floatingip_req.environ['neutron.context'] = context.Context(
'', self._tenant_id)
return floatingip_req.get_response(self.ext_api)
class L3NatTestCaseBase(L3NatTestCaseMixin,
- test_db_plugin.QuantumDbPluginV2TestCase):
+ test_db_plugin.NeutronDbPluginV2TestCase):
def setUp(self):
test_config['plugin_name_v2'] = (
- 'quantum.tests.unit.test_l3_plugin.TestL3NatPlugin')
+ 'neutron.tests.unit.test_l3_plugin.TestL3NatPlugin')
# for these tests we need to enable overlapping ips
cfg.CONF.set_default('allow_overlapping_ips', True)
ext_mgr = L3TestExtensionManager()
payload['tenant_id'] == '')
def test_router_add_interface_subnet_with_bad_tenant_returns_404(self):
- with mock.patch('quantum.context.Context.to_dict') as tdict:
+ with mock.patch('neutron.context.Context.to_dict') as tdict:
tenant_id = _uuid()
admin_context = {'roles': ['admin']}
tenant_context = {'tenant_id': 'bad_tenant',
other_tenant_id = _uuid()
tenant_context = context.Context(user_id=None, tenant_id=tenant_id)
admin_context = context.get_admin_context()
- with mock.patch('quantum.context.Context') as ctx:
+ with mock.patch('neutron.context.Context') as ctx:
ctx.return_value = admin_context
with contextlib.nested(
self.router(tenant_id=tenant_id),
p['port']['id'])
def test_router_add_interface_port_bad_tenant_returns_404(self):
- with mock.patch('quantum.context.Context.to_dict') as tdict:
+ with mock.patch('neutron.context.Context.to_dict') as tdict:
admin_context = {'roles': ['admin']}
tenant_context = {'tenant_id': 'bad_tenant',
'roles': []}
self._add_external_gateway_to_router(
r['router']['id'],
s['subnet']['network_id'],
- quantum_context=ctx)
+ neutron_context=ctx)
body = self._show('routers', r['router']['id'])
net_id = body['router']['external_gateway_info']['network_id']
self.assertEqual(net_id, s['subnet']['network_id'])
def test_floatingip_with_assoc_fails(self):
self._test_floatingip_with_assoc_fails(
- 'quantum.db.l3_db.L3_NAT_db_mixin')
+ 'neutron.db.l3_db.L3_NAT_db_mixin')
def _test_floatingip_with_ip_generation_failure(self, plugin_class):
with self.subnet(cidr='200.0.0.1/24') as public_sub:
def test_floatingip_with_invalid_create_port(self):
self._test_floatingip_with_invalid_create_port(
- 'quantum.db.db_base_plugin_v2.QuantumDbPluginV2')
+ 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2')
def test_create_floatingip_no_ext_gateway_return_404(self):
with self.subnet() as public_sub:
query_params='router:external=False')
def test_get_network_succeeds_without_filter(self):
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
ctx = context.Context(None, None, is_admin=True)
result = plugin.get_networks(ctx, filters=None)
self.assertEqual(result, [])
def test_network_filter_hook_admin_context(self):
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
ctx = context.Context(None, None, is_admin=True)
model = models_v2.Network
conditions = plugin._network_filter_hook(ctx, model, [])
self.assertEqual(conditions, [])
def test_network_filter_hook_nonadmin_context(self):
- plugin = QuantumManager.get_plugin()
+ plugin = NeutronManager.get_plugin()
ctx = context.Context('edinson', 'cavani')
model = models_v2.Network
txt = "externalnetworks.network_id IS NOT NULL"
def _test_notify_op_agent(self, target_func, *args):
l3_rpc_agent_api_str = (
- 'quantum.api.rpc.agentnotifiers.l3_rpc_agent_api.L3AgentNotifyAPI')
+ 'neutron.api.rpc.agentnotifiers.l3_rpc_agent_api.L3AgentNotifyAPI')
oldNotify = l3_rpc_agent_api.L3AgentNotify
try:
with mock.patch(l3_rpc_agent_api_str) as notifyApi:
--- /dev/null
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Copyright 2013 New Dream Network, LLC (DreamHost)
+# 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.
+
+# @author Mark McClain (DreamHost)
+
+import mock
+from oslo.config import cfg
+
+from neutron.common import legacy
+from neutron.tests import base
+
+
+class TestLegacyScrubPath(base.BaseTestCase):
+ def test_neutron_path(self):
+ self.assertEqual(
+ 'neutron.foo.NeutronPlugin',
+ legacy.scrub_class_path('neutron.foo.NeutronPlugin')
+ )
+
+ def test_quantum_path(self):
+ with mock.patch.object(legacy, 'LOG') as log:
+ self.assertEqual(
+ 'neutron.foo.NeutronPlugin',
+ legacy.scrub_class_path('quantum.foo.QuantumPlugin')
+ )
+
+ log.assert_has_calls([mock.call.warn(mock.ANY, mock.ANY)])
+
+ def test_third_party_path(self):
+ self.assertEqual(
+ 'third.party.quantum.QuantumPlugin',
+ legacy.scrub_class_path('third.party.quantum.QuantumPlugin')
+ )
+
+
+class TestLegacyConfigOverride(base.BaseTestCase):
+ def setUp(self):
+ super(TestLegacyConfigOverride, self).setUp()
+ self.cfg = cfg.ConfigOpts()
+ self.cfg.register_cli_opts([cfg.StrOpt('foo'), cfg.ListOpt('thelist')])
+ self.cfg.register_cli_opts([cfg.StrOpt('baz')], group='bar')
+
+ def test_override_config_simple_key(self):
+ self.cfg(args=['--foo=quantum'])
+ legacy.override_config(self.cfg, ['foo'])
+ self.assertEqual(self.cfg.foo, 'neutron')
+
+ def test_override_config_simple_key_unchanged(self):
+ self.cfg(args=['--foo=something.else'])
+ legacy.override_config(self.cfg, ['foo'])
+ self.assertEqual(self.cfg.foo, 'something.else')
+
+ def test_override_config_missing_key(self):
+ self.cfg(args=[])
+ legacy.override_config(self.cfg, ['foo'])
+ self.assertIsNone(self.cfg.foo)
+
+ def test_override_config_group_key(self):
+ self.cfg(args=['--bar-baz=quantum'])
+ legacy.override_config(self.cfg, [('bar', 'baz')])
+ self.assertEqual(self.cfg.bar.baz, 'neutron')
+
+ def test_override_config_list_value(self):
+ self.cfg(args=['--thelist=quantum,neutron,quantum.Quantum'])
+ legacy.override_config(self.cfg, ['thelist'])
+ self.assertEqual(
+ self.cfg.thelist,
+ ['neutron', 'neutron', 'neutron.Neutron']
+ )
import mock
import testtools
-from quantum.agent.linux import daemon
-from quantum.tests import base
+from neutron.agent.linux import daemon
+from neutron.tests import base
FAKE_FD = 8
self.assertEqual(34, p.read())
def test_is_running(self):
- with mock.patch('quantum.agent.linux.utils.execute') as execute:
+ with mock.patch('neutron.agent.linux.utils.execute') as execute:
execute.return_value = 'python'
p = daemon.Pidfile('thefile', 'python')
['cat', '/proc/34/cmdline'], 'sudo')
def test_is_running_uuid_true(self):
- with mock.patch('quantum.agent.linux.utils.execute') as execute:
+ with mock.patch('neutron.agent.linux.utils.execute') as execute:
execute.return_value = 'python 1234'
p = daemon.Pidfile('thefile', 'python', uuid='1234')
['cat', '/proc/34/cmdline'], 'sudo')
def test_is_running_uuid_false(self):
- with mock.patch('quantum.agent.linux.utils.execute') as execute:
+ with mock.patch('neutron.agent.linux.utils.execute') as execute:
execute.return_value = 'python 1234'
p = daemon.Pidfile('thefile', 'python', uuid='6789')
import mock
from oslo.config import cfg
-from quantum.agent.common import config
-from quantum.agent.linux import dhcp
-from quantum.common import config as base_config
-from quantum.openstack.common import jsonutils
-from quantum.tests import base
+from neutron.agent.common import config
+from neutron.agent.linux import dhcp
+from neutron.common import config as base_config
+from neutron.openstack.common import jsonutils
+from neutron.tests import base
class FakeIPAllocation:
super(TestBase, self).setUp()
root = os.path.dirname(os.path.dirname(__file__))
args = ['--config-file',
- os.path.join(root, 'etc', 'quantum.conf.test')]
+ os.path.join(root, 'etc', 'neutron.conf.test')]
self.conf = config.setup_conf()
self.conf.register_opts(base_config.core_opts)
self.conf.register_opts(dhcp.OPTS)
self.conf.set_override('state_path', '')
self.conf.use_namespaces = True
- self.replace_p = mock.patch('quantum.agent.linux.utils.replace_file')
- self.execute_p = mock.patch('quantum.agent.linux.utils.execute')
+ self.replace_p = mock.patch('neutron.agent.linux.utils.replace_file')
+ self.execute_p = mock.patch('neutron.agent.linux.utils.execute')
self.addCleanup(self.execute_p.stop)
self.safe = self.replace_p.start()
self.addCleanup(self.replace_p.stop)
self.assertEqual(lp.interface_name, 'tap0')
def test_set_interface_name(self):
- with mock.patch('quantum.agent.linux.utils.replace_file') as replace:
+ with mock.patch('neutron.agent.linux.utils.replace_file') as replace:
lp = LocalChild(self.conf, FakeDualNetwork())
with mock.patch.object(lp, 'get_conf_file_name') as conf_file:
conf_file.return_value = '/interface'
def fake_argv(index):
if index == 0:
- return '/usr/local/bin/quantum-dhcp-agent'
+ return '/usr/local/bin/neutron-dhcp-agent'
else:
raise IndexError
expected = [
- 'QUANTUM_RELAY_SOCKET_PATH=/dhcp/lease_relay',
- 'QUANTUM_NETWORK_ID=cccccccc-cccc-cccc-cccc-cccccccccccc',
+ 'NEUTRON_RELAY_SOCKET_PATH=/dhcp/lease_relay',
+ 'NEUTRON_NETWORK_ID=cccccccc-cccc-cccc-cccc-cccccccccccc',
'ip',
'netns',
'exec',
'--pid-file=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/pid',
'--dhcp-hostsfile=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host',
'--dhcp-optsfile=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/opts',
- ('--dhcp-script=/usr/local/bin/quantum-dhcp-agent-'
+ ('--dhcp-script=/usr/local/bin/neutron-dhcp-agent-'
'dnsmasq-lease-update'),
'--leasefile-ro',
'--dhcp-range=set:tag0,192.168.0.0,static,120s',
self.execute.assert_called_once_with(exp_args, 'sudo')
def test_make_subnet_interface_ip_map(self):
- with mock.patch('quantum.agent.linux.ip_lib.IPDevice') as ip_dev:
+ with mock.patch('neutron.agent.linux.ip_lib.IPDevice') as ip_dev:
ip_dev.return_value.addr.list.return_value = [
{'cidr': '192.168.0.1/24'}
]
ip_address=ip_address))
environ = {
- 'QUANTUM_NETWORK_ID': network_id,
- 'QUANTUM_RELAY_SOCKET_PATH': relay_path,
+ 'NEUTRON_NETWORK_ID': network_id,
+ 'NEUTRON_RELAY_SOCKET_PATH': relay_path,
'DNSMASQ_TIME_REMAINING': '120',
}
def test_remove_config_files(self):
net = FakeV4Network()
- path = '/opt/data/quantum/dhcp'
+ path = '/opt/data/neutron/dhcp'
self.conf.dhcp_confs = path
with mock.patch('shutil.rmtree') as rmtree:
ignore_errors=True)
def test_existing_dhcp_networks(self):
- path = '/opt/data/quantum/dhcp'
+ path = '/opt/data/neutron/dhcp'
self.conf.dhcp_confs = path
cases = {
result)
def _check_version(self, cmd_out, expected_value):
- with mock.patch('quantum.agent.linux.utils.execute') as cmd:
+ with mock.patch('neutron.agent.linux.utils.execute') as cmd:
cmd.return_value = cmd_out
result = dhcp.Dnsmasq.check_version()
self.assertEqual(result, expected_value)
import mock
-from quantum.agent.linux import external_process as ep
-from quantum.tests import base
+from neutron.agent.linux import external_process as ep
+from neutron.tests import base
class TestProcessManager(base.BaseTestCase):
def setUp(self):
super(TestProcessManager, self).setUp()
- self.execute_p = mock.patch('quantum.agent.linux.utils.execute')
+ self.execute_p = mock.patch('neutron.agent.linux.utils.execute')
self.execute = self.execute_p.start()
self.addCleanup(self.execute_p.stop)
self.conf = mock.Mock()
import mock
-from quantum.agent.common import config
-from quantum.agent.dhcp_agent import DeviceManager
-from quantum.agent.linux import interface
-from quantum.agent.linux import ip_lib
-from quantum.agent.linux import utils
-from quantum.extensions.flavor import (FLAVOR_NETWORK)
-from quantum.tests import base
+from neutron.agent.common import config
+from neutron.agent.dhcp_agent import DeviceManager
+from neutron.agent.linux import interface
+from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
+from neutron.extensions.flavor import (FLAVOR_NETWORK)
+from neutron.tests import base
class BaseChild(interface.LinuxInterfaceDriver):
def test_unplug(self, bridge=None):
if not bridge:
bridge = 'br-int'
- with mock.patch('quantum.agent.linux.ovs_lib.OVSBridge') as ovs_br:
+ with mock.patch('neutron.agent.linux.ovs_lib.OVSBridge') as ovs_br:
ovs = interface.OVSInterfaceDriver(self.conf)
ovs.unplug('tap0')
ovs_br.assert_has_calls([mock.call(bridge, 'sudo'),
def test_unplug(self, bridge=None):
if not bridge:
bridge = 'br-int'
- with mock.patch('quantum.agent.linux.ovs_lib.OVSBridge') as ovs_br:
+ with mock.patch('neutron.agent.linux.ovs_lib.OVSBridge') as ovs_br:
ovs = interface.OVSInterfaceDriver(self.conf)
ovs.unplug('ns-0', bridge=bridge)
ovs_br.assert_has_calls([mock.call(bridge, 'sudo'),
def test_plug_dev_exists(self):
self.device_exists.return_value = True
- with mock.patch('quantum.agent.linux.interface.LOG.warn') as log:
+ with mock.patch('neutron.agent.linux.interface.LOG.warn') as log:
br = interface.BridgeInterfaceDriver(self.conf)
br.plug('01234567-1234-1234-99',
'port-1234',
def test_unplug_no_device(self):
self.device_exists.return_value = False
self.ip_dev().link.delete.side_effect = RuntimeError
- with mock.patch('quantum.agent.linux.interface.LOG') as log:
+ with mock.patch('neutron.agent.linux.interface.LOG') as log:
br = interface.BridgeInterfaceDriver(self.conf)
br.unplug('tap0')
[mock.call(), mock.call('tap0', 'sudo'), mock.call().link.delete()]
def test_unplug(self):
self.device_exists.return_value = True
- with mock.patch('quantum.agent.linux.interface.LOG.debug') as log:
+ with mock.patch('neutron.agent.linux.interface.LOG.debug') as log:
br = interface.BridgeInterfaceDriver(self.conf)
br.unplug('tap0')
log.assert_called_once()
def setUp(self):
super(TestMetaInterfaceDriver, self).setUp()
self.conf.register_opts(DeviceManager.OPTS)
- self.client_cls_p = mock.patch('quantumclient.v2_0.client.Client')
+ self.client_cls_p = mock.patch('neutronclient.v2_0.client.Client')
client_cls = self.client_cls_p.start()
self.addCleanup(self.client_cls_p.stop)
self.client_inst = mock.Mock()
self.conf.set_override('auth_url', 'http://localhost:35357/v2.0')
self.conf.set_override('auth_region', 'RegionOne')
- self.conf.set_override('admin_user', 'quantum')
+ self.conf.set_override('admin_user', 'neutron')
self.conf.set_override('admin_password', 'password')
self.conf.set_override('admin_tenant_name', 'service')
self.conf.set_override(
'meta_flavor_driver_mappings',
- 'fake1:quantum.agent.linux.interface.OVSInterfaceDriver,'
- 'fake2:quantum.agent.linux.interface.BridgeInterfaceDriver')
+ 'fake1:neutron.agent.linux.interface.OVSInterfaceDriver,'
+ 'fake2:neutron.agent.linux.interface.BridgeInterfaceDriver')
def test_get_driver_by_network_id(self):
meta_interface = interface.MetaInterfaceDriver(self.conf)
import mock
-from quantum.agent.linux import ip_lib
-from quantum.common import exceptions
-from quantum.tests import base
+from neutron.agent.linux import ip_lib
+from neutron.common import exceptions
+from neutron.tests import base
NETNS_SAMPLE = [
'12345678-1234-5678-abcd-1234567890ab',
class TestSubProcessBase(base.BaseTestCase):
def setUp(self):
super(TestSubProcessBase, self).setUp()
- self.execute_p = mock.patch('quantum.agent.linux.utils.execute')
+ self.execute_p = mock.patch('neutron.agent.linux.utils.execute')
self.execute = self.execute_p.start()
self.addCleanup(self.execute_p.stop)
self.assertEqual(ns.namespace, 'ns')
def test_delete_namespace(self):
- with mock.patch('quantum.agent.linux.utils.execute'):
+ with mock.patch('neutron.agent.linux.utils.execute'):
self.netns_cmd.delete('ns')
self._assert_sudo([], ('delete', 'ns'), force_root_namespace=True)
def test_execute(self):
self.parent.namespace = 'ns'
- with mock.patch('quantum.agent.linux.utils.execute') as execute:
+ with mock.patch('neutron.agent.linux.utils.execute') as execute:
self.netns_cmd.execute(['ip', 'link', 'list'])
execute.assert_called_once_with(['ip', 'netns', 'exec', 'ns', 'ip',
'link', 'list'],
def test_execute_env_var_prepend(self):
self.parent.namespace = 'ns'
- with mock.patch('quantum.agent.linux.utils.execute') as execute:
+ with mock.patch('neutron.agent.linux.utils.execute') as execute:
env = dict(FOO=1, BAR=2)
self.netns_cmd.execute(['ip', 'link', 'list'], env)
execute.assert_called_once_with(
import testtools
import webob
-from quantum.agent.metadata import agent
-from quantum.common import utils
-from quantum.tests import base
+from neutron.agent.metadata import agent
+from neutron.common import utils
+from neutron.tests import base
class FakeConf(object):
- admin_user = 'quantum'
+ admin_user = 'neutron'
admin_password = 'password'
admin_tenant_name = 'tenant'
auth_url = 'http://127.0.0.1'
class TestMetadataProxyHandler(base.BaseTestCase):
def setUp(self):
super(TestMetadataProxyHandler, self).setUp()
- self.qclient_p = mock.patch('quantumclient.v2_0.client.Client')
+ self.qclient_p = mock.patch('neutronclient.v2_0.client.Client')
self.qclient = self.qclient_p.start()
self.addCleanup(self.qclient_p.stop)
def test_get_instance_id_router_id(self):
router_id = 'the_id'
headers = {
- 'X-Quantum-Router-ID': router_id
+ 'X-Neutron-Router-ID': router_id
}
networks = ['net1', 'net2']
def test_get_instance_id_router_id_no_match(self):
router_id = 'the_id'
headers = {
- 'X-Quantum-Router-ID': router_id
+ 'X-Neutron-Router-ID': router_id
}
networks = ['net1', 'net2']
def test_get_instance_id_network_id(self):
network_id = 'the_id'
headers = {
- 'X-Quantum-Network-ID': network_id
+ 'X-Neutron-Network-ID': network_id
}
ports = [
def test_get_instance_id_network_id_no_match(self):
network_id = 'the_id'
headers = {
- 'X-Quantum-Network-ID': network_id
+ 'X-Neutron-Network-ID': network_id
}
ports = [[]]
isdir.assert_called_once_with('/the')
makedirs.assert_called_once_with('/the', 0o755)
server.assert_has_calls([
- mock.call('quantum-metadata-agent'),
+ mock.call('neutron-metadata-agent'),
mock.call().start(handler.return_value,
'/the/path'),
mock.call().wait()]
import testtools
import webob
-from quantum.agent.metadata import namespace_proxy as ns_proxy
-from quantum.common import utils
-from quantum.tests import base
+from neutron.agent.metadata import namespace_proxy as ns_proxy
+from neutron.common import utils
+from neutron.tests import base
class FakeConf(object):
- admin_user = 'quantum'
+ admin_user = 'neutron'
admin_password = 'password'
admin_tenant_name = 'tenant'
auth_url = 'http://127.0.0.1'
method='GET',
headers={
'X-Forwarded-For': '192.168.1.1',
- 'X-Quantum-Router-ID': 'router_id'
+ 'X-Neutron-Router-ID': 'router_id'
},
connection_type=ns_proxy.UnixDomainHTTPConnection,
body=''
method='GET',
headers={
'X-Forwarded-For': '192.168.1.1',
- 'X-Quantum-Network-ID': 'network_id'
+ 'X-Neutron-Network-ID': 'network_id'
},
connection_type=ns_proxy.UnixDomainHTTPConnection,
body=''
method='GET',
headers={
'X-Forwarded-For': '192.168.1.1',
- 'X-Quantum-Network-ID': 'network_id'
+ 'X-Neutron-Network-ID': 'network_id'
},
connection_type=ns_proxy.UnixDomainHTTPConnection,
body=''
method='POST',
headers={
'X-Forwarded-For': '192.168.1.1',
- 'X-Quantum-Network-ID': 'network_id'
+ 'X-Neutron-Network-ID': 'network_id'
},
connection_type=ns_proxy.UnixDomainHTTPConnection,
body=''
method='GET',
headers={
'X-Forwarded-For': '192.168.1.1',
- 'X-Quantum-Network-ID': 'network_id'
+ 'X-Neutron-Network-ID': 'network_id'
},
connection_type=ns_proxy.UnixDomainHTTPConnection,
body=''
method='GET',
headers={
'X-Forwarded-For': '192.168.1.1',
- 'X-Quantum-Network-ID': 'network_id'
+ 'X-Neutron-Network-ID': 'network_id'
},
connection_type=ns_proxy.UnixDomainHTTPConnection,
body=''
method='GET',
headers={
'X-Forwarded-For': '192.168.1.1',
- 'X-Quantum-Network-ID': 'network_id'
+ 'X-Neutron-Network-ID': 'network_id'
},
connection_type=ns_proxy.UnixDomainHTTPConnection,
body=''
class TestProxyDaemon(base.BaseTestCase):
def test_init(self):
- with mock.patch('quantum.agent.linux.daemon.Pidfile'):
+ with mock.patch('neutron.agent.linux.daemon.Pidfile'):
pd = ns_proxy.ProxyDaemon('pidfile', 9697, 'net_id', 'router_id')
self.assertEqual(pd.router_id, 'router_id')
self.assertEqual(pd.network_id, 'net_id')
def test_run(self):
- with mock.patch('quantum.agent.linux.daemon.Pidfile'):
- with mock.patch('quantum.wsgi.Server') as Server:
+ with mock.patch('neutron.agent.linux.daemon.Pidfile'):
+ with mock.patch('neutron.wsgi.Server') as Server:
pd = ns_proxy.ProxyDaemon('pidfile', 9697, 'net_id',
'router_id')
pd.run()
Server.assert_has_calls([
- mock.call('quantum-network-metadata-proxy'),
+ mock.call('neutron-network-metadata-proxy'),
mock.call().start(mock.ANY, 9697),
mock.call().wait()]
)
import mock
-from quantum import context
-from quantum.tests import base
+from neutron import context
+from neutron.tests import base
-class TestQuantumContext(base.BaseTestCase):
+class TestNeutronContext(base.BaseTestCase):
def setUp(self):
- super(TestQuantumContext, self).setUp()
- db_api = 'quantum.db.api.get_session'
+ super(TestNeutronContext, self).setUp()
+ db_api = 'neutron.db.api.get_session'
self._db_api_session_patcher = mock.patch(db_api)
self.db_api_session = self._db_api_session_patcher.start()
self.addCleanup(self._db_api_session_patcher.stop)
- def testQuantumContextCreate(self):
+ def testNeutronContextCreate(self):
cxt = context.Context('user_id', 'tenant_id')
self.assertEqual('user_id', cxt.user_id)
self.assertEqual('tenant_id', cxt.project_id)
- def testQuantumContextToDict(self):
+ def testNeutronContextToDict(self):
cxt = context.Context('user_id', 'tenant_id')
cxt_dict = cxt.to_dict()
self.assertEqual('user_id', cxt_dict['user_id'])
self.assertEqual('tenant_id', cxt_dict['project_id'])
- def testQuantumContextAdminToDict(self):
+ def testNeutronContextAdminToDict(self):
self.db_api_session.return_value = 'fakesession'
cxt = context.get_admin_context()
cxt_dict = cxt.to_dict()
self.assertIsNotNone(cxt.session)
self.assertFalse('session' in cxt_dict)
- def testQuantumContextAdminWithoutSessionToDict(self):
+ def testNeutronContextAdminWithoutSessionToDict(self):
cxt = context.get_admin_context_without_session()
cxt_dict = cxt.to_dict()
self.assertIsNone(cxt_dict['user_id'])
from oslo.config import cfg
-from quantum.common import config
-from quantum.common.test_lib import test_config
-from quantum.manager import QuantumManager
-from quantum.manager import validate_post_plugin_load
-from quantum.manager import validate_pre_plugin_load
-from quantum.openstack.common import log as logging
-from quantum.plugins.common import constants
-from quantum.tests import base
-from quantum.tests.unit import dummy_plugin
+from neutron.common import config
+from neutron.common.test_lib import test_config
+from neutron.manager import NeutronManager
+from neutron.manager import validate_post_plugin_load
+from neutron.manager import validate_pre_plugin_load
+from neutron.openstack.common import log as logging
+from neutron.plugins.common import constants
+from neutron.tests import base
+from neutron.tests.unit import dummy_plugin
LOG = logging.getLogger(__name__)
-DB_PLUGIN_KLASS = 'quantum.db.db_base_plugin_v2.QuantumDbPluginV2'
+DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
supported_extension_aliases = ['lbaas', 'dummy']
-class QuantumManagerTestCase(base.BaseTestCase):
+class NeutronManagerTestCase(base.BaseTestCase):
def setUp(self):
- super(QuantumManagerTestCase, self).setUp()
- args = ['--config-file', etcdir('quantum.conf.test')]
+ super(NeutronManagerTestCase, self).setUp()
+ args = ['--config-file', etcdir('neutron.conf.test')]
# If test_config specifies some config-file, use it, as well
config.parse(args=args)
- QuantumManager._instance = None
+ NeutronManager._instance = None
self.addCleanup(cfg.CONF.reset)
self.useFixture(
- fixtures.MonkeyPatch('quantum.manager.QuantumManager._instance'))
+ fixtures.MonkeyPatch('neutron.manager.NeutronManager._instance'))
def test_service_plugin_is_loaded(self):
cfg.CONF.set_override("core_plugin",
test_config.get('plugin_name_v2',
DB_PLUGIN_KLASS))
cfg.CONF.set_override("service_plugins",
- ["quantum.tests.unit.dummy_plugin."
+ ["neutron.tests.unit.dummy_plugin."
"DummyServicePlugin"])
- mgr = QuantumManager.get_instance()
+ mgr = NeutronManager.get_instance()
plugin = mgr.get_service_plugins()[constants.DUMMY]
self.assertTrue(
isinstance(plugin,
(dummy_plugin.DummyServicePlugin, types.ClassType)),
- "loaded plugin should be of type QuantumDummyPlugin")
+ "loaded plugin should be of type neutronDummyPlugin")
def test_multiple_plugins_specified_for_service_type(self):
cfg.CONF.set_override("service_plugins",
- ["quantum.tests.unit.dummy_plugin."
+ ["neutron.tests.unit.dummy_plugin."
"DummyServicePlugin",
- "quantum.tests.unit.dummy_plugin."
+ "neutron.tests.unit.dummy_plugin."
"DummyServicePlugin"])
cfg.CONF.set_override("core_plugin",
test_config.get('plugin_name_v2',
DB_PLUGIN_KLASS))
- self.assertRaises(ValueError, QuantumManager.get_instance)
+ self.assertRaises(ValueError, NeutronManager.get_instance)
def test_service_plugin_conflicts_with_core_plugin(self):
cfg.CONF.set_override("service_plugins",
- ["quantum.tests.unit.dummy_plugin."
+ ["neutron.tests.unit.dummy_plugin."
"DummyServicePlugin"])
cfg.CONF.set_override("core_plugin",
- "quantum.tests.unit.test_quantum_manager."
+ "neutron.tests.unit.test_neutron_manager."
"MultiServiceCorePlugin")
- self.assertRaises(ValueError, QuantumManager.get_instance)
+ self.assertRaises(ValueError, NeutronManager.get_instance)
def test_core_plugin_supports_services(self):
cfg.CONF.set_override("core_plugin",
- "quantum.tests.unit.test_quantum_manager."
+ "neutron.tests.unit.test_neutron_manager."
"MultiServiceCorePlugin")
- mgr = QuantumManager.get_instance()
+ mgr = NeutronManager.get_instance()
svc_plugins = mgr.get_service_plugins()
self.assertEqual(3, len(svc_plugins))
self.assertIn(constants.CORE, svc_plugins.keys())
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Test of Policy Engine For Quantum"""
+"""Test of Policy Engine For Neutron"""
import json
import StringIO
import fixtures
import mock
-import quantum
-from quantum.common import exceptions
-from quantum import context
-from quantum import manager
-from quantum.openstack.common import importutils
-from quantum.openstack.common import policy as common_policy
-from quantum import policy
-from quantum.tests import base
+import neutron
+from neutron.common import exceptions
+from neutron import context
+from neutron import manager
+from neutron.openstack.common import importutils
+from neutron.openstack.common import policy as common_policy
+from neutron import policy
+from neutron.tests import base
class PolicyFileTestCase(base.BaseTestCase):
def fake_find_config_file(_1, _2):
return self.tempdir.join('policy')
- with mock.patch.object(quantum.common.utils,
+ with mock.patch.object(neutron.common.utils,
'find_config_file',
new=fake_find_config_file):
tmpfilename = fake_find_config_file(None, None)
self.context, "example:noexist", {})
-class QuantumPolicyTestCase(base.BaseTestCase):
+class NeutronPolicyTestCase(base.BaseTestCase):
def setUp(self):
- super(QuantumPolicyTestCase, self).setUp()
+ super(NeutronPolicyTestCase, self).setUp()
policy.reset()
policy.init()
self.addCleanup(policy.reset)
def fakepolicyinit():
common_policy.set_rules(common_policy.Rules(self.rules))
- self.patcher = mock.patch.object(quantum.policy,
+ self.patcher = mock.patch.object(neutron.policy,
'init',
new=fakepolicyinit)
self.patcher.start()
self.addCleanup(self.patcher.stop)
self.context = context.Context('fake', 'fake', roles=['user'])
plugin_klass = importutils.import_class(
- "quantum.db.db_base_plugin_v2.QuantumDbPluginV2")
- self.manager_patcher = mock.patch('quantum.manager.QuantumManager')
+ "neutron.db.db_base_plugin_v2.NeutronDbPluginV2")
+ self.manager_patcher = mock.patch('neutron.manager.NeutronManager')
fake_manager = self.manager_patcher.start()
fake_manager_instance = fake_manager.return_value
fake_manager_instance.plugin = plugin_klass()
return {'tenant_id': 'fake'}
action = "create_port:mac"
- with mock.patch.object(manager.QuantumManager.get_instance().plugin,
+ with mock.patch.object(manager.NeutronManager.get_instance().plugin,
'get_network', new=fakegetnetwork):
target = {'network_id': 'whatever'}
result = policy.enforce(self.context, action, target)
# so long that we verify that, if *f* blows up, the behavior of the
# policy engine to propagate the exception is preserved
action = "create_port:mac"
- with mock.patch.object(manager.QuantumManager.get_instance().plugin,
+ with mock.patch.object(manager.NeutronManager.get_instance().plugin,
'get_network', new=fakegetnetwork):
target = {'network_id': 'whatever'}
self.assertRaises(NotImplementedError,
self.rules['admin_or_network_owner'] = common_policy.parse_rule(
"role:admin or tenant_id:%(network_tenant_id)s")
action = "create_port:mac"
- with mock.patch.object(manager.QuantumManager.get_instance().plugin,
+ with mock.patch.object(manager.NeutronManager.get_instance().plugin,
'get_network', new=fakegetnetwork):
target = {'network_id': 'whatever'}
result = policy.enforce(self.context, action, target)
import testtools
import webtest
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.common import config
-from quantum.common import exceptions
-from quantum import context
-from quantum.db import api as db
-from quantum.db import quota_db
-from quantum import manager
-from quantum.plugins.linuxbridge.db import l2network_db_v2
-from quantum import quota
-from quantum.tests import base
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_extensions
-from quantum.tests.unit import testlib_api
-
-TARGET_PLUGIN = ('quantum.plugins.linuxbridge.lb_quantum_plugin'
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.common import config
+from neutron.common import exceptions
+from neutron import context
+from neutron.db import api as db
+from neutron.db import quota_db
+from neutron import manager
+from neutron.plugins.linuxbridge.db import l2network_db_v2
+from neutron import quota
+from neutron.tests import base
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_extensions
+from neutron.tests.unit import testlib_api
+
+TARGET_PLUGIN = ('neutron.plugins.linuxbridge.lb_neutron_plugin'
'.LinuxBridgePluginV2')
_get_path = test_api_v2._get_path
def setUp(self):
super(QuotaExtensionTestCase, self).setUp()
# Ensure 'stale' patched copies of the plugin are never returned
- manager.QuantumManager._instance = None
+ manager.NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
self.saved_attr_map[resource] = attrs.copy()
# Create the default configurations
- args = ['--config-file', test_extensions.etcdir('quantum.conf.test')]
+ args = ['--config-file', test_extensions.etcdir('neutron.conf.test')]
config.parse(args=args)
# Update the plugin and extensions path
def setUp(self):
cfg.CONF.set_override(
'quota_driver',
- 'quantum.db.quota_db.DbQuotaDriver',
+ 'neutron.db.quota_db.DbQuotaDriver',
group='QUOTAS')
super(QuotaExtensionDbTestCase, self).setUp()
def test_quotas_default_values(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id)}
+ env = {'neutron.context': context.Context('', tenant_id)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env)
quota = self.deserialize(res)
def test_show_quotas_with_admin(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id + '2',
+ env = {'neutron.context': context.Context('', tenant_id + '2',
is_admin=True)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env)
def test_show_quotas_without_admin_forbidden_returns_403(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id + '2',
+ env = {'neutron.context': context.Context('', tenant_id + '2',
is_admin=False)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env, expect_errors=True)
def test_show_quotas_with_owner_tenant(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=False)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env)
def test_list_quotas_with_admin(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
res = self.api.get(_get_path('quotas', fmt=self.fmt),
extra_environ=env)
def test_list_quotas_without_admin_forbidden_returns_403(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=False)}
res = self.api.get(_get_path('quotas', fmt=self.fmt),
extra_environ=env, expect_errors=True)
def test_update_quotas_without_admin_forbidden_returns_403(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=False)}
quotas = {'quota': {'network': 100}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
def test_update_quotas_with_non_integer_returns_400(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
quotas = {'quota': {'network': 'abc'}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
def test_update_quotas_with_negative_integer_returns_400(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
quotas = {'quota': {'network': -2}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
def test_update_quotas_to_unlimited(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
quotas = {'quota': {'network': -1}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
def test_update_quotas_exceeding_current_limit(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
quotas = {'quota': {'network': 120}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
def test_update_quotas_with_non_support_resource_returns_400(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
quotas = {'quota': {'abc': 100}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
def test_update_quotas_with_admin(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id + '2',
+ env = {'neutron.context': context.Context('', tenant_id + '2',
is_admin=True)}
quotas = {'quota': {'network': 100}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
self.serialize(quotas), extra_environ=env)
self.assertEqual(200, res.status_int)
- env2 = {'quantum.context': context.Context('', tenant_id)}
+ env2 = {'neutron.context': context.Context('', tenant_id)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env2)
quota = self.deserialize(res)
def test_update_attributes(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id + '2',
+ env = {'neutron.context': context.Context('', tenant_id + '2',
is_admin=True)}
quotas = {'quota': {'extra1': 100}}
res = self.api.put(_get_path('quotas', id=tenant_id, fmt=self.fmt),
self.serialize(quotas), extra_environ=env)
self.assertEqual(200, res.status_int)
- env2 = {'quantum.context': context.Context('', tenant_id)}
+ env2 = {'neutron.context': context.Context('', tenant_id)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env2)
quota = self.deserialize(res)
def test_delete_quotas_with_admin(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id + '2',
+ env = {'neutron.context': context.Context('', tenant_id + '2',
is_admin=True)}
res = self.api.delete(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env)
def test_delete_quotas_without_admin_forbidden_returns_403(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=False)}
res = self.api.delete(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env, expect_errors=True)
def test_quotas_limit_check(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
quotas = {'quota': {'network': 5}}
res = self.api.put(_get_path('quotas', id=tenant_id,
def test_quotas_get_tenant_from_request_context(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=True)}
res = self.api.get(_get_path('quotas/tenant', fmt=self.fmt),
extra_environ=env)
self.assertEqual(quota['tenant']['tenant_id'], tenant_id)
def test_quotas_get_tenant_from_empty_request_context_returns_400(self):
- env = {'quantum.context': context.Context('', '',
+ env = {'neutron.context': context.Context('', '',
is_admin=True)}
res = self.api.get(_get_path('quotas/tenant', fmt=self.fmt),
extra_environ=env, expect_errors=True)
def test_quotas_default_values(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id)}
+ env = {'neutron.context': context.Context('', tenant_id)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env)
quota = self.deserialize(res)
def test_show_quotas_with_admin(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id + '2',
+ env = {'neutron.context': context.Context('', tenant_id + '2',
is_admin=True)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env)
def test_show_quotas_without_admin_forbidden(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id + '2',
+ env = {'neutron.context': context.Context('', tenant_id + '2',
is_admin=False)}
res = self.api.get(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env, expect_errors=True)
def test_delete_quotas_forbidden(self):
tenant_id = 'tenant_id1'
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=False)}
res = self.api.delete(_get_path('quotas', id=tenant_id, fmt=self.fmt),
extra_environ=env, expect_errors=True)
class TestDbQuotaDriver(base.BaseTestCase):
- """Test for quantum.db.quota_db.DbQuotaDriver."""
+ """Test for neutron.db.quota_db.DbQuotaDriver."""
def test_get_tenant_quotas_arg(self):
- """Call quantum.db.quota_db.DbQuotaDriver._get_quotas."""
+ """Call neutron.db.quota_db.DbQuotaDriver._get_quotas."""
driver = quota_db.DbQuotaDriver()
ctx = context.Context('', 'bar')
import fixtures
-from quantum.rootwrap import filters
-from quantum.rootwrap import wrapper
-from quantum.tests import base
+from neutron.rootwrap import filters
+from neutron.rootwrap import wrapper
+from neutron.tests import base
class RootwrapTestCase(base.BaseTestCase):
wrapper.match_filter, self.filters, invalid)
def test_DnsmasqFilter(self):
- usercmd = ['QUANTUM_RELAY_SOCKET_PATH=A', 'QUANTUM_NETWORK_ID=foobar',
+ usercmd = ['NEUTRON_RELAY_SOCKET_PATH=A', 'NEUTRON_NETWORK_ID=foobar',
'dnsmasq', 'foo']
f = filters.DnsmasqFilter("/usr/bin/dnsmasq", "root")
self.assertTrue(f.match(usercmd))
self.assertEqual(f.get_command(usercmd), ['/usr/bin/dnsmasq', 'foo'])
env = f.get_environment(usercmd)
- self.assertEqual(env.get('QUANTUM_RELAY_SOCKET_PATH'), 'A')
- self.assertEqual(env.get('QUANTUM_NETWORK_ID'), 'foobar')
+ self.assertEqual(env.get('NEUTRON_RELAY_SOCKET_PATH'), 'A')
+ self.assertEqual(env.get('NEUTRON_NETWORK_ID'), 'foobar')
def test_DnsmasqNetnsFilter(self):
- usercmd = ['QUANTUM_RELAY_SOCKET_PATH=A', 'QUANTUM_NETWORK_ID=foobar',
+ usercmd = ['NEUTRON_RELAY_SOCKET_PATH=A', 'NEUTRON_NETWORK_ID=foobar',
'ip', 'netns', 'exec', 'foo', 'dnsmasq', 'foo']
f = filters.DnsmasqNetnsFilter("/sbin/ip", "root")
self.assertTrue(f.match(usercmd))
self.assertEqual(f.get_command(usercmd), ['/sbin/ip', 'netns', 'exec',
'foo', 'dnsmasq', 'foo'])
env = f.get_environment(usercmd)
- self.assertEqual(env.get('QUANTUM_RELAY_SOCKET_PATH'), 'A')
- self.assertEqual(env.get('QUANTUM_NETWORK_ID'), 'foobar')
+ self.assertEqual(env.get('NEUTRON_RELAY_SOCKET_PATH'), 'A')
+ self.assertEqual(env.get('NEUTRON_NETWORK_ID'), 'foobar')
def test_KillFilter(self):
if not os.path.exists("/proc/%d" % os.getpid()):
args = ['chown', 'nova', '/tmp/spam/eggs']
self.assertTrue(f.match(args))
- args = ['chown', 'quantum', '/tmp/spam/eggs']
+ args = ['chown', 'neutron', '/tmp/spam/eggs']
self.assertFalse(f.match(args))
def test_wrong_arguments_number(self):
from oslo.config import cfg
import webob.exc as webexc
-import quantum
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum.api.v2 import router
-from quantum.common import config
-from quantum import context as q_context
-from quantum.db import api as db
-from quantum.db import db_base_plugin_v2
-from quantum.db import l3_db
-from quantum.db.loadbalancer import loadbalancer_db as lb_db
-from quantum.db import routedserviceinsertion_db as rsi_db
-from quantum.db import routerservicetype_db as rst_db
-from quantum.db import servicetype_db as st_db
-from quantum.extensions import routedserviceinsertion as rsi
-from quantum.extensions import routerservicetype as rst
-from quantum.plugins.common import constants
-from quantum.tests import base
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import testlib_api
-from quantum import wsgi
+import neutron
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron.api.v2 import router
+from neutron.common import config
+from neutron import context as q_context
+from neutron.db import api as db
+from neutron.db import db_base_plugin_v2
+from neutron.db import l3_db
+from neutron.db.loadbalancer import loadbalancer_db as lb_db
+from neutron.db import routedserviceinsertion_db as rsi_db
+from neutron.db import routerservicetype_db as rst_db
+from neutron.db import servicetype_db as st_db
+from neutron.extensions import routedserviceinsertion as rsi
+from neutron.extensions import routerservicetype as rst
+from neutron.plugins.common import constants
+from neutron.tests import base
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import testlib_api
+from neutron import wsgi
_uuid = test_api_v2._uuid
_get_path = test_api_v2._get_path
-extensions_path = ':'.join(quantum.extensions.__path__)
+extensions_path = ':'.join(neutron.extensions.__path__)
class RouterServiceInsertionTestPlugin(
st_db.ServiceTypeManager,
lb_db.LoadBalancerPluginDb,
l3_db.L3_NAT_db_mixin,
- db_base_plugin_v2.QuantumDbPluginV2):
+ db_base_plugin_v2.NeutronDbPluginV2):
supported_extension_aliases = [
"router", "router-service-type", "routed-service-insertion",
def setUp(self):
super(RouterServiceInsertionTestCase, self).setUp()
plugin = (
- "quantum.tests.unit.test_routerserviceinsertion."
+ "neutron.tests.unit.test_routerserviceinsertion."
"RouterServiceInsertionTestPlugin"
)
- # point config file to: quantum/tests/etc/quantum.conf.test
- args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
+ # point config file to: neutron/tests/etc/neutron.conf.test
+ args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
#just stubbing core plugin with LoadBalancer plugin
self.addCleanup(cfg.CONF.reset)
# Ensure 'stale' patched copies of the plugin are never returned
- quantum.manager.QuantumManager._instance = None
+ neutron.manager.NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
super(RouterServiceInsertionTestCase, self).tearDown()
def _setup_core_resources(self):
- core_plugin = quantum.manager.QuantumManager.get_plugin()
+ core_plugin = neutron.manager.NeutronManager.get_plugin()
self._network = core_plugin.create_network(
q_context.get_admin_context(),
import mox
from oslo.config import cfg
-from quantum.agent import firewall as firewall_base
-from quantum.agent.linux import iptables_manager
-from quantum.agent import rpc as agent_rpc
-from quantum.agent import securitygroups_rpc as sg_rpc
-from quantum import context
-from quantum.db import securitygroups_rpc_base as sg_db_rpc
-from quantum.extensions import securitygroup as ext_sg
-from quantum.openstack.common.rpc import proxy
-from quantum.tests import base
-from quantum.tests.unit import test_extension_security_group as test_sg
-from quantum.tests.unit import test_iptables_firewall as test_fw
+from neutron.agent import firewall as firewall_base
+from neutron.agent.linux import iptables_manager
+from neutron.agent import rpc as agent_rpc
+from neutron.agent import securitygroups_rpc as sg_rpc
+from neutron import context
+from neutron.db import securitygroups_rpc_base as sg_db_rpc
+from neutron.extensions import securitygroup as ext_sg
+from neutron.openstack.common.rpc import proxy
+from neutron.tests import base
+from neutron.tests.unit import test_extension_security_group as test_sg
+from neutron.tests.unit import test_iptables_firewall as test_fw
class FakeSGCallback(sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
self.agent = sg_rpc.SecurityGroupAgentRpcMixin()
self.agent.context = None
self.addCleanup(mock.patch.stopall)
- mock.patch('quantum.agent.linux.iptables_manager').start()
+ mock.patch('neutron.agent.linux.iptables_manager').start()
self.agent.root_helper = 'sudo'
self.agent.init_firewall()
self.firewall = mock.Mock()
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-postrouting-bottom - [0:0]
+:neutron-postrouting-bottom - [0:0]
-A PREROUTING -j %(bn)s-PREROUTING
-A OUTPUT -j %(bn)s-OUTPUT
-A POSTROUTING -j %(bn)s-POSTROUTING
--A POSTROUTING -j quantum-postrouting-bottom
--A quantum-postrouting-bottom -j %(bn)s-snat
+-A POSTROUTING -j neutron-postrouting-bottom
+-A neutron-postrouting-bottom -j %(bn)s-snat
-A %(bn)s-snat -j %(bn)s-float-snat
""" % IPTABLES_ARG
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
:%(bn)s-(%(chains)s) - [0:0]
-:quantum-filter-top - [0:0]
--A FORWARD -j quantum-filter-top
--A OUTPUT -j quantum-filter-top
--A quantum-filter-top -j %(bn)s-local
+:neutron-filter-top - [0:0]
+-A FORWARD -j neutron-filter-top
+-A OUTPUT -j neutron-filter-top
+-A neutron-filter-top -j %(bn)s-local
-A INPUT -j %(bn)s-INPUT
-A OUTPUT -j %(bn)s-OUTPUT
-A FORWARD -j %(bn)s-FORWARD
-A %(bn)s-sg-fallback -j DROP
""" % IPTABLES_ARG
-FIREWALL_BASE_PACKAGE = 'quantum.agent.linux.iptables_firewall.'
+FIREWALL_BASE_PACKAGE = 'neutron.agent.linux.iptables_firewall.'
FIREWALL_IPTABLES_DRIVER = FIREWALL_BASE_PACKAGE + 'IptablesFirewallDriver'
FIREWALL_HYBRID_DRIVER = (FIREWALL_BASE_PACKAGE +
'OVSHybridIptablesFirewallDriver')
-FIREWALL_NOOP_DRIVER = 'quantum.agent.firewall.NoopFirewallDriver'
+FIREWALL_NOOP_DRIVER = 'neutron.agent.firewall.NoopFirewallDriver'
def set_firewall_driver(firewall_driver):
import webob.exc as webexc
import webtest
-from quantum.api import extensions
-from quantum.api.v2 import attributes
-from quantum import context
-from quantum.db import api as db_api
-from quantum.db import servicetype_db
-from quantum.extensions import servicetype
-from quantum import manager
-from quantum.plugins.common import constants
-from quantum.tests import base
-from quantum.tests.unit import dummy_plugin as dp
-from quantum.tests.unit import test_api_v2
-from quantum.tests.unit import test_db_plugin
-from quantum.tests.unit import test_extensions
-from quantum.tests.unit import testlib_api
+from neutron.api import extensions
+from neutron.api.v2 import attributes
+from neutron import context
+from neutron.db import api as db_api
+from neutron.db import servicetype_db
+from neutron.extensions import servicetype
+from neutron import manager
+from neutron.plugins.common import constants
+from neutron.tests import base
+from neutron.tests.unit import dummy_plugin as dp
+from neutron.tests.unit import test_api_v2
+from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit import test_extensions
+from neutron.tests.unit import testlib_api
LOG = logging.getLogger(__name__)
dp.DummyServicePlugin.__name__)])
self.addCleanup(cfg.CONF.reset)
# Make sure at each test a new instance of the plugin is returned
- manager.QuantumManager._instance = None
+ manager.NeutronManager._instance = None
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
ext_mgr = TestServiceTypeExtensionManager()
def _test_service_type_create(self, env=None,
expected_status=webexc.HTTPCreated.code):
tenant_id = 'fake'
- if env and 'quantum.context' in env:
- tenant_id = env['quantum.context'].tenant_id
+ if env and 'neutron.context' in env:
+ tenant_id = env['neutron.context'].tenant_id
data = {self.resource_name:
{'name': 'test',
def test_create_service_type_nonadminctx_returns_403(self):
tenant_id = _uuid()
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=False)}
self._test_service_type_create(
env=env, expected_status=webexc.HTTPForbidden.code)
def test_create_service_type_adminctx_returns_200(self):
- env = {'quantum.context': context.Context('', '', is_admin=True)}
+ env = {'neutron.context': context.Context('', '', is_admin=True)}
self._test_service_type_create(env=env)
def test_update_service_type_nonadminctx_returns_403(self):
tenant_id = _uuid()
- env = {'quantum.context': context.Context('', tenant_id,
+ env = {'neutron.context': context.Context('', tenant_id,
is_admin=False)}
self._test_service_type_update(
env=env, expected_status=webexc.HTTPForbidden.code)
def test_update_service_type_adminctx_returns_200(self):
- env = {'quantum.context': context.Context('', '', is_admin=True)}
+ env = {'neutron.context': context.Context('', '', is_admin=True)}
self._test_service_type_update(env=env)
self.conf.register_opts(servicetype_db.default_servicetype_opts,
'default_servicetype')
- def _write_quantum_conf(self, contents):
- (fd, path) = tempfile.mkstemp(prefix='quantum-', suffix='.conf')
+ def _write_neutron_conf(self, contents):
+ (fd, path) = tempfile.mkstemp(prefix='neutron-', suffix='.conf')
try:
os.write(fd, contents)
finally:
return path
def _test_default_servicetype_section(self, section_name):
- path = self._write_quantum_conf(
+ path = self._write_neutron_conf(
'[%(section_name)s]\n'
'description = test service type\n'
- 'service_definition=test:testing.QuantumTestPlugin\n' %
+ 'service_definition=test:testing.NeutronTestPlugin\n' %
{'section_name': section_name})
self.conf(['--config-file', path])
self.assertEqual(self.conf.default_servicetype.description,
'test service type')
self.assertEqual(self.conf.default_servicetype.service_definition,
- ['test:testing.QuantumTestPlugin'])
+ ['test:testing.NeutronTestPlugin'])
def test_default_servicetype_lowercase(self):
self._test_default_servicetype_section('default_servicetype')
import webob
import webob.exc
-from quantum.api.v2 import attributes
-from quantum.common import constants
-from quantum.common import exceptions as exception
-from quantum.tests import base
-from quantum import wsgi
+from neutron.api.v2 import attributes
+from neutron.common import constants
+from neutron.common import exceptions as exception
+from neutron.tests import base
+from neutron import wsgi
CONF = cfg.CONF
import testtools
-from quantum.api.v2 import attributes
-from quantum.tests import base
-from quantum import wsgi
+from neutron.api.v2 import attributes
+from neutron.tests import base
+from neutron import wsgi
class ExpectedException(testtools.ExpectedException):
req.headers['Accept'] = content_type
req.body = body
if context:
- req.environ['quantum.context'] = context
+ req.environ['neutron.context'] = context
return req
import pbr.version
-version_info = pbr.version.VersionInfo('quantum')
+version_info = pbr.version.VersionInfo('neutron')
import webob.dec
import webob.exc
-from quantum.common import constants
-from quantum.common import exceptions as exception
-from quantum import context
-from quantum.openstack.common import jsonutils
-from quantum.openstack.common import log as logging
+from neutron.common import constants
+from neutron.common import exceptions as exception
+from neutron import context
+from neutron.openstack.common import jsonutils
+from neutron.openstack.common import log as logging
socket_opts = [
cfg.IntOpt('backlog',
@property
def context(self):
- if 'quantum.context' not in self.environ:
- self.environ['quantum.context'] = context.get_admin_context()
- return self.environ['quantum.context']
+ if 'neutron.context' not in self.environ:
+ self.environ['neutron.context'] = context.get_admin_context()
+ return self.environ['neutron.context']
class ActionDispatcher(object):
which would result in a call to the `Wadl` class as
- import quantum.api.fancy_api
+ import neutron.api.fancy_api
fancy_api.Wadl(latest_version='1.3')
You could of course re-implement the `factory` method in subclasses,
module=uuidutils
# The base module to hold the copy of openstack.common
-base=quantum
+base=neutron
# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 OpenStack Foundation
+#
+# Copyright 2013 New Dream Network, LLC (DreamHost)
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# License for the specific language governing permissions and limitations
# under the License.
-import gettext
-
-
-gettext.install('quantum', unicode=1)
+# @author Mark McClain (DreamHost)
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Copyright 2013 New Dream Network, LLC (DreamHost)
+# 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.
+
+# @author Mark McClain (DreamHost)
+
+import sys
+import warnings
+
+from neutron import api
+from neutron.api import extensions
+from neutron.api import v2
+
+
+warnings.warn(
+ _('You are using old configuration values for the api-paste config. '
+ 'Please update for Neutron.')
+)
+sys.modules['quantum.api'] = api
+sys.modules['quantum.api.extensions'] = extensions
+sys.modules['quantum.api.v2'] = v2
# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2012 OpenStack Foundation
+#
+# Copyright 2013 New Dream Network, LLC (DreamHost)
+# 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
# License for the specific language governing permissions and limitations
# under the License.
-from oslo.config import cfg
-import webob.dec
-import webob.exc
-
-from quantum import context
-from quantum.openstack.common import log as logging
-from quantum import wsgi
-
-LOG = logging.getLogger(__name__)
-
-
-class QuantumKeystoneContext(wsgi.Middleware):
- """Make a request context from keystone headers."""
-
- @webob.dec.wsgify
- def __call__(self, req):
- # Determine the user ID
- user_id = req.headers.get('X_USER_ID', req.headers.get('X_USER'))
- if not user_id:
- LOG.debug(_("Neither X_USER_ID nor X_USER found in request"))
- return webob.exc.HTTPUnauthorized()
-
- # Determine the tenant
- tenant_id = req.headers.get('X_TENANT_ID', req.headers.get('X_TENANT'))
-
- # Suck out the roles
- roles = [r.strip() for r in req.headers.get('X_ROLE', '').split(',')]
+# @author Mark McClain (DreamHost)
- # Create a context with the authentication data
- ctx = context.Context(user_id, tenant_id, roles=roles)
+import warnings
- # Inject the context...
- req.environ['quantum.context'] = ctx
+from neutron import auth
- return self.application
+warnings.warn(
+ _('You are using old configuration values for the api-paste config. '
+ 'Please update for Neutron.')
+)
-def pipeline_factory(loader, global_conf, **local_conf):
- """Create a paste pipeline based on the 'auth_strategy' config option."""
- pipeline = local_conf[cfg.CONF.auth_strategy]
- pipeline = pipeline.split()
- filters = [loader.get_filter(n) for n in pipeline[:-1]]
- app = loader.get_app(pipeline[-1])
- filters.reverse()
- for filter in filters:
- app = filter(app)
- return app
+# For compatibility with old configurations
+QuantumKeystoneContext = auth.NeutronKeystoneContext
+pipeline_factory = auth.pipeline_factory
+++ /dev/null
-This directory contains the migration scripts for the Quantum project. Please
-see the README in quantum/db/migration on how to use and generate new
-migrations.
-
-
+++ /dev/null
-Cisco Quantum Virtual Network Plugin
-
-This plugin implements Quantum v2 APIs and helps configure
-topologies consisting of virtual and physical switches.
-
-For more details on use please refer to:
-http://wiki.openstack.org/cisco-quantum
+++ /dev/null
-PLUMgrid Quantum Virtual Network Plugin
-
-This plugin implements Quantum v2 APIs and helps configure
-L2/L3 virtual networks consisting of PLUMgrid Platform.
-
-For more details on use please refer to:
-http://wiki.openstack.org/plumgrid-quantum
iso8601>=0.1.4
kombu>=1.0.4
netaddr
-python-quantumclient>=2.2.0,<3.0.0
+python-neutronclient>=2.2.3,<3.0.0
pyudev
sqlalchemy>=0.7.8,<=0.7.99
WebOb>=1.2
# limitations under the License.
-"""Unittest runner for quantum
+"""Unittest runner for neutron
To run all test::
python run_tests.py
from nose import config
from nose import core
-from quantum.common.test_lib import run_tests
-import quantum.tests.unit
+from neutron.common.test_lib import run_tests
+import neutron.tests.unit
def main():
includeExe=True,
traverseNamespace=True,
plugins=core.DefaultPluginManager())
- c.configureWhere(quantum.tests.unit.__path__)
+ c.configureWhere(neutron.tests.unit.__path__)
sys.exit(run_tests(c))
if __name__ == "__main__":
function usage {
echo "Usage: $0 [OPTION]..."
- echo "Run Quantum's test suite(s)"
+ echo "Run Neutron's test suite(s)"
echo ""
echo " -V, --virtual-env Always use virtualenv. Install automatically if not present"
echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment"
if [ "$testropts" = "" ] && [ "$testrargs" = "" ]; then
# Default to running all tests if specific test is not
# provided.
- testrargs="discover ./quantum/tests"
+ testrargs="discover ./neutron/tests"
fi
${wrapper} python -m testtools.run $testropts $testrargs
echo "Generating coverage report in covhtml/"
# Don't compute coverage for common code, which is tested elsewhere
${wrapper} coverage combine
- ${wrapper} coverage html --include='quantum/*' --omit='quantum/openstack/common/*' -d covhtml -i
+ ${wrapper} coverage html --include='neutron/*' --omit='neutron/openstack/common/*' -d covhtml -i
fi
return $RESULT
[metadata]
-name = quantum
+name = neutron
version = 2013.2
summary = OpenStack Networking
description-file =
[files]
packages =
+ neutron
quantum
data_files =
- etc/quantum =
+ etc/neutron =
etc/api-paste.ini
etc/dhcp_agent.ini
etc/l3_agent.ini
etc/lbaas_agent.ini
etc/metadata_agent.ini
etc/policy.json
- etc/quantum.conf
+ etc/neutron.conf
etc/rootwrap.conf
- etc/quantum/rootwrap.d =
- etc/quantum/rootwrap.d/dhcp.filters
- etc/quantum/rootwrap.d/iptables-firewall.filters
- etc/quantum/rootwrap.d/l3.filters
- etc/quantum/rootwrap.d/lbaas-haproxy.filters
- etc/quantum/rootwrap.d/linuxbridge-plugin.filters
- etc/quantum/rootwrap.d/nec-plugin.filters
- etc/quantum/rootwrap.d/openvswitch-plugin.filters
- etc/quantum/rootwrap.d/ryu-plugin.filters
- etc/init.d = etc/init.d/quantum-server
- etc/quantum/plugins/bigswitch = etc/quantum/plugins/bigswitch/restproxy.ini
- etc/quantum/plugins/brocade = etc/quantum/plugins/brocade/brocade.ini
- etc/quantum/plugins/cisco = etc/quantum/plugins/cisco/cisco_plugins.ini
- etc/quantum/plugins/hyperv = etc/quantum/plugins/hyperv/hyperv_quantum_plugin.ini
- etc/quantum/plugins/linuxbridge = etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini
- etc/quantum/plugins/metaplugin = etc/quantum/plugins/metaplugin/metaplugin.ini
- etc/quantum/plugins/midonet = etc/quantum/plugins/midonet/midonet.ini
- etc/quantum/plugins/ml2 = etc/quantum/plugins/ml2/ml2_conf.ini
- etc/quantum/plugins/mlnx = etc/quantum/plugins/mlnx/mlnx_conf.ini
- etc/quantum/plugins/nec = etc/quantum/plugins/nec/nec.ini
- etc/quantum/plugins/nicira = etc/quantum/plugins/nicira/nvp.ini
- etc/quantum/plugins/openvswitch = etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
- etc/quantum/plugins/plumgrid = etc/quantum/plugins/plumgrid/plumgrid.ini
- etc/quantum/plugins/ryu = etc/quantum/plugins/ryu/ryu.ini
+ etc/neutron/rootwrap.d =
+ etc/neutron/rootwrap.d/dhcp.filters
+ etc/neutron/rootwrap.d/iptables-firewall.filters
+ etc/neutron/rootwrap.d/l3.filters
+ etc/neutron/rootwrap.d/lbaas-haproxy.filters
+ etc/neutron/rootwrap.d/linuxbridge-plugin.filters
+ etc/neutron/rootwrap.d/nec-plugin.filters
+ etc/neutron/rootwrap.d/openvswitch-plugin.filters
+ etc/neutron/rootwrap.d/ryu-plugin.filters
+ etc/init.d = etc/init.d/neutron-server
+ etc/neutron/plugins/bigswitch = etc/neutron/plugins/bigswitch/restproxy.ini
+ etc/neutron/plugins/brocade = etc/neutron/plugins/brocade/brocade.ini
+ etc/neutron/plugins/cisco = etc/neutron/plugins/cisco/cisco_plugins.ini
+ etc/neutron/plugins/hyperv = etc/neutron/plugins/hyperv/hyperv_neutron_plugin.ini
+ etc/neutron/plugins/linuxbridge = etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini
+ etc/neutron/plugins/metaplugin = etc/neutron/plugins/metaplugin/metaplugin.ini
+ etc/neutron/plugins/midonet = etc/neutron/plugins/midonet/midonet.ini
+ etc/neutron/plugins/ml2 = etc/neutron/plugins/ml2/ml2_conf.ini
+ etc/neutron/plugins/mlnx = etc/neutron/plugins/mlnx/mlnx_conf.ini
+ etc/neutron/plugins/nec = etc/neutron/plugins/nec/nec.ini
+ etc/neutron/plugins/nicira = etc/neutron/plugins/nicira/nvp.ini
+ etc/neutron/plugins/openvswitch = etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
+ etc/neutron/plugins/plumgrid = etc/neutron/plugins/plumgrid/plumgrid.ini
+ etc/neutron/plugins/ryu = etc/neutron/plugins/ryu/ryu.ini
scripts =
bin/quantum-rootwrap
+ bin/neutron-rootwrap
[global]
setup-hooks =
pbr.hooks.setup_hook
- quantum.hooks.setup_hook
+ neutron.hooks.setup_hook
[entry_points]
console_scripts =
- quantum-check-nvp-config = quantum.plugins.nicira.check_nvp_config:main
- quantum-db-manage = quantum.db.migration.cli:main
- quantum-debug = quantum.debug.shell:main
- quantum-dhcp-agent = quantum.agent.dhcp_agent:main
- quantum-dhcp-agent-dnsmasq-lease-update = quantum.agent.linux.dhcp:Dnsmasq.lease_update
- quantum-hyperv-agent = quantum.plugins.hyperv.agent.hyperv_quantum_agent:main
- quantum-l3-agent = quantum.agent.l3_agent:main
- quantum-lbaas-agent = quantum.services.loadbalancer.drivers.haproxy.agent:main
- quantum-linuxbridge-agent = quantum.plugins.linuxbridge.agent.linuxbridge_quantum_agent:main
- quantum-metadata-agent = quantum.agent.metadata.agent:main
- quantum-mlnx-agent = quantum.plugins.mlnx.agent.eswitch_quantum_agent:main
- quantum-nec-agent = quantum.plugins.nec.agent.nec_quantum_agent:main
- quantum-netns-cleanup = quantum.agent.netns_cleanup_util:main
- quantum-ns-metadata-proxy = quantum.agent.metadata.namespace_proxy:main
- quantum-openvswitch-agent = quantum.plugins.openvswitch.agent.ovs_quantum_agent:main
- quantum-ovs-cleanup = quantum.agent.ovs_cleanup_util:main
- quantum-ryu-agent = quantum.plugins.ryu.agent.ryu_quantum_agent:main
- quantum-server = quantum.server:main
-quantum.ml2.type_drivers =
- flat = quantum.plugins.ml2.drivers.type_flat:FlatTypeDriver
- local = quantum.plugins.ml2.drivers.type_local:LocalTypeDriver
- vlan = quantum.plugins.ml2.drivers.type_vlan:VlanTypeDriver
+ neutron-check-nvp-config = neutron.plugins.nicira.check_nvp_config:main
+ neutron-db-manage = neutron.db.migration.cli:main
+ neutron-debug = neutron.debug.shell:main
+ neutron-dhcp-agent = neutron.agent.dhcp_agent:main
+ neutron-dhcp-agent-dnsmasq-lease-update = neutron.agent.linux.dhcp:Dnsmasq.lease_update
+ neutron-hyperv-agent = neutron.plugins.hyperv.agent.hyperv_neutron_agent:main
+ neutron-l3-agent = neutron.agent.l3_agent:main
+ neutron-lbaas-agent = neutron.services.loadbalancer.drivers.haproxy.agent:main
+ neutron-linuxbridge-agent = neutron.plugins.linuxbridge.agent.linuxbridge_neutron_agent:main
+ neutron-metadata-agent = neutron.agent.metadata.agent:main
+ neutron-mlnx-agent = neutron.plugins.mlnx.agent.eswitch_neutron_agent:main
+ neutron-nec-agent = neutron.plugins.nec.agent.nec_neutron_agent:main
+ neutron-netns-cleanup = neutron.agent.netns_cleanup_util:main
+ neutron-ns-metadata-proxy = neutron.agent.metadata.namespace_proxy:main
+ neutron-openvswitch-agent = neutron.plugins.openvswitch.agent.ovs_neutron_agent:main
+ neutron-ovs-cleanup = neutron.agent.ovs_cleanup_util:main
+ neutron-ryu-agent = neutron.plugins.ryu.agent.ryu_neutron_agent:main
+ neutron-server = neutron.server:main
+ quantum-check-nvp-config = neutron.plugins.nicira.check_nvp_config:main
+ quantum-db-manage = neutron.db.migration.cli:main
+ quantum-debug = neutron.debug.shell:main
+ quantum-dhcp-agent = neutron.agent.dhcp_agent:main
+ quantum-dhcp-agent-dnsmasq-lease-update = neutron.agent.linux.dhcp:Dnsmasq.lease_update
+ quantum-hyperv-agent = neutron.plugins.hyperv.agent.hyperv_neutron_agent:main
+ quantum-l3-agent = neutron.agent.l3_agent:main
+ quantum-lbaas-agent = neutron.services.loadbalancer.drivers.haproxy.agent:main
+ quantum-linuxbridge-agent = neutron.plugins.linuxbridge.agent.linuxbridge_neutron_agent:main
+ quantum-metadata-agent = neutron.agent.metadata.agent:main
+ quantum-mlnx-agent = neutron.plugins.mlnx.agent.eswitch_neutron_agent:main
+ quantum-nec-agent = neutron.plugins.nec.agent.nec_neutron_agent:main
+ quantum-netns-cleanup = neutron.agent.netns_cleanup_util:main
+ quantum-ns-metadata-proxy = neutron.agent.metadata.namespace_proxy:main
+ quantum-openvswitch-agent = neutron.plugins.openvswitch.agent.ovs_neutron_agent:main
+ quantum-ovs-cleanup = neutron.agent.ovs_cleanup_util:main
+ quantum-ryu-agent = neutron.plugins.ryu.agent.ryu_neutron_agent:main
+ quantum-server = neutron.server:main
+neutron.ml2.type_drivers =
+ flat = neutron.plugins.ml2.drivers.type_flat:FlatTypeDriver
+ local = neutron.plugins.ml2.drivers.type_local:LocalTypeDriver
+ vlan = neutron.plugins.ml2.drivers.type_vlan:VlanTypeDriver
[build_sphinx]
all_files = 1
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
-output_file = quantum/locale/quantum.pot
+output_file = neutron/locale/neutron.pot
[compile_catalog]
-directory = quantum/locale
-domain = quantum
+directory = neutron/locale
+domain = neutron
[update_catalog]
-domain = quantum
-output_dir = quantum/locale
-input_file = quantum/locale/quantum.pot
+domain = neutron
+output_dir = neutron/locale
+input_file = neutron/locale/neutron.pot
rm -rf ./*.deb ./*.tar.gz ./*.dsc ./*.changes
rm -rf */*.deb
rm -rf ./plugins/**/build/ ./plugins/**/dist
-rm -rf ./plugins/**/lib/quantum_*_plugin.egg-info ./plugins/quantum-*
+rm -rf ./plugins/**/lib/neutron_*_plugin.egg-info ./plugins/neutron-*
]
-file_black_list = ["./quantum/tests/unit",
- "./quantum/openstack",
+file_black_list = ["./neutron/tests/unit",
+ "./neutron/openstack",
"./quantum/plugins/bigswitch/tests"]
# under the License.
"""
-Installation script for Quantum's development virtualenv
+Installation script for Neutron's development virtualenv
"""
import os
def print_help():
help = """
- Quantum development environment setup is complete.
+ Neutron development environment setup is complete.
- Quantum development uses virtualenv to track and manage Python dependencies
+ Neutron development uses virtualenv to track and manage Python dependencies
while in development and testing.
- To activate the Quantum virtualenv for the extent of your current shell
+ To activate the Neutron virtualenv for the extent of your current shell
session you can run:
$ source .venv/bin/activate
pip_requires = os.path.join(root, 'requirements.txt')
test_requires = os.path.join(root, 'test-requirements.txt')
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
- project = 'Quantum'
+ project = 'Neutron'
install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
py_version, project)
options = install.parse_args(argv)
os.path.join(root, 'tools', 'test-requires'),
])
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
- project = 'quantum'
+ project = 'neutron'
install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
py_version, project)
#NOTE(dprince): For Tox we only run post_process (which patches files, etc)
flake8
[testenv:i18n]
-commands = python ./tools/check_i18n.py ./quantum ./tools/i18n_cfg.py
+commands = python ./tools/check_i18n.py ./neutron ./tools/i18n_cfg.py
[testenv:cover]
commands =