unite parameters for MgmtDriver interfaces
As implement SOL interfaces for MgmtDriver, "vnf_instante" and "addtional_params" are used as required parameters due to ETSI NFV-SOL001 v2.6.1 definition. However, for various usage and functions in tacker, these 2 parameters are not enough. Here the patch is aim to add required paramters for basic use of mgmtdriver interfaces. Thus, this patch is adding and uniting parameters for vnflcm interface calling. Target interface: * instantiate(start&end) * terminate(start&end) * scale(start&end) * heal(start&end) Parameters after change: * vnf_instance * request * grant(Currently None in terminate, need to fix in conductor) * grant_request(currently None, need to do some fix in conductor) Change-Id: I253d72ae09bd246ab3f1552185ce0a701a1f4b41
This commit is contained in:
parent
7e8a7351fa
commit
6e08ddc9a7
tacker
api/validation
tests
etc/samples/etsi/nfv/test_inst_terminate_vnf_with_vnflcmnoop
unit/vnflcm
vnflcm
vnfm/mgmt_drivers
@ -120,7 +120,8 @@ keyvalue_pairs = {
|
||||
'^[a-zA-Z0-9-_:. /]{1,255}$': {
|
||||
'anyOf': [
|
||||
{'type': 'array'},
|
||||
{'type': 'string', 'maxLength': 255}
|
||||
{'type': 'string', 'maxLength': 255},
|
||||
{'type': 'object'}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -29,40 +29,48 @@ class VnflcmMgmtNoop(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
|
||||
@log.log
|
||||
def instantiate_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
instantiate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def instantiate_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
instantiate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def terminate_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
terminate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def terminate_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
terminate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def scale_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
scale_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def scale_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
scale_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def heal_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
heal_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def heal_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
heal_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
@ -9,4 +9,4 @@ Content-type: application/x-iso9066-image
|
||||
Name: Scripts/vnflcm_noop.py
|
||||
Content-Type: text/x-python
|
||||
Algorithm: SHA-256
|
||||
Hash: ffea638bfdbde3fb01f191bbe75b031859b18d663b127100eb72b19eecd7ed51
|
||||
Hash: 63cfaf9963680ff864981d4db809c2ec175d78054157c0bcd43ac7a85973af10
|
||||
|
@ -802,7 +802,7 @@ class TestVnflcmDriver(db_base.SqlTestCase):
|
||||
uuidsentinel.instance_id
|
||||
self._mock_vnf_manager(fail_method_name='delete')
|
||||
driver = vnflcm_driver.VnfLcmDriver()
|
||||
vnf_dict = {"fake": "fake_dict"}
|
||||
vnf_dict = {"fake": "fake_dict", "grant": None}
|
||||
self.assertRaises(exceptions.VnfHealFailed,
|
||||
driver.heal_vnf, self.context, vnf_instance,
|
||||
vnf_dict, heal_vnf_req)
|
||||
@ -911,7 +911,8 @@ class TestVnflcmDriver(db_base.SqlTestCase):
|
||||
|
||||
self._mock_vnf_manager()
|
||||
driver = vnflcm_driver.VnfLcmDriver()
|
||||
driver.heal_vnf(self.context, vnf_instance, mock.ANY, heal_vnf_req)
|
||||
vnf_dict = {"grant": None}
|
||||
driver.heal_vnf(self.context, vnf_instance, vnf_dict, heal_vnf_req)
|
||||
self.assertEqual(1, mock_save.call_count)
|
||||
self.assertEqual(5, self._vnf_manager.invoke.call_count)
|
||||
|
||||
@ -946,9 +947,10 @@ class TestVnflcmDriver(db_base.SqlTestCase):
|
||||
mock_vnf_interfaces.return_value = fakes.return_vnf_interfaces()
|
||||
self._mock_vnf_manager(fail_method_name='heal_vnf')
|
||||
driver = vnflcm_driver.VnfLcmDriver()
|
||||
vnf_dict = {"grant": None}
|
||||
self.assertRaises(exceptions.VnfHealFailed,
|
||||
driver.heal_vnf, self.context, vnf_instance,
|
||||
mock.ANY, heal_vnf_req)
|
||||
vnf_dict, heal_vnf_req)
|
||||
self.assertEqual(1, mock_save.call_count)
|
||||
self.assertEqual(2, self._vnf_manager.invoke.call_count)
|
||||
|
||||
@ -987,6 +989,8 @@ class TestVnflcmDriver(db_base.SqlTestCase):
|
||||
uuidsentinel.instance_id
|
||||
self._mock_vnf_manager(fail_method_name='heal_vnf_wait')
|
||||
driver = vnflcm_driver.VnfLcmDriver()
|
||||
|
||||
vnf_dict = {"grant": None}
|
||||
# It won't raise any exception if infra driver raises
|
||||
# heal_vnf_wait because there is a possibility the vnfc
|
||||
# resources could go into inconsistent state so it would
|
||||
@ -994,7 +998,7 @@ class TestVnflcmDriver(db_base.SqlTestCase):
|
||||
# it will work and vnflcm can update the vnfc resources
|
||||
# properly and hence the _vnf_manager.invoke.call_count
|
||||
# should be 3 instead of 2.
|
||||
driver.heal_vnf(self.context, vnf_instance, mock.ANY,
|
||||
driver.heal_vnf(self.context, vnf_instance, vnf_dict,
|
||||
heal_vnf_req)
|
||||
self.assertEqual(1, mock_save.call_count)
|
||||
self.assertEqual(5, self._vnf_manager.invoke.call_count)
|
||||
@ -1035,9 +1039,10 @@ class TestVnflcmDriver(db_base.SqlTestCase):
|
||||
uuidsentinel.instance_id
|
||||
self._mock_vnf_manager(fail_method_name='post_heal_vnf')
|
||||
driver = vnflcm_driver.VnfLcmDriver()
|
||||
vnf_dict = {"grant": None}
|
||||
self.assertRaises(exceptions.VnfHealFailed,
|
||||
driver.heal_vnf, self.context, vnf_instance,
|
||||
mock.ANY, heal_vnf_req)
|
||||
vnf_dict, heal_vnf_req)
|
||||
self.assertEqual(1, mock_save.call_count)
|
||||
self.assertEqual(4, self._vnf_manager.invoke.call_count)
|
||||
|
||||
|
@ -488,22 +488,34 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
vnfd_dict = vnflcm_utils._get_vnfd_dict(
|
||||
context, vnf_instance.vnfd_id, instantiate_vnf_req.flavour_id)
|
||||
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request is not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'instantiate_start', vnf_instance, vnfd_dict),
|
||||
'instantiate_start', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=instantiate_vnf_req.additional_params)
|
||||
instantiate_vnf_request=instantiate_vnf_req,
|
||||
grant=vnf_dict.get('grant'), grant_request=None)
|
||||
|
||||
self._instantiate_vnf(context, vnf_instance, vnf_dict,
|
||||
vim_connection_info, instantiate_vnf_req)
|
||||
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request is not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'instantiate_end', vnf_instance, vnfd_dict),
|
||||
'instantiate_end', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=instantiate_vnf_req.additional_params)
|
||||
instantiate_vnf_request=instantiate_vnf_req,
|
||||
grant=vnf_dict.get('grant'), grant_request=None)
|
||||
|
||||
@log.log
|
||||
@revert_to_error_task_state
|
||||
@ -519,12 +531,18 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
context, vnf_instance.vnfd_id,
|
||||
vnf_instance.instantiated_vnf_info.flavour_id)
|
||||
|
||||
# TODO(LiangLu): grant_request and grant here is planned to
|
||||
# pass as a parameter, however due to they are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'terminate_start', vnf_instance, vnfd_dict),
|
||||
'terminate_start', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=terminate_vnf_req.additional_params)
|
||||
terminate_vnf_request=terminate_vnf_req,
|
||||
grant=None, grant_request=None)
|
||||
LOG.info("Terminating vnf %s", vnf_instance.id)
|
||||
try:
|
||||
self._delete_vnf_instance_resources(context, vnf_instance,
|
||||
@ -540,12 +558,18 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
LOG.error("Unable to terminate vnf '%s' instance. "
|
||||
"Error: %s", vnf_instance.id,
|
||||
encodeutils.exception_to_unicode(exp))
|
||||
# TODO(LiangLu): grant_request and grant here is planned to
|
||||
# pass as a parameter, however due to they are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'terminate_end', vnf_instance, vnfd_dict),
|
||||
'terminate_end', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=terminate_vnf_req.additional_params)
|
||||
terminate_vnf_request=terminate_vnf_req,
|
||||
grant=None, grant_request=None)
|
||||
|
||||
def _delete_vnf_instance_resources(self, context, vnf_instance,
|
||||
vim_connection_info, terminate_vnf_req=None,
|
||||
@ -705,13 +729,18 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
vnfd_dict = vnflcm_utils._get_vnfd_dict(
|
||||
context, vnf_instance.vnfd_id,
|
||||
vnf_instance.instantiated_vnf_info.flavour_id)
|
||||
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'heal_start', vnf_instance, vnfd_dict),
|
||||
'heal_start', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=heal_vnf_request.additional_params)
|
||||
heal_vnf_request=heal_vnf_request,
|
||||
grant=vnf_dict.get('grant'), grant_request=None)
|
||||
|
||||
if not heal_vnf_request.vnfc_instance_id:
|
||||
self._respawn_vnf(context, vnf_instance, vnf_dict,
|
||||
@ -722,12 +751,18 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
|
||||
LOG.info("Request received for healing vnf '%s' is completed "
|
||||
"successfully", vnf_instance.id)
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'heal_end', vnf_instance, vnfd_dict),
|
||||
'heal_end', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=heal_vnf_request.additional_params)
|
||||
heal_vnf_request=heal_vnf_request,
|
||||
grant=vnf_dict.get('grant'), grant_request=None)
|
||||
|
||||
def _scale_vnf_pre(self, context, vnf_info, vnf_instance,
|
||||
scale_vnf_request, vim_connection_info):
|
||||
@ -761,15 +796,21 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
number_of_steps=scale_vnf_request.number_of_steps
|
||||
)
|
||||
vnf_info['res_num'] = res_num
|
||||
|
||||
# mgmt_driver pre
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
if len(scale_id_list) != 0:
|
||||
kwargs = {'scale_name_list': scale_name_list}
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'scale_start', vnf_instance, vnfd_dict),
|
||||
'scale_start', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=scale_vnf_request.additional_params)
|
||||
scale_vnf_request=scale_vnf_request,
|
||||
grant=vnf_info.get('grant'), grant_request=None,
|
||||
**kwargs)
|
||||
else:
|
||||
vnf_info['action'] = 'out'
|
||||
scale_id_list = self._vnf_manager.invoke(
|
||||
@ -816,13 +857,21 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
id_list = []
|
||||
id_list = list(set(scale_id_after) - set(scale_id_list))
|
||||
vnf_info['res_num'] = len(scale_id_after)
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
if len(id_list) != 0:
|
||||
kwargs = {'scale_out_id_list': id_list}
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
context, 'scale_end', vnf_instance, vnfd_dict),
|
||||
'scale_end', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=scale_vnf_request.additional_params)
|
||||
scale_vnf_request=scale_vnf_request,
|
||||
grant=vnf_info.get('grant'), grant_request=None,
|
||||
**kwargs)
|
||||
vnf_lcm_op_occ.error_point = 7
|
||||
vnf_instance.instantiated_vnf_info.scale_level =\
|
||||
vnf_info['after_scale_level']
|
||||
@ -1370,18 +1419,30 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
|
||||
vnf_info['action'] = 'in'
|
||||
if len(scale_id_list) != 0:
|
||||
kwargs = {'scale_name_list': scale_name_list}
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(context, 'scale_start',
|
||||
vnf_instance, vnfd_dict),
|
||||
'scale_start', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=scale_vnf_request.additional_params)
|
||||
scale_vnf_request=scale_vnf_request,
|
||||
grant=vnf_info.get('grant'), grant_request=None,
|
||||
**kwargs)
|
||||
|
||||
else:
|
||||
vnfd_dict = vnflcm_utils._get_vnfd_dict(
|
||||
context, vnf_instance.vnfd_id,
|
||||
vnf_instance.instantiated_vnf_info.flavour_id)
|
||||
|
||||
# TODO(LiangLu): grant_request and grant here is planned to
|
||||
# pass as a parameter, however due to they are not
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
if len(scale_id_list) != 0:
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
@ -1389,7 +1450,8 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
vnf_instance, vnfd_dict),
|
||||
'terminate_start', context=context,
|
||||
vnf_instance=vnf_instance,
|
||||
additional_params=scale_vnf_request.additional_params)
|
||||
terminate_vnf_request=None,
|
||||
grant=None, grant_request=None)
|
||||
vnf_lcm_op_occs.error_point = 6
|
||||
|
||||
return scale_name_list, grp_id
|
||||
|
@ -38,40 +38,48 @@ class VnflcmMgmtAbstractDriver(metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def instantiate_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
instantiate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def instantiate_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
instantiate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def terminate_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
terminate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def terminate_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
terminate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def scale_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
scale_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def scale_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
scale_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def heal_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
heal_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def heal_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
heal_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
@ -29,40 +29,48 @@ class VnflcmMgmtNoop(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
|
||||
@log.log
|
||||
def instantiate_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
instantiate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def instantiate_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
instantiate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def terminate_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
terminate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def terminate_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
terminate_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def scale_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
scale_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def scale_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
scale_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def heal_start(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
heal_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def heal_end(self, context, vnf_instance,
|
||||
additional_params, **kwargs):
|
||||
heal_vnf_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user