Rename TOSCA AttachTo relationship

The AttachTo relationship name has been changed to AttachesTo per the latest
TOSCA spec to be consistent with naming like BindsTo, ConnectsTo etc.

Change-Id: Ibd0e0232a06b02c494def452755422ab94c4024e
This commit is contained in:
spzala 2015-04-07 12:16:29 -07:00
parent b1326d4490
commit 1727e773b9
12 changed files with 28 additions and 28 deletions

View File

@ -16,7 +16,7 @@ from translator.toscalib.functions import GetInput
class ToscaBlockStorageAttachment(HotResource):
'''Translate TOSCA relationship AttachTo for Compute and BlockStorage.'''
'''Translate TOSCA relationship AttachesTo for Compute and BlockStorage.'''
def __init__(self, template, nodetemplates, instace_uuid, volume_id):
super(ToscaBlockStorageAttachment,

View File

@ -162,7 +162,7 @@ class TranslateNodeTemplates():
attach = False
ntpl = self.nodetemplates
for key, value in node.relationships.items():
if key.type == 'tosca.relationships.AttachTo':
if key.type == 'tosca.relationships.AttachesTo':
if value.type == 'tosca.nodes.BlockStorage':
attach = True
if attach:

View File

@ -39,7 +39,7 @@ node_templates:
version: 18
requirements:
- attachment: my_storage
type: AttachTo
type: AttachesTo
properties:
location: { get_input: storage_location }
my_storage:

View File

@ -69,7 +69,7 @@ node_templates:
relationship_types:
MyAttachTo:
derived_from: tosca.relationships.AttachTo
derived_from: tosca.relationships.AttachesTo
properties: # follows the syntax of property definitions
location:
type: string

View File

@ -39,7 +39,7 @@ node_templates:
version: 18
requirements:
- attachment: my_storage
template: storage_attachto_1
template: storage_attachesto_1
my_web_app_tier_2:
type: tosca.nodes.Compute
@ -57,7 +57,7 @@ node_templates:
version: 18
requirements:
- attachment: my_storage
template: storage_attachto_2
template: storage_attachesto_2
my_storage:
type: tosca.nodes.BlockStorage
@ -66,19 +66,19 @@ node_templates:
snapshot_id: { get_input: storage_snapshot_id }
relationship_templates:
storage_attachto_1:
storage_attachesto_1:
type: MyAttachTo
properties:
location: /my_data_location
storage_attachto_2:
storage_attachesto_2:
type: MyAttachTo
properties:
location: /some_other_data_location
relationship_types:
MyAttachTo:
derived_from: tosca.relationships.AttachTo
derived_from: tosca.relationships.AttachesTo
properties: # follows the syntax of property definitions
location:
type: string

View File

@ -37,7 +37,7 @@ node_templates:
version: 18
requirements:
- attachment: my_storage
type: AttachTo
type: AttachesTo
properties:
location: { get_input: storage_location }
my_storage:
@ -62,7 +62,7 @@ node_templates:
version: 18
requirements:
- attachment: my_storage2
type: AttachTo
type: AttachesTo
properties:
location: { get_input: storage_location }
my_storage2:

View File

@ -32,7 +32,7 @@ class ToscaBlockStorageTest(TestCase):
translate = TOSCATranslator(tosca, self.parsed_params)
output = translate.translate()
expected_resouce = {'attachto_1':
expected_resouce = {'attachesto_1':
{'type': 'OS::Cinder::VolumeAttachment',
'properties':
{'instance_uuid': 'my_server',
@ -42,8 +42,8 @@ class ToscaBlockStorageTest(TestCase):
output_dict = translator.toscalib.utils.yamlparser.simple_parse(output)
resources = output_dict.get('resources')
translated_value = resources.get('attachto_1')
expected_value = expected_resouce.get('attachto_1')
translated_value = resources.get('attachesto_1')
expected_value = expected_resouce.get('attachesto_1')
self.assertEqual(translated_value, expected_value)
outputs = output_dict['outputs']
@ -114,12 +114,12 @@ class ToscaBlockStorageTest(TestCase):
resources = output_dict.get('resources')
# Resource name suffix depends on nodetemplates order in dict, which is
# not certain. So we have two possibilities of resources name.
if resources.get('storage_attachto_1_1'):
self.assertIn('storage_attachto_1_1', resources.keys())
self.assertIn('storage_attachto_2_2', resources.keys())
if resources.get('storage_attachesto_1_1'):
self.assertIn('storage_attachesto_1_1', resources.keys())
self.assertIn('storage_attachesto_2_2', resources.keys())
else:
self.assertIn('storage_attachto_1_2', resources.keys())
self.assertIn('storage_attachto_2_1', resources.keys())
self.assertIn('storage_attachesto_1_2', resources.keys())
self.assertIn('storage_attachesto_2_1', resources.keys())
self.assertIn(expected_resource_1, resources.values())
self.assertIn(expected_resource_2, resources.values())
@ -148,7 +148,7 @@ class ToscaBlockStorageTest(TestCase):
output_dict = translator.toscalib.utils.yamlparser.simple_parse(output)
resources = output_dict.get('resources')
translated_volume_attachment.append(resources.get('attachto_1'))
translated_volume_attachment.append(resources.get('attachto_2'))
translated_volume_attachment.append(resources.get('attachesto_1'))
translated_volume_attachment.append(resources.get('attachesto_2'))
self.assertIn(expected_resource_1, translated_volume_attachment)
self.assertIn(expected_resource_2, translated_volume_attachment)

View File

@ -67,7 +67,7 @@ tosca.nodes.Compute:
type: tosca.capabilities.Scalable
requirements:
- attachment: tosca.nodes.BlockStorage
type: AttachTo
type: AttachesTo
tosca.nodes.SoftwareComponent:
derived_from: tosca.nodes.Root
@ -304,7 +304,7 @@ tosca.relationships.ConnectsTo:
derived_from: tosca.relationships.DependsOn
valid_targets: [ tosca.capabilities.Endpoint ]
tosca.relationships.AttachTo:
tosca.relationships.AttachesTo:
derived_from: tosca.relationships.Root
valid_targets: [ tosca.capabilities.Attachment ]
properties:

View File

@ -35,12 +35,12 @@ class EntityType(object):
TOSCA_DEF = loader(TOSCA_DEF_FILE)
RELATIONSHIP_TYPE = (DEPENDSON, HOSTEDON, CONNECTSTO, ATTACHTO,
RELATIONSHIP_TYPE = (DEPENDSON, HOSTEDON, CONNECTSTO, ATTACHESTO,
LINKSTO, BINDSTO) = \
('tosca.relationships.DependsOn',
'tosca.relationships.HostedOn',
'tosca.relationships.ConnectsTo',
'tosca.relationships.AttachTo',
'tosca.relationships.AttachesTo',
'tosca.relationships.network.LinksTo',
'tosca.relationships.network.BindsTo')

View File

@ -48,6 +48,6 @@ node_templates:
relationship_templates:
storage_attachment:
type: tosca.relationships.AttachTo
type: tosca.relationships.AttachesTo
properties:
location: /temp

View File

@ -251,7 +251,7 @@ class ToscaTemplateTest(TestCase):
node in node_tpl.relationships.items()])
if node_tpl.name == 'my_server':
self.assertEqual(
[('tosca.relationships.AttachTo', 'my_storage')],
[('tosca.relationships.AttachesTo', 'my_storage')],
[(relation.type, node.name) for
relation,
node in node_tpl.relationships.items()])

View File

@ -395,7 +395,7 @@ class ToscaTemplateValidationTest(TestCase):
tpl_snippet = '''
relationship_templates:
storage_attachto:
type: AttachTo
type: AttachesTo
properties:
device: test_device
'''