Remove default key_name property and pass through all others
- Remove the default "key_name: userkey" property which prevents the user from specifying their own key name - Handle all properties of the Compute node as Server properties and remove the special cases for image and flavor as they will now be handled by default - Support 'key_name' as a parameter which will be added as an input parameter to the HOT template and as a property to all Compute nodes, referencing the input parameter so it can be overridden at stack deployment time. Change-Id: I6ae89e02642348074a92f9af638f43acd887ad91 Closes-Bug: 1544237
This commit is contained in:
parent
18763928c2
commit
1c4bfec4d5
@ -276,8 +276,7 @@ class ToscaComputeTest(TestCase):
|
|||||||
mock_ks_response = mock.MagicMock()
|
mock_ks_response = mock.MagicMock()
|
||||||
mock_ks_content = {}
|
mock_ks_content = {}
|
||||||
mock_ks_response.content = json.dumps(mock_ks_content)
|
mock_ks_response.content = json.dumps(mock_ks_content)
|
||||||
expectedprops = {'key_name': 'userkey',
|
expectedprops = {'flavor': 'm1.small',
|
||||||
'flavor': 'm1.small',
|
|
||||||
'user_data_format': 'SOFTWARE_CONFIG',
|
'user_data_format': 'SOFTWARE_CONFIG',
|
||||||
'image': None}
|
'image': None}
|
||||||
self._tosca_compute_test(
|
self._tosca_compute_test(
|
||||||
|
@ -95,9 +95,10 @@ class ToscaCompute(HotResource):
|
|||||||
self.nodetemplate.get_capability('host'),
|
self.nodetemplate.get_capability('host'),
|
||||||
self.nodetemplate.get_capability('os'))
|
self.nodetemplate.get_capability('os'))
|
||||||
self.properties['user_data_format'] = 'SOFTWARE_CONFIG'
|
self.properties['user_data_format'] = 'SOFTWARE_CONFIG'
|
||||||
# TODO(anyone): handle user key
|
tosca_props = self._get_tosca_props(
|
||||||
# hardcoded here for testing
|
self.nodetemplate.get_properties_objects())
|
||||||
self.properties['key_name'] = 'userkey'
|
for key, value in tosca_props.items():
|
||||||
|
self.properties[key] = value
|
||||||
|
|
||||||
# To be reorganized later based on new development in Glance and Graffiti
|
# To be reorganized later based on new development in Glance and Graffiti
|
||||||
def translate_compute_flavor_and_image(self,
|
def translate_compute_flavor_and_image(self,
|
||||||
@ -112,14 +113,10 @@ class ToscaCompute(HotResource):
|
|||||||
for prop in host_capability.get_properties_objects():
|
for prop in host_capability.get_properties_objects():
|
||||||
host_cap_props[prop.name] = prop.value
|
host_cap_props[prop.name] = prop.value
|
||||||
flavor = self._best_flavor(host_cap_props)
|
flavor = self._best_flavor(host_cap_props)
|
||||||
else:
|
|
||||||
flavor = self.nodetemplate.get_property_value("flavor") or None
|
|
||||||
if os_capability:
|
if os_capability:
|
||||||
for prop in os_capability.get_properties_objects():
|
for prop in os_capability.get_properties_objects():
|
||||||
os_cap_props[prop.name] = prop.value
|
os_cap_props[prop.name] = prop.value
|
||||||
image = self._best_image(os_cap_props)
|
image = self._best_image(os_cap_props)
|
||||||
else:
|
|
||||||
image = self.nodetemplate.get_property_value("image") or None
|
|
||||||
hot_properties['flavor'] = flavor
|
hot_properties['flavor'] = flavor
|
||||||
hot_properties['image'] = image
|
hot_properties['image'] = image
|
||||||
return hot_properties
|
return hot_properties
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from toscaparser.dataentity import DataEntity
|
from toscaparser.dataentity import DataEntity
|
||||||
from toscaparser.elements.scalarunit import ScalarUnit_Size
|
from toscaparser.elements.scalarunit import ScalarUnit_Size
|
||||||
|
from toscaparser.parameters import Input
|
||||||
from toscaparser.utils.gettextutils import _
|
from toscaparser.utils.gettextutils import _
|
||||||
from toscaparser.utils.validateutils import TOSCAVersionProperty
|
from toscaparser.utils.validateutils import TOSCAVersionProperty
|
||||||
from translator.hot.syntax.hot_parameter import HotParameter
|
from translator.hot.syntax.hot_parameter import HotParameter
|
||||||
@ -71,6 +72,14 @@ class TranslateInputs(object):
|
|||||||
|
|
||||||
def _translate_inputs(self):
|
def _translate_inputs(self):
|
||||||
hot_inputs = []
|
hot_inputs = []
|
||||||
|
if 'key_name' in self.parsed_params and 'key_name' not in self.inputs:
|
||||||
|
name = 'key_name'
|
||||||
|
type = 'string'
|
||||||
|
default = self.parsed_params[name]
|
||||||
|
schema_dict = {'type': type, 'default': default}
|
||||||
|
input = Input(name, schema_dict)
|
||||||
|
self.inputs.append(input)
|
||||||
|
|
||||||
log.info(_('Translating TOSCA input type to HOT input type.'))
|
log.info(_('Translating TOSCA input type to HOT input type.'))
|
||||||
for input in self.inputs:
|
for input in self.inputs:
|
||||||
hot_default = None
|
hot_default = None
|
||||||
|
@ -19,6 +19,7 @@ import six
|
|||||||
from toscaparser.functions import GetAttribute
|
from toscaparser.functions import GetAttribute
|
||||||
from toscaparser.functions import GetInput
|
from toscaparser.functions import GetInput
|
||||||
from toscaparser.functions import GetProperty
|
from toscaparser.functions import GetProperty
|
||||||
|
from toscaparser.properties import Property
|
||||||
from toscaparser.relationship_template import RelationshipTemplate
|
from toscaparser.relationship_template import RelationshipTemplate
|
||||||
from toscaparser.utils.gettextutils import _
|
from toscaparser.utils.gettextutils import _
|
||||||
from translator.common.exception import ToscaClassAttributeError
|
from translator.common.exception import ToscaClassAttributeError
|
||||||
@ -197,6 +198,13 @@ class TranslateNodeTemplates(object):
|
|||||||
volume_name)
|
volume_name)
|
||||||
if attachment_node:
|
if attachment_node:
|
||||||
self.hot_resources.append(attachment_node)
|
self.hot_resources.append(attachment_node)
|
||||||
|
for i in self.tosca.inputs:
|
||||||
|
if (i.name == 'key_name' and
|
||||||
|
node.get_property_value('key_name') is None):
|
||||||
|
schema = {'type': i.type, 'default': i.default}
|
||||||
|
value = {"get_param": "key_name"}
|
||||||
|
prop = Property(i.name, value, schema)
|
||||||
|
node._properties.append(prop)
|
||||||
|
|
||||||
# Handle life cycle operations: this may expand each node
|
# Handle life cycle operations: this may expand each node
|
||||||
# into multiple HOT resources and may change their name
|
# into multiple HOT resources and may change their name
|
||||||
|
@ -20,7 +20,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: ubuntu-12.04-software-config-os-init
|
image: ubuntu-12.04-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
customwebserver_create_config:
|
customwebserver_create_config:
|
||||||
type: OS::Heat::SoftwareConfig
|
type: OS::Heat::SoftwareConfig
|
||||||
|
@ -17,7 +17,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: ubuntu-12.04-software-config-os-init
|
image: ubuntu-12.04-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
customwebserver_create_config:
|
customwebserver_create_config:
|
||||||
type: OS::Heat::SoftwareConfig
|
type: OS::Heat::SoftwareConfig
|
||||||
|
@ -18,7 +18,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: ubuntu-12.04-software-config-os-init
|
image: ubuntu-12.04-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
customwebserver_create_config:
|
customwebserver_create_config:
|
||||||
type: OS::Heat::SoftwareConfig
|
type: OS::Heat::SoftwareConfig
|
||||||
|
@ -472,7 +472,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
mongo_server:
|
mongo_server:
|
||||||
@ -480,7 +479,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
logstash_server:
|
logstash_server:
|
||||||
@ -488,7 +486,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
elasticsearch_server:
|
elasticsearch_server:
|
||||||
@ -496,7 +493,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
kibana_server:
|
kibana_server:
|
||||||
@ -504,7 +500,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -472,7 +472,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
mongo_server:
|
mongo_server:
|
||||||
@ -480,7 +479,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
logstash_server:
|
logstash_server:
|
||||||
@ -488,7 +486,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
elasticsearch_server:
|
elasticsearch_server:
|
||||||
@ -496,7 +493,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
kibana_server:
|
kibana_server:
|
||||||
@ -504,7 +500,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
heat_template_version: 2013-05-23
|
heat_template_version: 2013-05-23
|
||||||
|
|
||||||
description: >
|
description: >
|
||||||
Template for deploying a server with custom properties for image and flavor.
|
Template for deploying a server with custom properties for image, flavor and key_name.
|
||||||
|
|
||||||
parameters: {}
|
parameters:
|
||||||
|
key_name:
|
||||||
|
type: string
|
||||||
|
default: inputkey
|
||||||
resources:
|
resources:
|
||||||
my_server:
|
my_server:
|
||||||
type: OS::Nova::Server
|
type: OS::Nova::Server
|
||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: rhel-6.5-test-image
|
image: rhel-6.5-test-image
|
||||||
key_name: userkey
|
key_name: {get_param: key_name}
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
outputs: {}
|
outputs: {}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
heat_template_version: 2013-05-23
|
||||||
|
|
||||||
|
description: >
|
||||||
|
Template for deploying a server with custom properties for image, flavor and key_name.
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
key_name:
|
||||||
|
type: string
|
||||||
|
default: paramkey
|
||||||
|
resources:
|
||||||
|
my_server:
|
||||||
|
type: OS::Nova::Server
|
||||||
|
properties:
|
||||||
|
flavor: m1.medium
|
||||||
|
image: rhel-6.5-test-image
|
||||||
|
key_name: {get_param: key_name}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
outputs: {}
|
@ -10,6 +10,5 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: rhel-6.5-test-image
|
image: rhel-6.5-test-image
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
outputs: {}
|
outputs: {}
|
@ -0,0 +1,19 @@
|
|||||||
|
heat_template_version: 2013-05-23
|
||||||
|
|
||||||
|
description: >
|
||||||
|
Template for deploying a single server with predefined properties.
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
key_name:
|
||||||
|
type: string
|
||||||
|
default: userkey
|
||||||
|
|
||||||
|
resources:
|
||||||
|
my_server:
|
||||||
|
type: OS::Nova::Server
|
||||||
|
properties:
|
||||||
|
flavor: m1.medium
|
||||||
|
image: rhel-6.5-test-image
|
||||||
|
key_name: { get_param: key_name }
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
outputs: {}
|
@ -16,7 +16,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
logstash_server:
|
logstash_server:
|
||||||
@ -24,7 +23,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
app_collectd_create_config:
|
app_collectd_create_config:
|
||||||
|
@ -157,7 +157,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
app_server:
|
app_server:
|
||||||
@ -165,7 +164,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -188,7 +188,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.xlarge
|
flavor: m1.xlarge
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -186,7 +186,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.xlarge
|
flavor: m1.xlarge
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -23,7 +23,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: ubuntu-12.04-software-config-os-init
|
image: ubuntu-12.04-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -23,7 +23,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: ubuntu-12.04-software-config-os-init
|
image: ubuntu-12.04-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -23,7 +23,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.large
|
flavor: m1.large
|
||||||
image: ubuntu-12.04-software-config-os-init
|
image: ubuntu-12.04-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -13,6 +13,5 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: rhel-6.5-test-image
|
image: rhel-6.5-test-image
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
outputs: {}
|
outputs: {}
|
||||||
|
@ -21,7 +21,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
my_software_create_deploy:
|
my_software_create_deploy:
|
||||||
|
@ -26,7 +26,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: ubuntu-software-config-os-init
|
image: ubuntu-software-config-os-init
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
|
||||||
web_server_create_deploy:
|
web_server_create_deploy:
|
||||||
|
@ -15,7 +15,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: cirros-0.3.2-x86_64-uec
|
image: cirros-0.3.2-x86_64-uec
|
||||||
key_name: userkey
|
|
||||||
networks:
|
networks:
|
||||||
- port: { get_resource: my_port }
|
- port: { get_resource: my_port }
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
@ -11,7 +11,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: cirros-0.3.2-x86_64-uec
|
image: cirros-0.3.2-x86_64-uec
|
||||||
key_name: userkey
|
|
||||||
networks:
|
networks:
|
||||||
- port: { get_resource: my_port1 }
|
- port: { get_resource: my_port1 }
|
||||||
- port: { get_resource: my_port2 }
|
- port: { get_resource: my_port2 }
|
||||||
|
@ -15,7 +15,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: cirros-0.3.2-x86_64-uec
|
image: cirros-0.3.2-x86_64-uec
|
||||||
key_name: userkey
|
|
||||||
networks:
|
networks:
|
||||||
- port: { get_resource: my_port }
|
- port: { get_resource: my_port }
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
@ -27,7 +27,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: cirros-0.3.2-x86_64-uec
|
image: cirros-0.3.2-x86_64-uec
|
||||||
key_name: userkey
|
|
||||||
networks:
|
networks:
|
||||||
- port: { get_resource: my_port }
|
- port: { get_resource: my_port }
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
@ -37,7 +36,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: cirros-0.3.2-x86_64-uec
|
image: cirros-0.3.2-x86_64-uec
|
||||||
key_name: userkey
|
|
||||||
networks:
|
networks:
|
||||||
- port: { get_resource: my_port2 }
|
- port: { get_resource: my_port2 }
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
@ -34,7 +34,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
|
@ -38,7 +38,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
@ -57,7 +56,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
|
@ -38,7 +38,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
@ -57,7 +56,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
|
@ -42,7 +42,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
@ -61,7 +60,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
|
@ -42,7 +42,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
@ -61,7 +60,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
|
@ -34,7 +34,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
|
@ -30,7 +30,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.small
|
flavor: m1.small
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
|
@ -33,7 +33,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
@ -61,7 +60,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage2
|
- my_storage2
|
||||||
|
@ -33,7 +33,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage
|
- my_storage
|
||||||
@ -61,7 +60,6 @@ resources:
|
|||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: fedora-amd64-heat-config
|
image: fedora-amd64-heat-config
|
||||||
key_name: userkey
|
|
||||||
user_data_format: SOFTWARE_CONFIG
|
user_data_format: SOFTWARE_CONFIG
|
||||||
depends_on:
|
depends_on:
|
||||||
- my_storage2
|
- my_storage2
|
||||||
|
@ -1,20 +1,29 @@
|
|||||||
tosca_definitions_version: tosca_simple_yaml_1_0
|
tosca_definitions_version: tosca_simple_yaml_1_0
|
||||||
|
|
||||||
description: Template for deploying a server with custom properties for image and flavor.
|
description: Template for deploying a server with custom properties for image, flavor and key_name.
|
||||||
|
|
||||||
node_types:
|
node_types:
|
||||||
tosca.nodes.nfv.VDU:
|
tosca.nodes.nfv.VDU:
|
||||||
derived_from: tosca.nodes.Compute
|
derived_from: tosca.nodes.Compute
|
||||||
properties:
|
properties:
|
||||||
|
key_name:
|
||||||
|
type: string
|
||||||
image:
|
image:
|
||||||
type: string
|
type: string
|
||||||
flavor:
|
flavor:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
topology_template:
|
topology_template:
|
||||||
|
inputs:
|
||||||
|
key_name:
|
||||||
|
type: string
|
||||||
|
default: inputkey
|
||||||
|
|
||||||
node_templates:
|
node_templates:
|
||||||
my_server:
|
my_server:
|
||||||
type: tosca.nodes.nfv.VDU
|
type: tosca.nodes.nfv.VDU
|
||||||
properties:
|
properties:
|
||||||
flavor: m1.medium
|
flavor: m1.medium
|
||||||
image: rhel-6.5-test-image
|
image: rhel-6.5-test-image
|
||||||
|
key_name:
|
||||||
|
get_input: key_name
|
||||||
|
@ -512,6 +512,16 @@ class ToscaHotTranslationTest(TestCase):
|
|||||||
self.assertEqual({}, diff, '<difference> : ' +
|
self.assertEqual({}, diff, '<difference> : ' +
|
||||||
json.dumps(diff, indent=4, separators=(', ', ': ')))
|
json.dumps(diff, indent=4, separators=(', ', ': ')))
|
||||||
|
|
||||||
|
def test_hot_translate_flavor_image_params(self):
|
||||||
|
tosca_file = '../tests/data/test_tosca_flavor_and_image.yaml'
|
||||||
|
hot_file = '../tests/data/hot_output/hot_flavor_and_image_params.yaml'
|
||||||
|
params = {'key_name': 'paramkey'}
|
||||||
|
diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
|
||||||
|
hot_file,
|
||||||
|
params)
|
||||||
|
self.assertEqual({}, diff, '<difference> : ' +
|
||||||
|
json.dumps(diff, indent=4, separators=(', ', ': ')))
|
||||||
|
|
||||||
def test_hot_translate_custom_type(self):
|
def test_hot_translate_custom_type(self):
|
||||||
tosca_file = '../tests/data/test_tosca_custom_type.yaml'
|
tosca_file = '../tests/data/test_tosca_custom_type.yaml'
|
||||||
hot_file = '../tests/data/hot_output/' \
|
hot_file = '../tests/data/hot_output/' \
|
||||||
@ -556,3 +566,13 @@ class ToscaHotTranslationTest(TestCase):
|
|||||||
params)
|
params)
|
||||||
self.assertEqual({}, diff, '<difference> : ' +
|
self.assertEqual({}, diff, '<difference> : ' +
|
||||||
json.dumps(diff, indent=4, separators=(', ', ': ')))
|
json.dumps(diff, indent=4, separators=(', ', ': ')))
|
||||||
|
|
||||||
|
def test_hot_translate_helloworld_with_userkey(self):
|
||||||
|
tosca_file = '../tests/data/tosca_helloworld.yaml'
|
||||||
|
hot_file = '../tests/data/hot_output/hot_hello_world_userkey.yaml'
|
||||||
|
params = {'key_name': 'userkey'}
|
||||||
|
diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
|
||||||
|
hot_file,
|
||||||
|
params)
|
||||||
|
self.assertEqual({}, diff, '<difference> : ' +
|
||||||
|
json.dumps(diff, indent=4, separators=(', ', ': ')))
|
||||||
|
Loading…
Reference in New Issue
Block a user