TOSCA 解析器和 Heat 转换器集成

https://blueprints.launchpad.net/tacker/+spec/tosca-parser-integration

问题描述

Tacker 使用私有的 YAML 格式来表示 VNFD 模板,该格式与 TOSCA 相似,但具有自定义标签且功能远不如 TOSCA。Tacker 还自行将 VNFD 转换为 Heat 模板,这需要维护并且功能远不如其他现有项目。

本规范记录了 Tacker 中所需的更改,以便支持使用 tosca-parser 和 heat-translator,而不是现有的 YAML 格式和自定义 Heat 模板生成器。Tacker 将使用 heat-translator 创建基础 HOT 模板,并进行必要的修改以支持快速发展的 NFV 规范。

提议的变更

tosca-parser [1] 和 heat-translator [2] 项目已更新,以支持 TOSCA NFV 规范 [3]。tosca-parser 项目还接受了一个补丁,允许它被提供预格式化 YAML 字典的服务器使用,而不是包含模板的文件或 URL。

本规范建议添加对 TOSCA 模板的支持,方法是使用 tosca-parser 和 heat-translator 项目,最终取代 Tacker 今天使用的自定义 YAML 模板和 HOT 模板生成。

初始实现将与现有的 Tacker YAML 格式共存,并且接口将保持不变。未来的工作需要将 TOSCA 模板处理与 Heat 驱动程序分离,并删除现有的模板处理。

参数的处理方式与今天相同。tosca-parser 和 heat-translator 都接受参数输入,以应用于生成的模板。

Tacker 将在版本字段中支持 tosca_simple_yaml_1_0 和 tosca_simple_profile_for_nfv_1_0_0 规范。

Tacker 特定的数据,例如管理驱动程序和监控驱动程序,将添加到现有的 NFV 对象定义中,以在 TOSCA 模板中使用。所有 Tacker 扩展都需要在传递给 ToscaTranslator 进行转换为 HOT 之前从翻译后的 ToscaTemplate 中删除。

tacker_defs.yaml 文件将定义 Tacker 特定的类型,这些类型不特定于 NFV 规范类型。tacker_nfv_defs.yaml 文件将定义 Tacker 特定的 NFV 类型。这些文件将根据模板的版本自动添加到所有 VNFD 中,作为导入项。必须由 Tacker 服务器添加导入项,以便能够指定导入文件的完整路径。

示例 tacker_defs.yaml

data_types:
  tosca.datatypes.tacker.Monitoring.ActionMap:
    properties:
      trigger:
        type: string
        required: true
      action:
        type: string
        required: true
      params:
        type: map
        entry_schema:
          type: string

  tosca.datatypes.tacker.Monitoring.Mechanism:
    properties:
      name:
        type: string
        required: true
      actions:
        type: list
        entry_schema:
          type: tosca.datatypes.tacker.ActionMap
      parameters:
        type: map
        entry_schema:
          type: string

policy_types:
  tosca.policies.tacker.Placement:
    derived_from: tosca.policies.Root

  tosca.policies.tacker.Monitoring:
    derived_from: tosca.policies.Root
    monitoring_params:
      type: map
      entry_schema:
        type: string

  tosca.policies.tacker.Monitoring.Failure:
    derived_from: tosca.policies.tacker.Monitoring
    action:
      type: string

  tosca.policies.tacker.Monitoring.Failure.Respawn:
    derived_from: tosca.policies.tacker.Monitoring.Failure
    action: respawn

  tosca.policies.tacker.Monitoring.Failure.Terminate:
    derived_from: tosca.policies.tacker.Monitoring.Failure
    action: log_and_kill

  tosca.policies.tacker.Monitoring.Failure.Log:
    derived_from: tosca.policies.tacker.Monitoring.Failure
    action: log

  tosca.policies.tacker.Monitoring.NoOp:
    derived_from: tosca.policies.tacker.Monitoring

  tosca.policies.tacker.Monitoring.Ping:
    derived_from: tosca.policies.tacker.Monitoring
    monitoring_params:
      count: 3
      interval: 5

  tosca.policies.tacker.Monitoring.HttpPing:
    derived_from: tosca.policies.tacker.Monitoring.Ping

group_types:
  tosca.groups.tacker.VDU:
    derived_from: tosca.groups.Root

示例 tacker_nfv_defs.yaml

node_types:
  tosca.nodes.nfv.VDU.Tacker:
    derived_from: tosca.nodes.nfv.VDU
    properties:
      image:
        type: string
      flavor:
        type: string
      availability_zone:
        type: string
      metadata:
        type: map
        entry_schema:
          type: string
      config_drive:
        type: boolean
        default: false

      placement_policy:
        type: string

      monitoring_policy:
        type: tosca.datatypes.tacker.MonitoringMechanism

      config:
        type: string

      mgmt_driver:
        type: string

      service_type:
        type: string

  tosca.nodes.nfv.CP.Tacker:
    derived_from: tosca.nodes.nfv.CP
    properties:
      management:
        type: boolean
        required: false
        default: false
      anti_spoofing_protection:
        type: boolean
        required: false

备选方案

Tacker 可以继续维护它自己的 YAML 格式和 HOT 模板生成,但这会对未来的功能施加重大限制。

数据模型影响

对 tosca-parser/heat-translator 的初始支持将不会对数据模型产生影响。未来的更改可能需要添加指定不同 VDU 的不同管理驱动程序的能力,以及处理 CSAR 文件。

REST API 影响

安全影响

通知影响

其他最终用户影响

用户需要使用 TOSCA 模板才能利用此功能

性能影响

使用 tosca-parser 和 heat-translator 将比自研解决方案消耗更多的周期,但提供的额外功能足以弥补处理时间的小幅增加。

其他部署者影响

计划是在 Mitaka 周期内同时支持现有的 YAML 格式和 TOSCA。现有的 YAML 格式将在 Mitaka 中弃用,并在 Newton 中删除。

开发人员影响

实现

负责人

主要负责人

bob-haddleton

工作项

  • 开发 tacker_defs.yaml 文件,以使用 Tacker 所需的属性扩展现有的 TOSCA NFV 节点定义。文件存储在 tacker/vm/tosca/lib 中

  • 创建模块 tacker.vm.tosca.utils,以提供实用程序方法来根据需要操作 TOSCA 模板

  • 修改现有的 heat 驱动程序 create_device_template_pre() 方法,以检测 TOSCA 模板并调用 tosca-parser (ToscaTemplate) 来预处理模板是否存在任何语法错误,并将结果数据存储在数据库中。

  • 修改现有的 heat 驱动程序 create() 方法,以检测 TOSCA 模板并调用 tosca-parser (ToscaTemplate) 和 heat-translator (TOSCATranslator) 来生成 HOT 模板。生成的 ToscaTemplate 需要经过处理以删除 Tacker 特定的节点和属性,然后才能由 TOSCATranslator 处理以生成 HOT 模板。

依赖项

  • 此功能需要 tosca-parser 0.4.0 版本

  • 此功能需要 heat-translator 0.4.0 版本

测试

现有的 heat 驱动程序测试将扩展到包括对使用 TOSCA 模板输入测试 create_device_template_pre() 方法和 create() 方法的支持,以确保该功能按预期工作。

文档影响

需要记录 tacker_defs.yaml 定义的 NFV 规范的 Tacker 特定扩展,并提供示例 TOSCA 模板。还需要 Devstack 示例模板。

参考资料