OpenStack Tacker介绍 - 8.tacker VNFD模板介绍

1、说明

    本文描述VNFD模板的结构以及基于"V1.0 CSD 03"要求的各个组成部分的字段。
    V1.0 CSD 03:http://docs.oasis-open.org/tosca/tosca-nfv/v1.0/tosca-nfv-v1.0.html

    每一个VNFD的yaml文件模板都有以下部分:

tosca_definitions_version:
   This defines the TOSCA definition version on which the template is based.
   The current version being tosca_simple_profile_for_nfv_1_0_0.

tosca_default_namespace:
   This is optional. It mentions default namespace which includes schema,
   types version etc.

description:
   A short description about the template.

metadata:
   template_name: A name to be given to the template.

topology_template:
   Describes the topology of the VNF under node_template field.
   node_template:
       Describes node types of a VNF.
       VDU:
           Describes properties and capabilities of Virtual Deployment
           Unit.
       CP:
           Describes properties and capabilities of Connection Point.
       VL:
           Describes properties and capabilities of Virtual Link.

2、节点类型

    一个VNF由VDU/s, connection point/s,virtual link/s这3个部分组成。
    每个组成部分包含 type,capabilities, properties, attributes and requirements。
    这3个组成部分位于node_templates内部。
    node_templates 包含于 topology_template 内部。
    

3、VDU

    Virtual Deployment Unit即一个有网络功能的云主机。
    type:      tosca.nodes.nfv.VDU.Tacker
    properties:定义一个VDU的属性,比如镜像,可用域,管理驱动,规格、监控策略、用户数据等。
                全量定义可以参考:tosca.nodes.nfv.VDU.Tacker
                https://github.com/openstack/tacker/blob/master/tacker/tosca/lib/tacker_nfv_defs.yaml

3.1 指定VDU属性

    一个10GB磁盘,2GB内存,2核CPU,使用cirros镜像,可用域为nova的VDU定义如下:

topology_template:
  node_templates:
    VDU1:
      type: tosca.nodes.nfv.VDU.Tacker
      properties:
        image: cirros-0.3.5-x86_64-disk
        availability_zone: nova
      capabilities:
        nfv_compute:
          properties:
            disk_size: 10 GB
            mem_size: 2048 MB
            num_cpus: 2

3.2 使用nova的flavor

    使用nova的flavor来指定VDU的属性的模板如下:
topology_template:
  node_templates:
    VDU1:
      type: tosca.nodes.nfv.VDU.Tacker
      properties:
        image: cirros-0.3.5-x86_64-disk
        flavor: m1.tiny
        availability_zone: nova
当nfv_compute properties 与 flavor同时存在的时候,优先使用flavor

3.3 VDU的监控策略

    对一个VDU进行监控,设置通过每隔20s,间隔2s连续3次ping 22端口来进行监控,
    并且重试6次,监控失败则respawn(具体驱动配置)。
    则监控策略如下:

..
  VDU1:
    type: tosca.nodes.nfv.VDU.Tacker
    properties:
      monitoring_policy:
        name: ping
          parameters:
            monitoring_delay: 20
            count: 3
            interval: 2
            timeout: 2
            actions:
              failure: respawn
            retry: 6
            port: 22

3.3 VDU用户启动数据设置

    格式如下:

..
  VDU1:
    type: tosca.nodes.nfv.VDU.Tacker
    properties:
      user_data_format: RAW
      user_data: |
        #!/bin/sh
        echo "Adding this line to demofile" > /tmp/demofile

3.4 配置VDU

   VDU可以通过管理驱动(mgmt_driver)对config内部的数据进行配置。
   具体例子的可以参考:
   https://docs.openstack.org/tacker/latest/install/deploy_openwrt.html

3.5 指定外部镜像

    artifacts:指定镜像是通过文件或者外部链接。
               最终是由heat调用相关接口使用该镜像并创建VDU。
..
  VDU1:
    type: tosca.nodes.nfv.VDU.Tacker
    artifacts:
      VNFImage:
        type: tosca.artifacts.Deployment.Image.VM
        file: http://download.cirros-cloud.net/0.3.5/ \
              cirros-0.3.5-x86_64-disk.img
3.6 VDU Capabilities
一个VDU的计算属性定义为capabilities。包括内存,磁盘、大页内存,cpu以及核数 每个核的线程数。 一个10GB磁盘,2GB内存,2核CPU,4 KB内存也可以定义如下:
..
  VDU1:
    type: tosca.nodes.nfv.VDU.Tacker
    capabilities:
      nfv_compute:
        properties:
          disk_size: 10 GB
          mem_size: 2048 MB
          num_cpus: 2
          mem_page_size: small
          cpu_allocation:
            cpu_affinity: dedicated
            thread_count: 4
            core_count: 2

3.7 更多属性

https://docs.openstack.org/tacker/latest/contributor/vnfd_template_description.html

4、Connection Points

    Connection Point在openstack中就是neutron的一个网络下的port。
    支持virtual NIC or a SR-IOV NIC。
    并且云主机内部网卡顺序会根据CP的定义来确定VDU网卡顺序。
    VL即virtual Link,为neutron的一个net。

