summaryrefslogtreecommitdiffstats
path: root/tosca2heat
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat')
-rw-r--r--tosca2heat/heat-translator/translator/hot/translate_node_templates.py12
-rw-r--r--tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nfv_sample.yaml19
-rw-r--r--tosca2heat/heat-translator/translator/tests/data/test_tosca_nfv_sample.yaml19
3 files changed, 41 insertions, 9 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
index f32d42b..4dd9556 100644
--- a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
+++ b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
@@ -533,14 +533,20 @@ class TranslateNodeTemplates(object):
def _get_attachment_node(self, node, suffix, volume_name):
attach = False
ntpl = self.nodetemplates
- for key, value in node.relationships.items():
- if key.is_derived_from('tosca.relationships.AttachesTo'):
- if value.is_derived_from('tosca.nodes.BlockStorage'):
+ for key_r, value_n in node.relationships.items():
+ if key_r.is_derived_from('tosca.relationships.AttachesTo'):
+ if value_n.is_derived_from('tosca.nodes.BlockStorage'):
attach = True
if attach:
relationship_tpl = None
for req in node.requirements:
for key, val in req.items():
+ if isinstance(val, dict):
+ if value_n.name != val.get('node'):
+ continue
+ else:
+ if value_n.name != val:
+ continue
attach = val
relship = val.get('relationship')
for rkey, rval in val.items():
diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nfv_sample.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nfv_sample.yaml
index d66569d..79750d4 100644
--- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nfv_sample.yaml
+++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nfv_sample.yaml
@@ -8,23 +8,38 @@ resources:
VDU1:
type: OS::Nova::Server
properties:
- flavor: m1.medium
+ flavor: m1.tiny
image: rhel-6.5-test-image
networks:
- port: { get_resource: CP1 }
user_data_format: SOFTWARE_CONFIG
depends_on:
- VDU2
+ - BlockStorage
VDU2:
type: OS::Nova::Server
properties:
- flavor: m1.medium
+ flavor: m1.tiny
image: rhel-6.5-test-image
networks:
- port: { get_resource: CP2 }
user_data_format: SOFTWARE_CONFIG
+ BlockStorage:
+ type: OS::Cinder::Volume
+ properties:
+ size: 1
+
+ tosca.relationships.attachesto_1:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ instance_uuid:
+ get_resource: VDU1
+ mountpoint: /dev/vdb1
+ volume_id:
+ get_resource: BlockStorage
+
CP1:
type: OS::Neutron::Port
properties:
diff --git a/tosca2heat/heat-translator/translator/tests/data/test_tosca_nfv_sample.yaml b/tosca2heat/heat-translator/translator/tests/data/test_tosca_nfv_sample.yaml
index e5c8d3c..5803bd2 100644
--- a/tosca2heat/heat-translator/translator/tests/data/test_tosca_nfv_sample.yaml
+++ b/tosca2heat/heat-translator/translator/tests/data/test_tosca_nfv_sample.yaml
@@ -10,8 +10,8 @@ topology_template:
capabilities:
host:
properties:
- num_cpus: 2
- disk_size: 10 GB
+ num_cpus: 1
+ disk_size: 1 GB
mem_size: 512 MB
# Guest Operating System properties
os:
@@ -23,14 +23,25 @@ topology_template:
version: 6.5
requirements:
- high_availability: VDU2
+ - local_storage:
+ node: BlockStorage
+ relationship:
+ type: tosca.relationships.AttachesTo
+ properties:
+ location: /dev/vdb1
+
+ BlockStorage:
+ type: tosca.nodes.BlockStorage
+ properties:
+ size: 1 GB
VDU2:
type: tosca.nodes.nfv.VDU
capabilities:
host:
properties:
- num_cpus: 2
- disk_size: 10 GB
+ num_cpus: 1
+ disk_size: 1 GB
mem_size: 512 MB
# Guest Operating System properties
os: