Merge "Device refactor part4: rename vm plugin and db into vnfm plugin and db"
This commit is contained in:
commit
0988954e15
@ -22,16 +22,16 @@ How to write a new monitor driver
|
|||||||
|
|
||||||
A monitor driver for tacker is a python module which contains a class that
|
A monitor driver for tacker is a python module which contains a class that
|
||||||
inherits from
|
inherits from
|
||||||
"tacker.vm.monitor_drivers.abstract_driver.VNFMonitorAbstractDriver". If the
|
"tacker.vnfm.monitor_drivers.abstract_driver.VNFMonitorAbstractDriver". If the
|
||||||
driver depends/imports more than one module, then create a new python package
|
driver depends/imports more than one module, then create a new python package
|
||||||
under tacker/vm/monitor_drivers folder. After this we have to mention our
|
under tacker/vnfm/monitor_drivers folder. After this we have to mention our
|
||||||
driver path in setup.cfg file in root directory.
|
driver path in setup.cfg file in root directory.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
::
|
::
|
||||||
|
|
||||||
tacker.tacker.monitor_drivers =
|
tacker.tacker.monitor_drivers =
|
||||||
ping = tacker.vm.monitor_drivers.ping.ping:VNFMonitorPing
|
ping = tacker.vnfm.monitor_drivers.ping.ping:VNFMonitorPing
|
||||||
|
|
||||||
Following methods need to be overridden in the new driver:
|
Following methods need to be overridden in the new driver:
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ network function.
|
|||||||
flavor describing physical properties for the VDU to be spawned, monitoring
|
flavor describing physical properties for the VDU to be spawned, monitoring
|
||||||
policies for the VDU, providing user data in form of custom commands to the
|
policies for the VDU, providing user data in form of custom commands to the
|
||||||
VDU. A complete list of VDU properties currently supported by Tacker are
|
VDU. A complete list of VDU properties currently supported by Tacker are
|
||||||
listed `here <https://github.com/openstack/tacker/blob/master/tacker/vm/
|
listed `here <https://github.com/openstack/tacker/blob/master/tacker/vnfm/
|
||||||
tosca/lib/tacker_nfv_defs.yaml>`_ under **properties** section of
|
tosca/lib/tacker_nfv_defs.yaml>`_ under **properties** section of
|
||||||
**tosca.nodes.nfv.VDU.Tacker** field
|
**tosca.nodes.nfv.VDU.Tacker** field
|
||||||
|
|
||||||
|
@ -40,14 +40,14 @@ console_scripts =
|
|||||||
tacker-rootwrap = oslo.rootwrap.cmd:main
|
tacker-rootwrap = oslo.rootwrap.cmd:main
|
||||||
tacker.service_plugins =
|
tacker.service_plugins =
|
||||||
dummy = tacker.tests.unit.dummy_plugin:DummyServicePlugin
|
dummy = tacker.tests.unit.dummy_plugin:DummyServicePlugin
|
||||||
vnfm = tacker.vm.plugin:VNFMPlugin
|
vnfm = tacker.vnfm.plugin:VNFMPlugin
|
||||||
nfvo = tacker.nfvo.nfvo_plugin:NfvoPlugin
|
nfvo = tacker.nfvo.nfvo_plugin:NfvoPlugin
|
||||||
commonservices = tacker.plugins.common_services.common_services_plugin:CommonServicesPlugin
|
commonservices = tacker.plugins.common_services.common_services_plugin:CommonServicesPlugin
|
||||||
tacker.nfvo.vim.drivers =
|
tacker.nfvo.vim.drivers =
|
||||||
openstack = tacker.nfvo.drivers.vim.openstack_driver:OpenStack_Driver
|
openstack = tacker.nfvo.drivers.vim.openstack_driver:OpenStack_Driver
|
||||||
tacker.openstack.common.cache.backends =
|
tacker.openstack.common.cache.backends =
|
||||||
memory = tacker.openstack.common.cache._backends.memory:MemoryBackend
|
memory = tacker.openstack.common.cache._backends.memory:MemoryBackend
|
||||||
tacker.tacker.device.drivers =
|
tacker.tacker.vnfm.drivers =
|
||||||
noop = tacker.vnfm.infra_drivers.noop:DeviceNoop
|
noop = tacker.vnfm.infra_drivers.noop:DeviceNoop
|
||||||
nova = tacker.vnfm.infra_drivers.nova.nova:DeviceNova
|
nova = tacker.vnfm.infra_drivers.nova.nova:DeviceNova
|
||||||
heat = tacker.vnfm.infra_drivers.heat.heat:DeviceHeat
|
heat = tacker.vnfm.infra_drivers.heat.heat:DeviceHeat
|
||||||
@ -65,7 +65,7 @@ oslo.config.opts =
|
|||||||
tacker.nfvo.nfvo_plugin = tacker.nfvo.nfvo_plugin:config_opts
|
tacker.nfvo.nfvo_plugin = tacker.nfvo.nfvo_plugin:config_opts
|
||||||
tacker.nfvo.drivers.vim.openstack_driver = tacker.nfvo.drivers.vim.openstack_driver:config_opts
|
tacker.nfvo.drivers.vim.openstack_driver = tacker.nfvo.drivers.vim.openstack_driver:config_opts
|
||||||
tacker.vnfm.monitor = tacker.vnfm.monitor:config_opts
|
tacker.vnfm.monitor = tacker.vnfm.monitor:config_opts
|
||||||
tacker.vnfm.plugin = tacker.vm.plugin:config_opts
|
tacker.vnfm.plugin = tacker.vnfm.plugin:config_opts
|
||||||
tacker.vnfm.vim_client = tacker.vnfm.vim_client:config_opts
|
tacker.vnfm.vim_client = tacker.vnfm.vim_client:config_opts
|
||||||
tacker.vnfm.infra_drivers.heat.heat= tacker.vnfm.infra_drivers.heat.heat:config_opts
|
tacker.vnfm.infra_drivers.heat.heat= tacker.vnfm.infra_drivers.heat.heat:config_opts
|
||||||
tacker.vnfm.infra_drivers.openstack.openstack= tacker.vnfm.infra_drivers.openstack.openstack:config_opts
|
tacker.vnfm.infra_drivers.openstack.openstack= tacker.vnfm.infra_drivers.openstack.openstack:config_opts
|
||||||
|
@ -24,7 +24,7 @@ Based on this comparison database can be healed with healing migration.
|
|||||||
from tacker.db import model_base
|
from tacker.db import model_base
|
||||||
from tacker.db.nfvo import nfvo_db # noqa
|
from tacker.db.nfvo import nfvo_db # noqa
|
||||||
from tacker.db.nfvo import vnffg_db # noqa
|
from tacker.db.nfvo import vnffg_db # noqa
|
||||||
from tacker.db.vm import vm_db # noqa
|
from tacker.db.vnfm import vnfm_db # noqa
|
||||||
|
|
||||||
|
|
||||||
def get_metadata():
|
def get_metadata():
|
||||||
|
@ -28,7 +28,7 @@ from tacker.db import db_base
|
|||||||
from tacker.db import model_base
|
from tacker.db import model_base
|
||||||
from tacker.db import models_v1
|
from tacker.db import models_v1
|
||||||
from tacker.db import types
|
from tacker.db import types
|
||||||
from tacker.db.vm import vm_db
|
from tacker.db.vnfm import vnfm_db
|
||||||
from tacker.extensions import nfvo
|
from tacker.extensions import nfvo
|
||||||
from tacker import manager
|
from tacker import manager
|
||||||
from tacker.plugins.common import constants
|
from tacker.plugins.common import constants
|
||||||
@ -167,7 +167,7 @@ class NfvoPluginDb(nfvo.NFVOPluginBase, db_base.CommonDbMixin):
|
|||||||
|
|
||||||
def is_vim_still_in_use(self, context, vim_id):
|
def is_vim_still_in_use(self, context, vim_id):
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
vnfs_db = self._model_query(context, vm_db.VNF).filter_by(
|
vnfs_db = self._model_query(context, vnfm_db.VNF).filter_by(
|
||||||
vim_id=vim_id).first()
|
vim_id=vim_id).first()
|
||||||
if vnfs_db is not None:
|
if vnfs_db is not None:
|
||||||
raise nfvo.VimInUseException(vim_id=vim_id)
|
raise nfvo.VimInUseException(vim_id=vim_id)
|
||||||
|
@ -21,12 +21,12 @@ import yaml
|
|||||||
from tacker import context
|
from tacker import context
|
||||||
from tacker.db.common_services import common_services_db
|
from tacker.db.common_services import common_services_db
|
||||||
from tacker.db.nfvo import nfvo_db
|
from tacker.db.nfvo import nfvo_db
|
||||||
from tacker.db.vm import vm_db
|
from tacker.db.vnfm import vnfm_db
|
||||||
from tacker.extensions import vnfm
|
from tacker.extensions import vnfm
|
||||||
from tacker.plugins.common import constants
|
from tacker.plugins.common import constants
|
||||||
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.vnfm import plugin
|
||||||
|
|
||||||
|
|
||||||
class FakeDriverManager(mock.Mock):
|
class FakeDriverManager(mock.Mock):
|
||||||
@ -108,7 +108,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
|||||||
|
|
||||||
def _insert_dummy_device_template(self):
|
def _insert_dummy_device_template(self):
|
||||||
session = self.context.session
|
session = self.context.session
|
||||||
device_template = vm_db.VNFD(
|
device_template = vnfm_db.VNFD(
|
||||||
id='eb094833-995e-49f0-a047-dfb56aaf7c4e',
|
id='eb094833-995e-49f0-a047-dfb56aaf7c4e',
|
||||||
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
|
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
|
||||||
name='fake_template',
|
name='fake_template',
|
||||||
@ -121,7 +121,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
|||||||
|
|
||||||
def _insert_dummy_device(self):
|
def _insert_dummy_device(self):
|
||||||
session = self.context.session
|
session = self.context.session
|
||||||
device_db = vm_db.VNF(
|
device_db = vnfm_db.VNF(
|
||||||
id='6261579e-d6f3-49ad-8bc3-a9cb974778ff',
|
id='6261579e-d6f3-49ad-8bc3-a9cb974778ff',
|
||||||
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
|
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
|
||||||
name='fake_device',
|
name='fake_device',
|
||||||
@ -156,9 +156,9 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
|||||||
session.add(vim_auth_db)
|
session.add(vim_auth_db)
|
||||||
session.flush()
|
session.flush()
|
||||||
|
|
||||||
@mock.patch('tacker.vm.plugin.toscautils.updateimports')
|
@mock.patch('tacker.vnfm.plugin.toscautils.updateimports')
|
||||||
@mock.patch('tacker.vm.plugin.ToscaTemplate')
|
@mock.patch('tacker.vnfm.plugin.ToscaTemplate')
|
||||||
@mock.patch('tacker.vm.plugin.toscautils.get_mgmt_driver')
|
@mock.patch('tacker.vnfm.plugin.toscautils.get_mgmt_driver')
|
||||||
def test_create_vnfd(self, mock_get_mgmt_driver, mock_tosca_template,
|
def test_create_vnfd(self, mock_get_mgmt_driver, mock_tosca_template,
|
||||||
mock_update_imports):
|
mock_update_imports):
|
||||||
mock_get_mgmt_driver.return_value = 'dummy_mgmt_driver'
|
mock_get_mgmt_driver.return_value = 'dummy_mgmt_driver'
|
||||||
|
@ -30,7 +30,7 @@ from tacker.api.v1 import attributes
|
|||||||
from tacker.common import driver_manager
|
from tacker.common import driver_manager
|
||||||
from tacker.common import exceptions
|
from tacker.common import exceptions
|
||||||
from tacker.common import utils
|
from tacker.common import utils
|
||||||
from tacker.db.vm import vm_db
|
from tacker.db.vnfm import vnfm_db
|
||||||
from tacker.extensions import vnfm
|
from tacker.extensions import vnfm
|
||||||
from tacker.plugins.common import constants
|
from tacker.plugins.common import constants
|
||||||
from tacker.vnfm.mgmt_drivers import constants as mgmt_constants
|
from tacker.vnfm.mgmt_drivers import constants as mgmt_constants
|
||||||
@ -107,7 +107,7 @@ class VNFMMgmtMixin(object):
|
|||||||
kwargs=kwargs)
|
kwargs=kwargs)
|
||||||
|
|
||||||
|
|
||||||
class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin):
|
class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin):
|
||||||
"""VNFMPlugin which supports VNFM framework.
|
"""VNFMPlugin which supports VNFM framework.
|
||||||
|
|
||||||
Plugin which supports Tacker framework
|
Plugin which supports Tacker framework
|
||||||
@ -126,7 +126,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin):
|
|||||||
self.boot_wait = cfg.CONF.tacker.boot_wait
|
self.boot_wait = cfg.CONF.tacker.boot_wait
|
||||||
self.vim_client = vim_client.VimClient()
|
self.vim_client = vim_client.VimClient()
|
||||||
self._vnf_manager = driver_manager.DriverManager(
|
self._vnf_manager = driver_manager.DriverManager(
|
||||||
'tacker.tacker.device.drivers',
|
'tacker.tacker.vnfm.drivers',
|
||||||
cfg.CONF.tacker.infra_driver)
|
cfg.CONF.tacker.infra_driver)
|
||||||
self._vnf_monitor = monitor.VNFMonitor(self.boot_wait)
|
self._vnf_monitor = monitor.VNFMonitor(self.boot_wait)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user