Beispiel #1
0
    def _parse_template_input(self, vnfd):
        vnfd_dict = vnfd['vnfd']
        vnfd_yaml = vnfd_dict['attributes'].get('vnfd')
        if vnfd_yaml is None:
            return

        inner_vnfd_dict = yaml.safe_load(vnfd_yaml)
        LOG.debug('vnfd_dict: %s', inner_vnfd_dict)

        # Prepend the tacker_defs.yaml import file with the full
        # path to the file
        toscautils.updateimports(inner_vnfd_dict)

        try:
            tosca = ToscaTemplate(a_file=False,
                                  yaml_dict_tpl=inner_vnfd_dict)
        except Exception as e:
            LOG.exception("tosca-parser error: %s", str(e))
            raise vnfm.ToscaParserFailed(error_msg_details=str(e))

        if ('description' not in vnfd_dict or
                vnfd_dict['description'] == ''):
            vnfd_dict['description'] = inner_vnfd_dict.get(
                'description', '')
        if (('name' not in vnfd_dict or
                not len(vnfd_dict['name'])) and
                'metadata' in inner_vnfd_dict):
            vnfd_dict['name'] = inner_vnfd_dict['metadata'].get(
                'template_name', '')

        vnfd_dict['mgmt_driver'] = toscautils.get_mgmt_driver(
            tosca)
        LOG.debug('vnfd %s', vnfd)
    def loader(self):
        """Load TOSCA template and start parsing"""

        try:
            parserd_params = None
            toscautils.updateimports(self.vnfd_dict)
            tosca = tosca_template.\
                ToscaTemplate(parsed_params=parserd_params,
                              a_file=False,
                              yaml_dict_tpl=self.vnfd_dict)
        except Exception as e:
            LOG.debug("tosca-parser error: %s", str(e))
            raise vnfm.ToscaParserFailed(error_msg_details=str(e))

        # Initiate a list tosca_kube_object which are defined from VDU
        tosca_kube_objects = []
        vdus = toscautils.findvdus(tosca)

        for node_template in vdus:
            vdu_name = node_template.name
            tosca_kube_obj = self.tosca_to_kube_mapping(node_template)

            # Find network name in which VDU is attached
            tosca_kube_obj.network_name = self.find_networks(tosca, vdu_name)

            # If connection_point is True, Tacker will manage its service ip
            tosca_kube_obj.mgmt_connection_point = \
                self.check_mgmt_cp(tosca, vdu_name)

            # Find scaling policy that is used for this VDU, different to
            # VM-based VNF, there are no alarm policies.
            tosca_kube_obj.scaling_object = \
                self.get_scaling_policy(tosca, vdu_name)
            tosca_kube_objects.append(tosca_kube_obj)
        return tosca_kube_objects
Beispiel #3
0
 def add_alarm_url_to_vnf(self, context, vnf_dict):
     vnfd_yaml = vnf_dict['vnfd']['attributes'].get('vnfd', '')
     vnfd_dict = yaml.safe_load(vnfd_yaml)
     if not (vnfd_dict and vnfd_dict.get('tosca_definitions_version')):
         return
     try:
         toscautils.updateimports(vnfd_dict)
         tosca_vnfd = ToscaTemplate(a_file=False, yaml_dict_tpl=vnfd_dict)
     except Exception as e:
         LOG.exception("tosca-parser error: %s", str(e))
         raise vnfm.ToscaParserFailed(error_msg_details=str(e))
     polices = vnfd_dict['topology_template'].get('policies', [])
     for policy_dict in polices:
         name, policy = list(policy_dict.items())[0]
         if policy['type'] in constants.POLICY_ALARMING:
             alarm_url =\
                 self._vnf_alarm_monitor.update_vnf_with_alarm(
                     self, context, vnf_dict, policy)
             vnf_dict['attributes']['alarming_policy'] = vnf_dict['id']
             vnf_dict['attributes'].update(alarm_url)
         elif policy['type'] in constants.POLICY_RESERVATION:
             alarm_url = \
                 self._vnf_reservation_monitor.update_vnf_with_reservation(
                     self, context, vnf_dict, policy)
             vnf_dict['attributes']['reservation_policy'] = vnf_dict['id']
             vnf_dict['attributes'].update(alarm_url)
     maintenance_vdus = toscautils.find_maintenance_vdus(tosca_vnfd)
     maintenance = \
         self._vnf_maintenance_monitor.update_vnf_with_maintenance(
             vnf_dict, maintenance_vdus)
     vnf_dict['attributes'].update(
         {'maintenance': jsonutils.dumps(maintenance['vdus'])})
     vnf_dict['attributes']['maintenance_url'] = maintenance['url']
Beispiel #4
0
    def _parse_template_input(self, vnfd):
        vnfd_dict = vnfd['vnfd']
        vnfd_yaml = vnfd_dict['attributes'].get('vnfd')
        if vnfd_yaml is None:
            return

        inner_vnfd_dict = yaml.load(vnfd_yaml)
        LOG.debug(_('vnfd_dict: %s'), inner_vnfd_dict)

        if 'tosca_definitions_version' in inner_vnfd_dict:
            # Prepend the tacker_defs.yaml import file with the full
            # path to the file
            toscautils.updateimports(inner_vnfd_dict)

            try:
                tosca = ToscaTemplate(a_file=False,
                                      yaml_dict_tpl=inner_vnfd_dict)
            except Exception as e:
                LOG.exception(_("tosca-parser error: %s"), str(e))
                raise vnfm.ToscaParserFailed(error_msg_details=str(e))

            if ('description' not in vnfd_dict or
                    vnfd_dict['description'] == ''):
                vnfd_dict['description'] = inner_vnfd_dict.get(
                    'description', '')
            if (('name' not in vnfd_dict or
                    not len(vnfd_dict['name'])) and
                    'metadata' in inner_vnfd_dict):
                vnfd_dict['name'] = inner_vnfd_dict['metadata'].get(
                    'template_name', '')

            vnfd_dict['mgmt_driver'] = toscautils.get_mgmt_driver(
                tosca)
        else:
            KEY_LIST = (('name', 'template_name'),
                        ('description', 'description'))

            vnfd_dict.update(
                dict((key, inner_vnfd_dict[vnfd_key]) for (key, vnfd_key)
                     in KEY_LIST
                     if ((key not in vnfd_dict or
                          vnfd_dict[key] == '') and
                         vnfd_key in inner_vnfd_dict and
                         inner_vnfd_dict[vnfd_key] != '')))

            service_types = inner_vnfd_dict.get(
                'service_properties', {}).get('type', [])
            if service_types:
                vnfd_dict.setdefault('service_types', []).extend(
                    [{'service_type': service_type}
                    for service_type in service_types])
            # TODO(anyone)  - this code assumes one mgmt_driver per VNFD???
            for vdu in inner_vnfd_dict.get('vdus', {}).values():
                mgmt_driver = vdu.get('mgmt_driver')
                if mgmt_driver:
                    vnfd_dict['mgmt_driver'] = mgmt_driver
        LOG.debug(_('vnfd %s'), vnfd)
Beispiel #5
0
    def _generate_hot_from_tosca(self, vnfd_dict, dev_attrs):

        parsed_params = {}
        if 'param_values' in dev_attrs and dev_attrs['param_values'] != "":
            try:
                parsed_params = yaml.safe_load(dev_attrs['param_values'])
            except Exception as e:
                LOG.debug("Params not Well Formed: %s", str(e))
                raise vnfm.ParamYAMLNotWellFormed(error_msg_details=str(e))

        svcmonitoring_dict, vnfd_dicttemp = toscautils.get_vdu_servicemonitoring(
            vnfd_dict)
        toscautils.updateimports(vnfd_dicttemp)

        if 'substitution_mappings' in str(vnfd_dicttemp):
            toscautils.check_for_substitution_mappings(vnfd_dicttemp,
                                                       parsed_params)

        try:
            tosca = tosca_template.ToscaTemplate(parsed_params=parsed_params,
                                                 a_file=False,
                                                 yaml_dict_tpl=vnfd_dicttemp)

        except Exception as e:
            LOG.debug("tosca-parser error: %s", str(e))
            raise vnfm.ToscaParserFailed(error_msg_details=str(e))

        metadata = toscautils.get_vdu_metadata(tosca)
        monitoring_dict = toscautils.get_vdu_monitoring(tosca)

        mgmt_ports = toscautils.get_mgmt_ports(tosca)
        res_tpl = toscautils.get_resources_dict(tosca, self.STACK_FLAVOR_EXTRA)

        toscautils.post_process_template(tosca)

        try:
            translator = tosca_translator.TOSCATranslator(tosca, parsed_params)
            heat_template_yaml = translator.translate()

        except Exception as e:
            LOG.debug("heat-translator error: %s", str(e))
            raise vnfm.HeatTranslatorFailed(error_msg_details=str(e))

        heat_template_yaml = toscautils.post_process_heat_template(
            heat_template_yaml, mgmt_ports, metadata, res_tpl,
            self.unsupported_props)

        self.heat_template_yaml = heat_template_yaml
        self.monitoring_dict = monitoring_dict
        self.svcmonitoring_dict = svcmonitoring_dict
        self.metadata = metadata
Beispiel #6
0
        def generate_hot_from_tosca(vnfd_dict):
            parsed_params = {}
            if ('param_values' in dev_attrs and
                    dev_attrs['param_values'] != ""):
                try:
                    parsed_params = yaml.load(dev_attrs['param_values'])
                except Exception as e:
                    LOG.debug("Params not Well Formed: %s", str(e))
                    raise vnfm.ParamYAMLNotWellFormed(
                        error_msg_details=str(e))

            toscautils.updateimports(vnfd_dict)

            try:
                tosca = tosca_template.ToscaTemplate(
                    parsed_params=parsed_params, a_file=False,
                    yaml_dict_tpl=vnfd_dict)

            except Exception as e:
                LOG.debug("tosca-parser error: %s", str(e))
                raise vnfm.ToscaParserFailed(error_msg_details=str(e))

            monitoring_dict = toscautils.get_vdu_monitoring(tosca)
            mgmt_ports = toscautils.get_mgmt_ports(tosca)
            res_tpl = toscautils.get_resources_dict(tosca,
                                                    self.STACK_FLAVOR_EXTRA)
            toscautils.post_process_template(tosca)
            try:
                translator = tosca_translator.TOSCATranslator(tosca,
                                                              parsed_params)
                heat_template_yaml = translator.translate()
            except Exception as e:
                LOG.debug("heat-translator error: %s", str(e))
                raise vnfm.HeatTranslatorFailed(error_msg_details=str(e))
            heat_template_yaml = toscautils.post_process_heat_template(
                heat_template_yaml, mgmt_ports, res_tpl,
                unsupported_res_prop)

            return heat_template_yaml, monitoring_dict
Beispiel #7
0
    def _generate_hot_from_tosca(self, vnfd_dict, dev_attrs):
        parsed_params = {}
        if 'param_values' in dev_attrs and dev_attrs['param_values'] != "":
            try:
                parsed_params = yaml.safe_load(dev_attrs['param_values'])
            except Exception as e:
                LOG.debug("Params not Well Formed: %s", str(e))
                raise vnfm.ParamYAMLNotWellFormed(error_msg_details=str(e))

        appmonitoring_dict = \
            toscautils.get_vdu_applicationmonitoring(vnfd_dict)

        block_storage_details = toscautils.get_block_storage_details(vnfd_dict)
        toscautils.updateimports(vnfd_dict)
        if 'substitution_mappings' in str(vnfd_dict):
            toscautils.check_for_substitution_mappings(vnfd_dict,
                                                       parsed_params)

        try:
            tosca = tosca_template.ToscaTemplate(parsed_params=parsed_params,
                                                 a_file=False,
                                                 yaml_dict_tpl=vnfd_dict)

        except Exception as e:
            LOG.debug("tosca-parser error: %s", str(e))
            raise vnfm.ToscaParserFailed(error_msg_details=str(e))

        metadata = toscautils.get_vdu_metadata(tosca)
        alarm_resources =\
            toscautils.pre_process_alarm_resources(self.vnf, tosca, metadata)
        monitoring_dict = toscautils.get_vdu_monitoring(tosca)
        mgmt_ports = toscautils.get_mgmt_ports(tosca)
        nested_resource_name = toscautils.get_nested_resources_name(tosca)
        sub_heat_tmpl_name = toscautils.get_sub_heat_tmpl_name(tosca)
        res_tpl = toscautils.get_resources_dict(tosca, self.STACK_FLAVOR_EXTRA)
        toscautils.post_process_template(tosca)
        scaling_policy_names = toscautils.get_scaling_policy(tosca)
        try:
            translator = tosca_translator.TOSCATranslator(tosca, parsed_params)
            heat_template_yaml = translator.translate()
            if nested_resource_name:
                sub_heat_template_yaml =\
                    translator.translate_to_yaml_files_dict(sub_heat_tmpl_name)
                nested_resource_yaml =\
                    sub_heat_template_yaml[nested_resource_name]
                LOG.debug("nested_resource_yaml: %s", nested_resource_yaml)
                self.nested_resources[nested_resource_name] =\
                    nested_resource_yaml

        except Exception as e:
            LOG.debug("heat-translator error: %s", str(e))
            raise vnfm.HeatTranslatorFailed(error_msg_details=str(e))

        if self.nested_resources:
            nested_tpl = toscautils.update_nested_scaling_resources(
                self.nested_resources, mgmt_ports, metadata, res_tpl,
                self.unsupported_props)
            self.fields['files'] = nested_tpl
            self.vnf['attributes'][nested_resource_name] =\
                nested_tpl[nested_resource_name]
            mgmt_ports.clear()

        if scaling_policy_names:
            scaling_group_dict = toscautils.get_scaling_group_dict(
                heat_template_yaml, scaling_policy_names)
            self.vnf['attributes']['scaling_group_names'] =\
                jsonutils.dumps(scaling_group_dict)

        heat_template_yaml = toscautils.post_process_heat_template(
            heat_template_yaml, mgmt_ports, metadata, alarm_resources, res_tpl,
            block_storage_details, self.unsupported_props)

        self.heat_template_yaml = heat_template_yaml
        self.monitoring_dict = monitoring_dict
        self.metadata = metadata
        self.appmonitoring_dict = appmonitoring_dict
