Add unit test to validate non DB base core plugin can be loaded

Thanks to the patch I872fa6e3c3925e521150d79bba864101d9a5f648, if a core
plugin is not based on the Neutron DB model, Neutron Manager does not
fail anymore to initialize DB dependent default service plugins.

Change-Id: I948876a7ea7acb0953f622c399dada2148f57571
Partial-Bug: #1700651
This commit is contained in:
Édouard Thuleau 2017-11-12 21:52:10 +11:00 committed by Miguel Lavalle
parent 69d0047cfe
commit bcc57a4aed
2 changed files with 78 additions and 0 deletions

View File

@ -22,6 +22,7 @@ from neutron.api import extensions
from neutron.api.v2 import base
from neutron.db import servicetype_db
from neutron.extensions import servicetype
from neutron import neutron_plugin_base_v2
RESOURCE_NAME = "dummy"
@ -129,3 +130,54 @@ class DummyServicePlugin(service_base.ServicePluginBase):
svc_type_id)
except KeyError:
raise exceptions.NotFound()
class DummyCorePluginWithoutDatastore(
neutron_plugin_base_v2.NeutronPluginBaseV2):
def create_subnet(self, context, subnet):
pass
def update_subnet(self, context, id, subnet):
pass
def get_subnet(self, context, id, fields=None):
pass
def get_subnets(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
pass
def delete_subnet(self, context, id):
pass
def create_network(self, context, network):
pass
def update_network(self, context, id, network):
pass
def get_network(self, context, id, fields=None):
pass
def get_networks(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
pass
def delete_network(self, context, id):
pass
def create_port(self, context, port):
pass
def update_port(self, context, id, port):
pass
def get_port(self, context, id, fields=None):
pass
def get_ports(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
pass
def delete_port(self, context, id):
pass

View File

@ -0,0 +1,26 @@
# Copyright (c) 2017 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
from neutron import manager
from neutron.tests import base
class NeutronPluginBaseV2TestCase(base.BaseTestCase):
def test_can_load_core_plugin_without_datastore(self):
cfg.CONF.set_override("core_plugin", 'neutron.tests.unit.dummy_plugin.'
'DummyCorePluginWithoutDatastore')
manager.init()