Merge "Fix ServiceTypeNotFound and MGMTDriverNotSpecified"
This commit is contained in:
commit
255bd8c06e
@ -395,7 +395,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
raise vnfm.MGMTDriverNotSpecified()
|
raise vnfm.MGMTDriverNotSpecified()
|
||||||
if (not attributes.is_attr_set(service_types)):
|
if (not attributes.is_attr_set(service_types)):
|
||||||
LOG.debug(_('service types unspecified'))
|
LOG.debug(_('service types unspecified'))
|
||||||
raise vnfm.SeviceTypesNotSpecified()
|
raise vnfm.ServiceTypesNotSpecified()
|
||||||
|
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
template_id = str(uuid.uuid4())
|
template_id = str(uuid.uuid4())
|
||||||
|
@ -30,11 +30,15 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class InfraDriverNotSpecified(exceptions.InvalidInput):
|
class InfraDriverNotSpecified(exceptions.InvalidInput):
|
||||||
message = _('infra driver is not speicfied')
|
message = _('infra driver is not specified')
|
||||||
|
|
||||||
|
|
||||||
|
class MGMTDriverNotSpecified(exceptions.InvalidInput):
|
||||||
|
message = _('mgmt driver is not specified')
|
||||||
|
|
||||||
|
|
||||||
class ServiceTypesNotSpecified(exceptions.InvalidInput):
|
class ServiceTypesNotSpecified(exceptions.InvalidInput):
|
||||||
message = _('service types are not speicfied')
|
message = _('service types are not specified')
|
||||||
|
|
||||||
|
|
||||||
class DeviceTemplateInUse(exceptions.InUse):
|
class DeviceTemplateInUse(exceptions.InUse):
|
||||||
@ -69,7 +73,7 @@ class DeviceTemplateNotFound(exceptions.NotFound):
|
|||||||
message = _('device template %(device_tempalte_id)s could not be found')
|
message = _('device template %(device_tempalte_id)s could not be found')
|
||||||
|
|
||||||
|
|
||||||
class SeviceTypeNotFound(exceptions.NotFound):
|
class ServiceTypeNotFound(exceptions.NotFound):
|
||||||
message = _('service type %(service_type_id)s could not be found')
|
message = _('service type %(service_type_id)s could not be found')
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import uuid
|
|||||||
|
|
||||||
from tacker import context
|
from tacker import context
|
||||||
from tacker.db.vm import vm_db
|
from tacker.db.vm import vm_db
|
||||||
|
from tacker.extensions import vnfm
|
||||||
from tacker.tests.unit.db import base as db_base
|
from tacker.tests.unit.db import base as db_base
|
||||||
from tacker.tests.unit.db import utils
|
from tacker.tests.unit.db import utils
|
||||||
from tacker.vm import plugin
|
from tacker.vm import plugin
|
||||||
@ -116,6 +117,20 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
|||||||
device_template=
|
device_template=
|
||||||
mock.ANY)
|
mock.ANY)
|
||||||
|
|
||||||
|
def test_create_vnfd_no_service_types(self):
|
||||||
|
vnfd_obj = utils.get_dummy_vnfd_obj()
|
||||||
|
vnfd_obj['vnfd'].pop('service_types')
|
||||||
|
self.assertRaises(vnfm.ServiceTypesNotSpecified,
|
||||||
|
self.vnfm_plugin.create_vnfd,
|
||||||
|
self.context, vnfd_obj)
|
||||||
|
|
||||||
|
def test_create_vnfd_no_mgmt_driver(self):
|
||||||
|
vnfd_obj = utils.get_dummy_vnfd_obj()
|
||||||
|
vnfd_obj['vnfd'].pop('mgmt_driver')
|
||||||
|
self.assertRaises(vnfm.MGMTDriverNotSpecified,
|
||||||
|
self.vnfm_plugin.create_vnfd,
|
||||||
|
self.context, vnfd_obj)
|
||||||
|
|
||||||
def test_create_vnf(self):
|
def test_create_vnf(self):
|
||||||
self._insert_dummy_device_template()
|
self._insert_dummy_device_template()
|
||||||
vnf_obj = utils.get_dummy_vnf_obj()
|
vnf_obj = utils.get_dummy_vnf_obj()
|
||||||
|
Loading…
Reference in New Issue
Block a user