Custom Search

Friday, August 5, 2016

openstack tacker toscaparser and hot tosca_translator example

import toscaparser
from toscaparser.utils import yamlparser
from toscaparser.tosca_template import ToscaTemplate
from translator.hot.tosca_translator import TOSCATranslator
from tacker.vm.tosca import utils as toscautils

vnfd_yaml = open("sample.yaml")
vnfd_dict = yamlparser.simple_ordered_parse(vnfd_yaml)

toscautils.updateimports(vnfd_dict)

tosca = ToscaTemplate(yaml_dict_tpl=vnfd_dict)


monitoring_dict = toscautils.get_vdu_monitoring(tosca)
mgmt_ports = toscautils.get_mgmt_ports(tosca)
res_tpl = toscautils.get_resources_dict(tosca)

toscautils.post_process_template(tosca)


translate = TOSCATranslator(tosca, {})
heat_template_yaml = translate.translate()


heat_template_yaml = toscautils.post_process_heat_template(heat_template_yaml, mgmt_ports, res_tpl)

print heat_template_yaml


1 comment: