From c8201c119ec686e79797721156767685fe848aca Mon Sep 17 00:00:00 2001 From: shangxdy Date: Thu, 7 Apr 2016 14:08:49 -0400 Subject: Update tosca lib to version 0.5 Use tosca-parser and heat-translator to analyze to the basic nfv-tosca type definitions, and use simple tosca new feature such as policy, group and trigger, which are now supported by the latest version of tosca-parser and heat-translator. JIRA:PARSER-18 Change-Id: I797bcacbb5b32005d0aeb0f3f32851ac96e30f01 Signed--off-by: shangxdy Signed-off-by: shangxdy --- .../tests/data/policies/custom_definitions.yaml | 10 +++ .../tests/data/policies/tosca_policy_template.yaml | 85 ++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 tosca2heat/tosca-parser/toscaparser/tests/data/policies/custom_definitions.yaml create mode 100644 tosca2heat/tosca-parser/toscaparser/tests/data/policies/tosca_policy_template.yaml (limited to 'tosca2heat/tosca-parser/toscaparser/tests/data/policies') diff --git a/tosca2heat/tosca-parser/toscaparser/tests/data/policies/custom_definitions.yaml b/tosca2heat/tosca-parser/toscaparser/tests/data/policies/custom_definitions.yaml new file mode 100644 index 0000000..7f15ade --- /dev/null +++ b/tosca2heat/tosca-parser/toscaparser/tests/data/policies/custom_definitions.yaml @@ -0,0 +1,10 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +policy_types: + mycompany.mytypes.myScalingPolicy: + derived_from: tosca.policies.Scaling + metadata: + type: map + entry_schema: + type: string + diff --git a/tosca2heat/tosca-parser/toscaparser/tests/data/policies/tosca_policy_template.yaml b/tosca2heat/tosca-parser/toscaparser/tests/data/policies/tosca_policy_template.yaml new file mode 100644 index 0000000..92bebe5 --- /dev/null +++ b/tosca2heat/tosca-parser/toscaparser/tests/data/policies/tosca_policy_template.yaml @@ -0,0 +1,85 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + Template for deploying servers based on policies. + +imports: + - custom_definitions.yaml + +topology_template: + node_templates: + my_server_1: + type: tosca.nodes.Compute + capabilities: + # Host container properties + host: + properties: + num_cpus: 2 + disk_size: 10 GB + mem_size: 512 MB + # Guest Operating System properties + os: + properties: + # host Operating System image properties + architecture: x86_64 + type: Linux + distribution: RHEL + version: 6.5 + + my_server_2: + type: tosca.nodes.Compute + capabilities: + host: + properties: + disk_size: 10 GB + num_cpus: 2 + mem_size: 4096 MB + os: + properties: + architecture: x86_64 + type: Linux + distribution: Ubuntu + version: 14.04 + + groups: + webserver_group: + members: [ my_server_1, my_server_2 ] + type: tosca.groups.Root + metadata: { user1: 1008, user2: 1002 } + + + policies: + - my_compute_placement_policy: + type: tosca.policies.Placement + description: Apply placement policy to servers + metadata: { user1: 1001, user2: 1002 } + targets: [ my_server_1, my_server_2 ] + triggers: + resize_compute: + description: trigger + event_type: tosca.events.resource.utilization + schedule: + start_time: "2015-05-07T07:00:00Z" + end_time: "2015-06-07T07:00:00Z" + target_filter: + node: master-container + requirement: host + capability: Container + condition: + constraint: utilization greater_than 50% + period: 60 + evaluations: 1 + method: average + action: + resize: # Operation name + inputs: + strategy: LEAST_USED + implementation: Senlin.webhook() + - my_groups_placement: + type: mycompany.mytypes.myScalingPolicy + targets: [ webserver_group ] + description: my company scaling policy + metadata: + user1: 1001 + user2: 1003 + -- cgit 1.2.3-korg