Beispiel #8
0
    def create(self, plugin, context, device, auth_attr):
        LOG.debug(_('device %s'), device)
        attributes = device['device_template']['attributes'].copy()
        vnfd_yaml = attributes.pop('vnfd', None)
        fields = dict((key, attributes.pop(key))
                      for key in ('stack_name', 'template_url', 'template')
                      if key in attributes)
        for key in ('files', 'parameters'):
            if key in attributes:
                fields[key] = jsonutils.loads(attributes.pop(key))

        # overwrite parameters with given dev_attrs for device creation
        dev_attrs = device['attributes'].copy()
        fields.update(
            dict((key, dev_attrs.pop(key))
                 for key in ('stack_name', 'template_url', 'template')
                 if key in dev_attrs))
        for key in ('files', 'parameters'):
            if key in dev_attrs:
                fields.setdefault(key, {}).update(
                    jsonutils.loads(dev_attrs.pop(key)))

        region_name = device.get('placement_attr', {}).get('region_name', None)
        heatclient_ = HeatClient(auth_attr, region_name)
        unsupported_res_prop = self.fetch_unsupported_resource_prop(
            heatclient_)

        LOG.debug('vnfd_yaml %s', vnfd_yaml)
        if vnfd_yaml is not None:
            vnfd_dict = yamlparser.simple_ordered_parse(vnfd_yaml)
            LOG.debug('vnfd_dict %s', vnfd_dict)

            monitoring_dict = {'vdus': {}}

            if 'tosca_definitions_version' in vnfd_dict:
                parsed_params = dev_attrs.pop('param_values', {})

                toscautils.updateimports(vnfd_dict)

                try:
                    tosca = ToscaTemplate(parsed_params=parsed_params,
                                          a_file=False,
                                          yaml_dict_tpl=vnfd_dict)

                except Exception as e:
                    LOG.debug("tosca-parser error: %s", str(e))
                    raise vnfm.ToscaParserFailed(error_msg_details=str(e))

                monitoring_dict = toscautils.get_vdu_monitoring(tosca)
                mgmt_ports = toscautils.get_mgmt_ports(tosca)
                res_tpl = toscautils.get_resources_dict(
                    tosca, STACK_FLAVOR_EXTRA)
                toscautils.post_process_template(tosca)
                try:
                    translator = TOSCATranslator(tosca, parsed_params)
                    heat_template_yaml = translator.translate()
                except Exception as e:
                    LOG.debug("heat-translator error: %s", str(e))
                    raise vnfm.HeatTranslatorFailed(error_msg_details=str(e))
                heat_template_yaml = toscautils.post_process_heat_template(
                    heat_template_yaml, mgmt_ports, res_tpl,
                    unsupported_res_prop)
            else:
                assert 'template' not in fields
                assert 'template_url' not in fields
                template_dict = yaml.load(HEAT_TEMPLATE_BASE)
                outputs_dict = {}
                template_dict['outputs'] = outputs_dict

                if 'get_input' in vnfd_yaml:
                    self._process_parameterized_input(dev_attrs, vnfd_dict)

                KEY_LIST = (('description', 'description'), )
                for (key, vnfd_key) in KEY_LIST:
                    if vnfd_key in vnfd_dict:
                        template_dict[key] = vnfd_dict[vnfd_key]

                for vdu_id, vdu_dict in vnfd_dict.get('vdus', {}).items():
                    template_dict.setdefault('resources', {})[vdu_id] = {
                        "type": "OS::Nova::Server"
                    }
                    resource_dict = template_dict['resources'][vdu_id]
                    KEY_LIST = (('image', 'vm_image'), ('flavor',
                                                        'instance_type'))
                    resource_dict['properties'] = {}
                    properties = resource_dict['properties']
                    for (key, vdu_key) in KEY_LIST:
                        properties[key] = vdu_dict[vdu_key]
                    if 'network_interfaces' in vdu_dict:
                        self._process_vdu_network_interfaces(
                            vdu_id, vdu_dict, properties, template_dict,
                            unsupported_res_prop)
                    if ('user_data' in vdu_dict
                            and 'user_data_format' in vdu_dict):
                        properties['user_data_format'] = vdu_dict[
                            'user_data_format']
                        properties['user_data'] = vdu_dict['user_data']
                    elif ('user_data' in vdu_dict
                          or 'user_data_format' in vdu_dict):
                        raise vnfm.UserDataFormatNotFound()
                    if 'placement_policy' in vdu_dict:
                        if 'availability_zone' in vdu_dict['placement_policy']:
                            properties['availability_zone'] = vdu_dict[
                                'placement_policy']['availability_zone']
                    if 'config' in vdu_dict:
                        properties['config_drive'] = True
                        metadata = properties.setdefault('metadata', {})
                        metadata.update(vdu_dict['config'])
                        for key, value in metadata.items():
                            metadata[key] = value[:255]
                    if 'key_name' in vdu_dict:
                        properties['key_name'] = vdu_dict['key_name']

                    monitoring_policy = vdu_dict.get('monitoring_policy',
                                                     'noop')
                    failure_policy = vdu_dict.get('failure_policy', 'noop')

                    # Convert the old monitoring specification to the new
                    # network.  This should be removed after Mitaka
                    if (monitoring_policy == 'ping'
                            and failure_policy == 'respawn'):
                        vdu_dict['monitoring_policy'] = {
                            'ping': {
                                'actions': {
                                    'failure': 'respawn'
                                }
                            }
                        }
                        vdu_dict.pop('failure_policy')

                    if monitoring_policy != 'noop':
                        monitoring_dict['vdus'][vdu_id] = \
                            vdu_dict['monitoring_policy']

                    # to pass necessary parameters to plugin upwards.
                    for key in ('service_type', ):
                        if key in vdu_dict:
                            device.setdefault('attributes',
                                              {})[vdu_id] = jsonutils.dumps(
                                                  {key: vdu_dict[key]})

                    heat_template_yaml = yaml.dump(template_dict)

            fields['template'] = heat_template_yaml
            if not device['attributes'].get('heat_template'):
                device['attributes']['heat_template'] = \
                    heat_template_yaml

            if monitoring_dict.keys():
                device['attributes']['monitoring_policy'] = \
                    jsonutils.dumps(monitoring_dict)

        if 'stack_name' not in fields:
            name = (__name__ + '_' + self.__class__.__name__ + '-' +
                    device['id'])
            if device['attributes'].get('failure_count'):
                name += ('-RESPAWN-%s') % str(
                    device['attributes']['failure_count'])
            fields['stack_name'] = name

        # service context is ignored
        LOG.debug(_('service_context: %s'), device.get('service_context', []))

        LOG.debug(_('fields: %s'), fields)
        LOG.debug(_('template: %s'), fields['template'])
        stack = heatclient_.create(fields)
        return stack['stack']['id']
