Template to demonstrate properties override

Test template to provide an example of how to overrride TOSCA normative
type properties in custom type.

Change-Id: I91d1a9170d47f8313c24b194ad264898830a87c4
This commit is contained in:
sahdev zala 2017-01-07 23:00:18 -05:00
parent ed70f10d7a
commit 5d1647d5f5
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,37 @@
tosca_definitions_version: tosca_simple_yaml_1_0
description: >
Test template for deploying a server with custom properties for image,
flavor and key_name. This template provides an example of how to
override TOSCA normative type's (e.g. Compute) properties. Here new
properties are injected in the tosca.nodes.myserver which derives from
tosca.nodes.Compute. Note that tosca.nodes.myserver can not be a name of
another normative type (e.g. tosca.nodes.WebServer or tosca.nodes.nfv.VDU)
because that will create conflict while resolving type definition by the
TOSCA Parser.
node_types:
tosca.nodes.myserver:
derived_from: tosca.nodes.Compute
properties:
key_name:
type: string
image:
type: string
flavor:
type: string
topology_template:
inputs:
key_name:
type: string
default: inputkey
node_templates:
my_server:
type: tosca.nodes.myserver
properties:
flavor: m1.medium
image: rhel-6.5-test-image
key_name:
get_input: key_name

View File

@ -1776,3 +1776,9 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
'''
self.assertIsNone(
self._single_node_template_content_test(tpl_snippet3))
def test_properties_override_with_flavor_and_image(self):
tpl_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"data/test_normative_type_properties_override.yaml")
self.assertIsNotNone(ToscaTemplate(tpl_path))