summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tosca2heat/heat-translator/translator/shell.py9
-rw-r--r--tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nfv_sample.yaml17
-rw-r--r--tosca2heat/heat-translator/translator/tests/data/test_tosca_nfv_sample.yaml32
-rw-r--r--tosca2heat/heat-translator/translator/tests/test_shell.py2
4 files changed, 56 insertions, 4 deletions
diff --git a/tosca2heat/heat-translator/translator/shell.py b/tosca2heat/heat-translator/translator/shell.py
index 884e3a6..dc49b5c 100644
--- a/tosca2heat/heat-translator/translator/shell.py
+++ b/tosca2heat/heat-translator/translator/shell.py
@@ -129,7 +129,10 @@ class TranslatorShell(object):
if heat_tpl:
if utils.check_for_env_variables() and deploy:
try:
- heatclient(heat_tpl, stack_name, parsed_params)
+ file_name = os.path.basename(
+ os.path.splitext(template_file)[0])
+ heatclient(heat_tpl, stack_name,
+ file_name, parsed_params)
except Exception:
log.error(_("Unable to launch the heat stack"))
@@ -184,7 +187,7 @@ class TranslatorShell(object):
print(output)
-def heatclient(output, stack_name, params):
+def heatclient(output, stack_name, file_name, params):
try:
access_dict = utils.get_ks_access_dict()
endpoint = utils.get_url_for(access_dict, 'orchestration')
@@ -197,7 +200,7 @@ def heatclient(output, stack_name, params):
}
heat_stack_name = stack_name if stack_name else \
- "heat_" + str(uuid.uuid4()).split("-")[0]
+ "heat_" + file_name + '_' + str(uuid.uuid4()).split("-")[0]
output = yaml.load(output)
output['heat_template_version'] = str(output['heat_template_version'])
data = {
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 2103d43..f2d14ed 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
@@ -13,12 +13,29 @@ resources:
networks:
- port: { get_resource: CP1 }
user_data_format: SOFTWARE_CONFIG
+ depends_on:
+ - VDU2
+ VDU2:
+ type: OS::Nova::Server
+ properties:
+ flavor: m1.medium
+ image: rhel-6.5-test-image
+ networks:
+ - port: { get_resource: CP2 }
+ user_data_format: SOFTWARE_CONFIG
+
CP1:
type: OS::Neutron::Port
properties:
fixed_ips:
- ip_address: '192.168.0.55'
network: { get_resource: VL1 }
+ CP2:
+ type: OS::Neutron::Port
+ properties:
+ fixed_ips:
+ - ip_address: '192.168.0.56'
+ network: { get_resource: VL1 }
VL1:
type: OS::Neutron::Net
VL1_subnet:
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 1112234..538d63d 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
@@ -21,6 +21,26 @@ topology_template:
type: Linux
distribution: RHEL
version: 6.5
+ requirements:
+ - high_availability: VDU2
+
+ VDU2:
+ type: tosca.nodes.nfv.VDU
+ capabilities:
+ 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
+
CP1:
type: tosca.nodes.nfv.CP
properties:
@@ -33,6 +53,18 @@ topology_template:
node: VDU1
relationship: tosca.relationships.nfv.VirtualBindsTo
+ CP2:
+ type: tosca.nodes.nfv.CP
+ properties:
+ ip_address: 192.168.0.56
+ requirements:
+ - virtualLink:
+ node: VL1
+# relationship: tosca.relationships.nfv.VirtualLinksTo
+ - virtualBinding:
+ node: VDU2
+ relationship: tosca.relationships.nfv.VirtualBindsTo
+
VL1:
type: tosca.nodes.nfv.VL
properties:
diff --git a/tosca2heat/heat-translator/translator/tests/test_shell.py b/tosca2heat/heat-translator/translator/tests/test_shell.py
index 62f3510..5d41921 100644
--- a/tosca2heat/heat-translator/translator/tests/test_shell.py
+++ b/tosca2heat/heat-translator/translator/tests/test_shell.py
@@ -137,7 +137,7 @@ class ShellTest(TestCase):
'demo', 'http://www.abc.com']
try:
data = {
- 'stack_name': 'heat_abcXXX',
+ 'stack_name': 'heat_tosca_helloworld_abcXXX',
'parameters': {},
'template': {
'outputs': {},