vmware-nsx/neutron/tests/unit/ml2/test_ml2_plugin.py
Francois Eleouet 62040d03b3 Add ext-gw-mode support to ML2
Closes-Bug: #1212772

ML2 doesn't support ext-gw-mode, resulting in L3 agents not
setting-up NAT rules in neutron routers (currently, l3 agents
will assume enable_snat=false if plugin doesn't provide this
parameter as described in bug 1212868)

This patchset adds the support of ext-gw-mode to ML2 plugin.

In order to support ext-gw-mode alembic migration (as well as
other potential migrations on plugin dbs), folsom_initial
migration script is fixed to include ML2 plugin. Otherwise
databases won't be set-up during migration script (but at
plugin startup by sqlalchemy), resulting in migration failures.

Change-Id: I95ec18e0a4f0e5b661f3a5d679c434f18f100fa6
2013-08-19 20:21:40 +02:00

78 lines
2.4 KiB
Python

# Copyright (c) 2013 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.plugins.ml2 import config as config
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_extension_ext_gw_mode
PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = PLUGIN_NAME
def setUp(self):
# Enable the test mechanism driver to ensure that
# we can successfully call through to all mechanism
# driver apis.
config.cfg.CONF.set_override('mechanism_drivers',
['logger', 'test'],
'ml2')
self.addCleanup(config.cfg.CONF.reset)
super(Ml2PluginV2TestCase, self).setUp(PLUGIN_NAME)
self.port_create_status = 'DOWN'
class TestMl2BasicGet(test_plugin.TestBasicGet,
Ml2PluginV2TestCase):
pass
class TestMl2V2HTTPResponse(test_plugin.TestV2HTTPResponse,
Ml2PluginV2TestCase):
pass
class TestMl2NetworksV2(test_plugin.TestNetworksV2,
Ml2PluginV2TestCase):
pass
class TestMl2PortsV2(test_plugin.TestPortsV2, Ml2PluginV2TestCase):
def test_update_port_status_build(self):
with self.port() as port:
self.assertEqual(port['port']['status'], 'DOWN')
self.assertEqual(self.port_create_status, 'DOWN')
# TODO(rkukura) add TestMl2PortBinding
# TODO(rkukura) add TestMl2PortBindingNoSG
class TestMl2PortBindingHost(Ml2PluginV2TestCase,
test_bindings.PortBindingsHostTestCaseMixin):
pass
class TestMl2ExtGwModeSupport(Ml2PluginV2TestCase,
test_extension_ext_gw_mode.ExtGwModeTestCase):
pass