..
topology_template:
  node_templates:
    VDU1:
      ..
    CP1:
      type: tosca.nodes.nfv.CP.Tacker
      properties:
        mac_address: fa:40:08:a0:de:0a
        ip_address: 10.10.1.12
        type: vnic
        anti_spoofing_protection: false
        management: true
        order: 0
        security_groups:
          - secgroup1
          - secgroup2
      requirements:
        - virtualLink:
            node: VL1
        - virtualBinding:
            node: VDU1
    CP2:
      type: tosca.nodes.nfv.CP.Tacker
      properties:
        type: vnic
        anti_spoofing_protection: false
        management: true
        order: 1
      requirements:
        - virtualLink:
            node: VL2
        - virtualBinding:
            node: VDU1
    VL1:
      ..
    VL2:
      ..

properties: 
NameRequiredTypeConstraintsDescription
typeNoString

One of

  • vnic (default)
  • sriov
Specifies the type of CP
anti_spoofing_protectionNoBooleanNoneIndicates whether anti_spoof rule is enabled for the VNF or not. Applicable only when CP type is virtual NIC
managementNoBooleanNoneSpecifies whether the CP is accessible by the user or not
orderNoInteger>= 0Uniquely numbered order of CP within a VDU. Must be provided when binding more than one CP to a VDU and ordering is required.
security_groupsNoListNoneList of security groups to be associated with the CP
mac_addressNoStringNoneThe MAC address
ip _addressNoStringNoneThe IP address

5、Virtual Links

    Virtual link提供VDU的网络连通能力,是一个具体的网络实体。
    一个网络模板如下:
..
topology_template:
  node_templates:
    VDU1:
      ..
    CP1:
      ..
    VL1:
      type: tosca.nodes.nfv.VL
      properties:
        vendor: Acme
        network_name: net-01

6、Floating IP

   一个VDU挂载浮动IP的模板如下
..
topology_template:
  node_templates:
    VDU1:
      ..
    CP1:
      type: tosca.nodes.nfv.CP.Tacker
      properties:
        management: true
      requirements:
        - virtualLink:
            node: VL1
        - virtualBinding:
            node: VDU1
    VL1:
      ..
    FIP1:
      type: tosca.nodes.network.FloatingIP
      properties:
        floating_network: public
      requirements:
        - link:
            node: CP1

7、多VDU配置

    模板如下:

..
topology_template:
  node_templates:
    VDU1:
      ..
    VDU2:
      ..
    CP1:
      ..
    CP2:
      ..
    VL1:
      ..
    VL2:
      ..

8、小结

    一个VNFD定义了一个或多个VNF的拓扑结构。以下是一个比较全的模板:
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFD template mentioning possible values for each node.
metadata:
 template_name: sample-tosca-vnfd-template-guide
topology_template:
 node_templates:
   VDU:
     type: tosca.nodes.nfv.VDU.Tacker
     capabilities:
       nfv_compute:
         properties:
           mem_page_size: [small, large, any, custom]
           cpu_allocation:
             cpu_affinity: [shared, dedicated]
             thread_allocation: [avoid, separate, isolate, prefer]
             socket_count: any integer
             core_count: any integer
             thread_count: any integer
           numa_node_count: any integer
           numa_nodes:
             node0: [ id: >=0, vcpus: [host CPU numbers], mem_size: >= 0MB]
     properties:
       image: Image to be used in VM
       flavor: Nova supported flavors
       availability_zone: available availability zone
       mem_size: in MB
       disk_size: in GB
       num_cpus: any integer
       metadata:
         entry_schema:
       config_drive: [true, false]
       monitoring_policy:
         name: [ping, noop, http-ping]
         parameters:
           monitoring_delay: delay time
           count: any integer
           interval: time to wait between monitoring
           timeout: monitoring timeout time
           actions:
             [failure: respawn, failure: terminate, failure: log]
           retry: Number of retries
           port: specific port number if any
       config: Configuring the VDU as per the network function requirements
       mgmt_driver: [default=noop]
       service_type: type of network service to be done by VDU
       user_data: custom commands to be executed on VDU
       user_data_format: format of the commands
       key_name: user key
     artifacts:
       VNFImage:
         type: tosca.artifacts.Deployment.Image.VM
         file: file to be used for image
   CP:
     type: tosca.nodes.nfv.CP.Tacker
     properties:
       management: [true, false]
       anti_spoofing_protection: [true, false]
       type: [ sriov, vnic ]
       order: order of CP within a VDU
       security_groups: list of security groups
     requirements:
       - virtualLink:
          node: VL to link to
       - virtualBinding:
          node: VDU to bind to
   VL:
     type: tosca.nodes.nfv.VL
     properties:
       network_name: name of network to attach to
       vendor: Acme
9、参考文档
https://docs.openstack.org/tacker/latest/index.html
https://docs.openstack.org/tacker/latest/contributor/vnfd_template_description.html
https://github.com/openstack/tacker/blob/master/tacker/tosca/lib/tacker_nfv_defs.yaml

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值