@ -264,10 +264,126 @@ class TestOpenStack(base.FixturedTestCase):
vnf_resource = type ( ' ' , ( ) , { } )
vnf_resource . resource_identifier = constants . INVALID_UUID
grant_info_test = { ' vdu_name ' : { vnf_resource } }
nested_hot_dict = { ' parameters ' : { ' vnf ' : ' test ' } }
nested_hot_dict = {
' VDU1.yaml ' : { ' parameters ' : { ' vnf ' : ' test ' ,
' zone ' : { ' type ' : ' string ' } } ,
' resources ' : { ' VDU1 ' : { ' properties ' :
{ ' availability_zone ' : { ' get_param ' : ' zone ' } } } } } }
base_hot_dict = self . _read_file ( )
base_hot_dict [ ' resources ' ] [ ' VDU1 ' ] [ ' properties ' ] . setdefault (
' resource ' , { ' properties ' : { ' zone ' :
{ ' get_param ' : [ ' nfv ' , ' vdu ' , ' VDU1 ' , ' zone ' ] } } } )
mock_get_base_hot_dict . return_value = \
base_hot_dict , nested_hot_dict
vim_assets = { ' compute_resource_flavours ' : [
{ ' vim_connection_id ' : uuidsentinel . vim_id ,
' vnfd_virtual_compute_desc_id ' : ' VDU1 ' ,
' vim_flavour_id ' : ' m1.tiny ' } ] ,
' softwareImages ' : [
{ ' vim_connection_id ' : uuidsentinel . vim_id ,
' vnfd_software_image_id ' : ' VDU1 ' ,
' vim_software_image_id ' : ' cirros ' } ] }
res_add_resource = [ ]
resource = {
' resource_definition_id ' : ' 2c6e5cc7-240d-4458-a683-1fe648351280 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa9 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa0 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa1 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
zone = {
' id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' ,
' zone_id ' : ' nova ' ,
' vim_connection_id ' : uuidsentinel . vim_id }
vim_obj = { ' id ' : ' 0b9c66bb-9e1f-4bb2-92c3-913074e52e2b ' ,
' vim_id ' : uuidsentinel . vim_id ,
' vim_type ' : ' openstack ' ,
' access_info ' : {
' password ' : ' test_pw ' ,
' username ' : ' test_user ' ,
' region ' : ' test_region ' ,
' tenant ' : uuidsentinel . tenant } }
grant_dict = { }
grant_dict [ ' id ' ] = ' c213e465-8220-487e-9464-f79104e81e96 '
grant_dict [ ' vnf_instance_id ' ] = uuidsentinel . vnf_instance_id
grant_dict [ ' vnf_lcm_op_occ_id ' ] = uuidsentinel . vnf_lcm_op_occ_id
grant_dict [ ' add_resources ' ] = [ ]
grant_dict [ ' add_resources ' ] . extend ( res_add_resource )
grant_dict [ ' vim_assets ' ] = vim_assets
grant_dict [ ' zones ' ] = [ zone ]
grant_dict [ ' vim_connections ' ] = [ vim_obj ]
grant_obj = objects . Grant . obj_from_primitive (
grant_dict , context = self . context )
vnf [ ' grant ' ] = grant_obj
vnf_instance = fd_utils . get_vnf_instance_object ( )
vnf_instance . instantiated_vnf_info . reinitialize ( )
vnfc_obj = objects . VnfcResourceInfo ( )
vnfc_obj . id = ' 2c6e5cc7-240d-4458-a683-1fe648351280 '
vnfc_obj . vdu_id = ' VDU1 '
vnfc_obj . storage_resource_ids = \
[ ' faf14707-da7c-4eec-be99-8099fa1e9fa0 ' ]
compute_resource = objects . ResourceHandle (
vim_connection_id = uuidsentinel . vim_id ,
resource_id = ' 6e1c286d-c023-4b34-8369-831c6e84cce2 ' )
vnfc_obj . compute_resource = compute_resource
vnf_instance . instantiated_vnf_info . vnfc_resource_info = [ vnfc_obj ]
self . openstack . create ( self . plugin , self . context , vnf ,
self . auth_attr , inst_req_info = inst_req_info_test ,
vnf_package_path = vnf_package_path_test ,
grant_info = grant_info_test ,
vnf_instance = vnf_instance )
@mock . patch ( ' tacker.vnfm.vim_client.VimClient.get_vim ' )
@mock . patch ( ' tacker.vnfm.infra_drivers.openstack.openstack '
' .OpenStack._format_base_hot ' )
@mock . patch ( ' tacker.vnflcm.utils.get_base_nest_hot_dict ' )
@mock . patch ( ' tacker.common.clients.OpenstackClients ' )
def test_create_grant_zone_add ( self , mock_OpenstackClients_heat ,
mock_get_base_hot_dict ,
mock_format_base_hot ,
mock_get_vim ) :
mock_get_vim . return_value = {
' vim_id ' : uuidsentinel . vnfd_id ,
' vim_type ' : ' test ' ,
' vim_auth ' : { ' username ' : ' test ' , ' password ' : ' test ' } ,
' placement_attr ' : { ' region ' : ' TestRegionOne ' } ,
' tenant ' : ' test '
}
vnf = utils . get_dummy_vnf_etsi ( instance_id = self . instance_uuid ,
flavour = ' simple ' )
vnf [ ' placement_attr ' ] = { ' region_name ' : ' dummy_region ' }
vnf_package_path_test = os . path . abspath (
os . path . join ( os . path . dirname ( __file__ ) ,
" ../../../../etc/samples/etsi/nfv " ,
" user_data_sample_normal " ) )
inst_req_info_test = type ( ' ' , ( ) , { } )
test_json = self . _json_load (
' instantiate_vnf_request_lcm_userdata.json ' )
inst_req_info_test . additional_params = test_json [ ' additionalParams ' ]
inst_req_info_test . ext_virtual_links = None
inst_req_info_test . flavour_id = ' simple '
vnf_resource = type ( ' ' , ( ) , { } )
vnf_resource . resource_identifier = constants . INVALID_UUID
grant_info_test = { ' vdu_name ' : { vnf_resource } }
nested_hot_dict = {
' VDU1.yaml ' : { ' parameters ' : { ' vnf ' : ' test ' } ,
' resources ' : { ' VDU1 ' : { ' properties ' : { } } } } }
mock_get_base_hot_dict . return_value = \
self . _read_file ( ) , nested_hot_dict
vimAssets = { ' compute_resource_flavours ' : [
vim_a ssets = { ' compute_resource_flavours ' : [
{ ' vim_connection_id ' : uuidsentinel . vim_id ,
' vnfd_virtual_compute_desc_id ' : ' VDU1 ' ,
' vim_flavour_id ' : ' m1.tiny ' } ] ,
@ -275,27 +391,27 @@ class TestOpenStack(base.FixturedTestCase):
{ ' vim_connection_id ' : uuidsentinel . vim_id ,
' vnfd_software_image_id ' : ' VDU1 ' ,
' vim_software_image_id ' : ' cirros ' } ] }
resAddR esource = [ ]
res_add_r esource = [ ]
resource = {
' resource_definition_id ' : ' 2c6e5cc7-240d-4458-a683-1fe648351280 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
resAddR esource . append ( resource )
res_add_r esource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa9 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
resAddR esource . append ( resource )
res_add_r esource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa0 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
resAddR esource . append ( resource )
res_add_r esource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa1 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
resAddR esource . append ( resource )
res_add_r esource . append ( resource )
zone = {
' id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' ,
' zone_id ' : ' nova ' ,
@ -313,8 +429,116 @@ class TestOpenStack(base.FixturedTestCase):
grant_dict [ ' vnf_instance_id ' ] = uuidsentinel . vnf_instance_id
grant_dict [ ' vnf_lcm_op_occ_id ' ] = uuidsentinel . vnf_lcm_op_occ_id
grant_dict [ ' add_resources ' ] = [ ]
grant_dict [ ' add_resources ' ] . extend ( resAddResource )
grant_dict [ ' vim_assets ' ] = vimAssets
grant_dict [ ' add_resources ' ] . extend ( res_add_resource )
grant_dict [ ' vim_assets ' ] = vim_assets
grant_dict [ ' zones ' ] = [ zone ]
grant_dict [ ' vim_connections ' ] = [ vim_obj ]
grant_obj = objects . Grant . obj_from_primitive (
grant_dict , context = self . context )
vnf [ ' grant ' ] = grant_obj
vnf_instance = fd_utils . get_vnf_instance_object ( )
vnf_instance . instantiated_vnf_info . reinitialize ( )
vnfc_obj = objects . VnfcResourceInfo ( )
vnfc_obj . id = ' 2c6e5cc7-240d-4458-a683-1fe648351280 '
vnfc_obj . vdu_id = ' VDU1 '
vnfc_obj . storage_resource_ids = \
[ ' faf14707-da7c-4eec-be99-8099fa1e9fa0 ' ]
compute_resource = objects . ResourceHandle (
vim_connection_id = uuidsentinel . vim_id ,
resource_id = ' 6e1c286d-c023-4b34-8369-831c6e84cce2 ' )
vnfc_obj . compute_resource = compute_resource
vnf_instance . instantiated_vnf_info . vnfc_resource_info = [ vnfc_obj ]
self . openstack . create ( self . plugin , self . context , vnf ,
self . auth_attr , inst_req_info = inst_req_info_test ,
vnf_package_path = vnf_package_path_test ,
grant_info = grant_info_test ,
vnf_instance = vnf_instance )
@mock . patch ( ' tacker.vnfm.vim_client.VimClient.get_vim ' )
@mock . patch ( ' tacker.vnfm.infra_drivers.openstack.openstack '
' .OpenStack._format_base_hot ' )
@mock . patch ( ' tacker.vnflcm.utils.get_base_nest_hot_dict ' )
@mock . patch ( ' tacker.common.clients.OpenstackClients ' )
def test_create_grant_zone_id_none ( self , mock_OpenstackClients_heat ,
mock_get_base_hot_dict ,
mock_format_base_hot ,
mock_get_vim ) :
mock_get_vim . return_value = {
' vim_id ' : uuidsentinel . vnfd_id ,
' vim_type ' : ' test ' ,
' vim_auth ' : { ' username ' : ' test ' , ' password ' : ' test ' } ,
' placement_attr ' : { ' region ' : ' TestRegionOne ' } ,
' tenant ' : ' test '
}
vnf = utils . get_dummy_vnf_etsi ( instance_id = self . instance_uuid ,
flavour = ' simple ' )
vnf [ ' placement_attr ' ] = { ' region_name ' : ' dummy_region ' }
vnf_package_path_test = os . path . abspath (
os . path . join ( os . path . dirname ( __file__ ) ,
" ../../../../etc/samples/etsi/nfv " ,
" user_data_sample_normal " ) )
inst_req_info_test = type ( ' ' , ( ) , { } )
test_json = self . _json_load (
' instantiate_vnf_request_lcm_userdata.json ' )
inst_req_info_test . additional_params = test_json [ ' additionalParams ' ]
inst_req_info_test . ext_virtual_links = None
inst_req_info_test . flavour_id = ' simple '
vnf_resource = type ( ' ' , ( ) , { } )
vnf_resource . resource_identifier = constants . INVALID_UUID
grant_info_test = { ' vdu_name ' : { vnf_resource } }
nested_hot_dict = {
' VDU1.yaml ' : { ' parameters ' : { ' vnf ' : ' test ' } ,
' resources ' : { ' VDU1 ' : { ' properties ' : { } } } } }
mock_get_base_hot_dict . return_value = \
self . _read_file ( ) , nested_hot_dict
vim_assets = { ' compute_resource_flavours ' : [
{ ' vim_connection_id ' : uuidsentinel . vim_id ,
' vnfd_virtual_compute_desc_id ' : ' VDU1 ' ,
' vim_flavour_id ' : ' m1.tiny ' } ] ,
' softwareImages ' : [
{ ' vim_connection_id ' : uuidsentinel . vim_id ,
' vnfd_software_image_id ' : ' VDU1 ' ,
' vim_software_image_id ' : ' cirros ' } ] }
res_add_resource = [ ]
resource = {
' resource_definition_id ' : ' 2c6e5cc7-240d-4458-a683-1fe648351280 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa9 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa0 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
resource = {
' resource_definition_id ' : ' faf14707-da7c-4eec-be99-8099fa1e9fa1 ' ,
' vim_connection_id ' : uuidsentinel . vim_id ,
' zone_id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' }
res_add_resource . append ( resource )
zone = {
' id ' : ' 5e4da3c3-4a55-412a-b624-843921f8b51d ' ,
' zone_id ' : ' ' ,
' vim_connection_id ' : uuidsentinel . vim_id }
vim_obj = { ' id ' : ' 0b9c66bb-9e1f-4bb2-92c3-913074e52e2b ' ,
' vim_id ' : uuidsentinel . vim_id ,
' vim_type ' : ' openstack ' ,
' access_info ' : {
' password ' : ' test_pw ' ,
' username ' : ' test_user ' ,
' region ' : ' test_region ' ,
' tenant ' : uuidsentinel . tenant } }
grant_dict = { }
grant_dict [ ' id ' ] = ' c213e465-8220-487e-9464-f79104e81e96 '
grant_dict [ ' vnf_instance_id ' ] = uuidsentinel . vnf_instance_id
grant_dict [ ' vnf_lcm_op_occ_id ' ] = uuidsentinel . vnf_lcm_op_occ_id
grant_dict [ ' add_resources ' ] = [ ]
grant_dict [ ' add_resources ' ] . extend ( res_add_resource )
grant_dict [ ' vim_assets ' ] = vim_assets
grant_dict [ ' zones ' ] = [ zone ]
grant_dict [ ' vim_connections ' ] = [ vim_obj ]
grant_obj = objects . Grant . obj_from_primitive (
@ -2085,6 +2309,199 @@ class TestOpenStack(base.FixturedTestCase):
region_name = None
)
@mock . patch . object ( hc . HeatClient , " update " )
def test_scale_out_initial_zone_none ( self , mock_update ) :
scale_vnf_request = objects . ScaleVnfRequest ( type = ' SCALE_OUT ' ,
aspect_id = ' SP1 ' ,
number_of_steps = 1 )
vnf_info = { }
add_resources = [ ]
resource = objects . ResourceDefinition (
id = ' 2c6e5cc7-240d-4458-a683-1fe648351280 ' ,
type = ' COMPUTE ' ,
vdu_id = ' VDU1 ' ,
resource_template_id = ' VDU1 ' )
add_resources . append ( resource )
resource = objects . ResourceDefinition (
id = ' faf14707-da7c-4eec-be99-8099fa1e9fa9 ' ,
type = ' LINKPORT ' ,
vdu_id = ' VDU1 ' ,
resource_template_id = ' PORT1 ' )
add_resources . append ( resource )
resource = objects . ResourceDefinition (
id = ' faf14707-da7c-4eec-be99-8099fa1e9fa9 ' ,
type = ' STORAGE ' ,
vdu_id = ' VDU1 ' ,
resource_template_id = ' ST1 ' )
add_resources . append ( resource )
vnf_info [ ' addResources ' ] = add_resources
vnf_info [ ' attributes ' ] = { }
vnf_info [ ' attributes ' ] [ ' scale_group ' ] = ' { \" scaleGroupDict \" : ' + \
' { \" SP1 \" : { \" vdu \" : [ \" VDU1 \" ], \" num \" : ' + \
' 1, \" maxLevel \" : 3, \" initialNum \" : 0, ' + \
' \" initialLevel \" : 0, \" default \" : 0 }}} '
vnf_info [ ' attributes ' ] [ ' heat_template ' ] = \
utils . get_dummy_scale_initial_hot ( )
vnf_info [ ' attributes ' ] [ ' SP1_res.yaml ' ] = \
utils . get_dummy_scale_nest_initial_hot ( )
stack_param_dict = { }
stack_param_dict [ ' nfv ' ] = { }
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] = { }
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] [ ' VDU1 ' ] = { }
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] [ ' VDU1 ' ] [ ' flavor ' ] = ' '
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] [ ' VDU1 ' ] [ ' image ' ] = ' '
vnf_info [ ' attributes ' ] . update ( { ' stack_param ' : str ( stack_param_dict ) } )
vnf_info [ ' instance_id ' ] = uuidsentinel . stack_id
testjson = ' { " id " : " c213e465-8220-487e-9464-f79104e81e96 " , ' + \
' " vnf_instance_id " : ' + \
' " 47101fb6-bd18-4e04-b2b5-22370a023448 " , ' + \
' " vnf_lcm_op_occ_id " : ' + \
' " f26f181d-7891-4720-b022-b074ec1733ef " , ' + \
' " zones " : [ { ' + \
' " id " : ' + \
' " 5e4da3c3-4a55-412a-b624-843921f8b51d " , ' + \
' " zone_id " : ' + \
' " nova " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " }], ' + \
' " add_resources " : [ { " resource_definition_id " : ' + \
' " 2c6e5cc7-240d-4458-a683-1fe648351280 " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " zone_id " : " 5e4da3c3-4a55-412a-b624-843921f8b51d " } ' + \
' , { " resource_definition_id " : ' + \
' " faf14707-da7c-4eec-be99-8099fa1e9fa9 " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " zone_id " : " 5e4da3c3-4a55-412a-b624-843921f8b51d " } ' + \
' , { " resource_definition_id " : ' + \
' " faf14707-da7c-4eec-be99-8099fa1e9fa9 " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " zone_id " : ' + \
' " 5e4da3c3-4a55-412a-b624-843921f8b51d " }], ' + \
' " vim_assets " : { " compute_resource_flavours " : ' + \
' [ { " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " vnfd_virtual_compute_desc_id " : " VDU1 " , ' + \
' " vim_flavour_id " : " m1.tiny " }], " software_images " : ' + \
' [ { " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " vnfd_software_image_id " : " VDU1 " , ' + \
' " vim_software_image_id " : " cirros " }]}} '
res_body = jsonutils . loads ( testjson )
res_dict = cutils . convert_camelcase_to_snakecase ( res_body )
grant_obj = objects . Grant . obj_from_primitive (
res_dict , context = context )
vnf_info [ ' grant ' ] = grant_obj
self . openstack . scale_out_initial ( context = self . context ,
plugin = self ,
auth_attr = None ,
vnf_info = vnf_info ,
scale_vnf_request = scale_vnf_request ,
region_name = None
)
@mock . patch . object ( hc . HeatClient , " update " )
def test_scale_out_initial_zone_id_none ( self , mock_update ) :
scale_vnf_request = objects . ScaleVnfRequest ( type = ' SCALE_OUT ' ,
aspect_id = ' SP1 ' ,
number_of_steps = 1 )
vnf_info = { }
add_resources = [ ]
resource = objects . ResourceDefinition (
id = ' 2c6e5cc7-240d-4458-a683-1fe648351280 ' ,
type = ' COMPUTE ' ,
vdu_id = ' VDU1 ' ,
resource_template_id = ' VDU1 ' )
add_resources . append ( resource )
resource = objects . ResourceDefinition (
id = ' faf14707-da7c-4eec-be99-8099fa1e9fa9 ' ,
type = ' LINKPORT ' ,
vdu_id = ' VDU1 ' ,
resource_template_id = ' PORT1 ' )
add_resources . append ( resource )
resource = objects . ResourceDefinition (
id = ' faf14707-da7c-4eec-be99-8099fa1e9fa9 ' ,
type = ' STORAGE ' ,
vdu_id = ' VDU1 ' ,
resource_template_id = ' ST1 ' )
add_resources . append ( resource )
vnf_info [ ' addResources ' ] = add_resources
vnf_info [ ' attributes ' ] = { }
vnf_info [ ' attributes ' ] [ ' scale_group ' ] = ' { \" scaleGroupDict \" : ' + \
' { \" SP1 \" : { \" vdu \" : [ \" VDU1 \" ], \" num \" : ' + \
' 1, \" maxLevel \" : 3, \" initialNum \" : 0, ' + \
' \" initialLevel \" : 0, \" default \" : 0 }}} '
vnf_info [ ' attributes ' ] [ ' heat_template ' ] = \
utils . get_dummy_scale_initial_hot ( )
vnf_info [ ' attributes ' ] [ ' SP1_res.yaml ' ] = \
utils . get_dummy_scale_nest_initial_hot ( )
stack_param_dict = { }
stack_param_dict [ ' nfv ' ] = { }
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] = { }
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] [ ' VDU1 ' ] = { }
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] [ ' VDU1 ' ] [ ' zone ' ] = ' '
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] [ ' VDU1 ' ] [ ' flavor ' ] = ' '
stack_param_dict [ ' nfv ' ] [ ' VDU ' ] [ ' VDU1 ' ] [ ' image ' ] = ' '
vnf_info [ ' attributes ' ] . update ( { ' stack_param ' : str ( stack_param_dict ) } )
vnf_info [ ' instance_id ' ] = uuidsentinel . stack_id
testjson = ' { " id " : " c213e465-8220-487e-9464-f79104e81e96 " , ' + \
' " vnf_instance_id " : ' + \
' " 47101fb6-bd18-4e04-b2b5-22370a023448 " , ' + \
' " vnf_lcm_op_occ_id " : ' + \
' " f26f181d-7891-4720-b022-b074ec1733ef " , ' + \
' " zones " : [ { ' + \
' " id " : ' + \
' " 5e4da3c3-4a55-412a-b624-843921f8b51d " , ' + \
' " zone_id " : ' + \
' " " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " }], ' + \
' " add_resources " : [ { " resource_definition_id " : ' + \
' " 2c6e5cc7-240d-4458-a683-1fe648351280 " , ' + \
' " id " : ' + \
' " 2c6e5cc7-240d-4458-a683-1fe648351280 " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " zone_id " : " 5e4da3c3-4a55-412a-b624-843921f8b51d " } ' + \
' , { " resource_definition_id " : ' + \
' " faf14707-da7c-4eec-be99-8099fa1e9fa9 " , ' + \
' " id " : ' + \
' " faf14707-da7c-4eec-be99-8099fa1e9fa9 " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " zone_id " : " 5e4da3c3-4a55-412a-b624-843921f8b51d " } ' + \
' , { " resource_definition_id " : ' + \
' " faf14707-da7c-4eec-be99-8099fa1e9fa9 " , ' + \
' " id " : ' + \
' " faf14707-da7c-4eec-be99-8099fa1e9fa9 " , ' + \
' " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " zone_id " : ' + \
' " 5e4da3c3-4a55-412a-b624-843921f8b51d " }], ' + \
' " vim_assets " : { " compute_resource_flavours " : ' + \
' [ { " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " vnfd_virtual_compute_desc_id " : " VDU1 " , ' + \
' " vim_flavour_id " : " m1.tiny " }], " software_images " : ' + \
' [ { " vim_connection_id " : ' + \
' " b6eacd1b-5a9e-41ea-a33b-9d7196cd9187 " , ' + \
' " vnfd_software_image_id " : " VDU1 " , ' + \
' " vim_software_image_id " : " cirros " }]}} '
res_body = jsonutils . loads ( testjson )
res_dict = cutils . convert_camelcase_to_snakecase ( res_body )
grant_obj = objects . Grant . obj_from_primitive (
res_dict , context = context )
vnf_info [ ' grant ' ] = grant_obj
self . openstack . scale_out_initial ( context = self . context ,
plugin = self ,
auth_attr = None ,
vnf_info = vnf_info ,
scale_vnf_request = scale_vnf_request ,
region_name = None
)
@mock . patch . object ( hc . HeatClient , " resource_get " )
@mock . patch . object ( hc . HeatClient , " resource_get_list " )
def test_get_rollback_ids ( self , mock_list , mock_resource ) :