summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/tests/data/policies
diff options
context:
space:
mode:
authorshangxdy <shang.xiaodong@zte.com.cn>2016-04-07 14:08:49 -0400
committershangxdy <shang.xiaodong@zte.com.cn>2016-04-07 14:59:30 -0400
commitc8201c119ec686e79797721156767685fe848aca (patch)
treecce6aa15ded38d89c18a14b76c21f21e0b1a24f7 /tosca2heat/tosca-parser/toscaparser/tests/data/policies
parent4e4c86a06d58b1816c074c7f9da4c58bbf10368c (diff)
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 <shang.xiaodong@zte.com.cn> Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/tests/data/policies')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/data/policies/custom_definitions.yaml10
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/data/policies/tosca_policy_template.yaml85
2 files changed, 95 insertions, 0 deletions
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
+