Comment 9 for bug 1652928

Revision history for this message
Sahdev Zala (spzala) wrote :

Kanagarj and Sridhar, thanks for digging more into it. I totally agree and can't see TOSCA templates without custom types, and that's we have several template examples created and supported in the tosca-parser and HT. As I said above use of #3 requires an "import" statement in the TOSCA service template. For example, https://github.com/openstack/tacker/blob/master/samples/tosca-templates/vnfd/tosca-vnfd-scale.yaml is not importing any 'type definition'. In order to use custom type definition the tosca-parser requires to access it. i.e. 'imports' statement is required in the service template as I mentioned earlier.

I am all up to fix this, if it is in issue with TP or HT with the highest priority but if I can't recreate it and see that custom type support is working fine I am helpless :(.
@Bob, you know tosca-parser and Tacker well. If you can jump on here that would be great.

Here is an example of how the custom type works:

Custom type definition as scalingcustom_nfv.yaml:

tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0

description: >
  Template for deploying servers based on policies.

policy_types:
  tosca.policies.tacker.Scaling:
    derived_from: tosca.policies.Scaling

Service Template (note the imports statement):

tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0

description: >
  Template for deploying servers based on policies.

imports:
  - scalingcustom_nfv.yaml

topology_template:
  node_templates:
    my_server_1:
      type: tosca.nodes.Compute
      capabilities:
        host:
         properties:
           num_cpus: 2
           disk_size: 10 GB
           mem_size: 512 MB
        os:
         properties:
            # host Operating System image properties
            architecture: x86_64
            type: Linux
            distribution: RHEL
            version: 6.5
  policies:
    - asg:
        type: tosca.policies.tacker.Scaling
        description: Simple node autoscaling
        targets: [my_server_1]
        triggers:
          resize_compute:
            description: trigger
            condition:
              constraint: utilization greater_than 50%
              period: 60
              evaluations: 1
              method: average
        properties:
          min_instances: 2
          max_instances: 10
          default_instances: 3
          increment: 1