Beispiel #9
0
    def _generate_hot_from_tosca(self,
                                 vnfd_dict,
                                 dev_attrs,
                                 inst_req_info=None,
                                 grant_info=None):
        parsed_params = {}
        if 'param_values' in dev_attrs and dev_attrs['param_values'] != "":
            try:
                parsed_params = yaml.safe_load(dev_attrs['param_values'])
            except Exception as e:
                LOG.debug("Params not Well Formed: %s", str(e))
                raise vnfm.ParamYAMLNotWellFormed(error_msg_details=str(e))

        appmonitoring_dict = \
            toscautils.get_vdu_applicationmonitoring(vnfd_dict)

        block_storage_details = toscautils.get_block_storage_details(vnfd_dict)
        toscautils.updateimports(vnfd_dict)
        if 'substitution_mappings' in str(vnfd_dict):
            toscautils.check_for_substitution_mappings(vnfd_dict,
                                                       parsed_params)

        try:
            tosca = tosca_template.ToscaTemplate(parsed_params=parsed_params,
                                                 a_file=False,
                                                 yaml_dict_tpl=vnfd_dict)

        except Exception as e:
            LOG.debug("tosca-parser error: %s", str(e))
            raise vnfm.ToscaParserFailed(error_msg_details=str(e))

        unique_id = uuidutils.generate_uuid()
        metadata = toscautils.get_vdu_metadata(tosca, unique_id=unique_id)
        for policy in tosca.policies:
            if policy.entity_tpl['type'] == constants.POLICY_RESERVATION:
                metadata = toscautils.get_metadata_for_reservation(
                    tosca, metadata)
                break

        alarm_resources = toscautils.pre_process_alarm_resources(
            self.vnf, tosca, metadata, unique_id=unique_id)
        monitoring_dict = toscautils.get_vdu_monitoring(tosca)
        mgmt_ports = toscautils.get_mgmt_ports(tosca)
        res_tpl = toscautils.get_resources_dict(tosca, self.STACK_FLAVOR_EXTRA)
        toscautils.post_process_template(tosca)
        scaling_policy_names = toscautils.get_scaling_policy(tosca)
        try:
            translator = tosca_translator.TOSCATranslator(tosca, parsed_params)

            heat_template_yaml = translator.translate()
            nested_resource_names = toscautils.get_nested_resources_name(
                heat_template_yaml)
            if nested_resource_names:
                for nested_resource_name in nested_resource_names:
                    sub_heat_tmpl_name = \
                        toscautils.get_sub_heat_tmpl_name(nested_resource_name)
                    sub_heat_template_yaml =\
                        translator.translate_to_yaml_files_dict(
                            sub_heat_tmpl_name)
                    nested_resource_yaml = \
                        sub_heat_template_yaml[nested_resource_name]
                    LOG.debug("nested_resource_yaml: %s", nested_resource_yaml)
                    self.nested_resources[nested_resource_name] = \
                        nested_resource_yaml

        except Exception as e:
            LOG.debug("heat-translator error: %s", str(e))
            raise vnfm.HeatTranslatorFailed(error_msg_details=str(e))

        if self.nested_resources:
            nested_tpl = toscautils.update_nested_scaling_resources(
                self.nested_resources,
                mgmt_ports,
                metadata,
                res_tpl,
                self.unsupported_props,
                grant_info=grant_info,
                inst_req_info=inst_req_info)
            self.fields['files'] = nested_tpl
            for nested_resource_name in nested_tpl.keys():
                self.vnf['attributes'][nested_resource_name] =\
                    nested_tpl[nested_resource_name]
            mgmt_ports.clear()

        if scaling_policy_names:
            scaling_group_dict = toscautils.get_scaling_group_dict(
                heat_template_yaml, scaling_policy_names)
            self.vnf['attributes']['scaling_group_names'] =\
                jsonutils.dump_as_bytes(scaling_group_dict)

        if self.vnf['attributes'].get('maintenance', None):
            toscautils.add_maintenance_resources(tosca, res_tpl)

        heat_template_yaml = toscautils.post_process_heat_template(
            heat_template_yaml,
            mgmt_ports,
            metadata,
            alarm_resources,
            res_tpl,
            block_storage_details,
            self.unsupported_props,
            unique_id=unique_id,
            inst_req_info=inst_req_info,
            grant_info=grant_info,
            tosca=tosca)

        try:
            for nested_resource_name in self.nested_resources.keys():
                self.nested_resources[nested_resource_name] = \
                    toscautils.post_process_heat_template_for_scaling(
                    self.nested_resources[nested_resource_name],
                    mgmt_ports, metadata, alarm_resources,
                    res_tpl, block_storage_details, self.unsupported_props,
                    unique_id=unique_id, inst_req_info=inst_req_info,
                    grant_info=grant_info, tosca=tosca)
        except Exception as e:
            LOG.debug("post_process_heat_template_for_scaling "
                      "error: %s", str(e))
            raise

        self.heat_template_yaml = heat_template_yaml
        self.monitoring_dict = monitoring_dict
        self.metadata = metadata
        self.appmonitoring_dict = appmonitoring_dict