Commit 5c85c1d6 authored by Spiros Koulouzis's avatar Spiros Koulouzis

changed defaults

parent d66cbacd
...@@ -15,24 +15,24 @@ description: > ...@@ -15,24 +15,24 @@ description: >
topology_template: topology_template:
node_templates: node_templates:
mongo: mysql:
type: tosca.nodes.ARTICONF.Container.Application.Docker type: tosca.nodes.ARTICONF.Container.Application.Docker
properties: properties:
ports: ports:
- "27017:27017" - "3306:3306"
volumes: volumes:
- db_data:/var/lib/mongo - db_data:/var/lib/mysql
environment: environment:
MONGO_INITDB_ROOT_PASSWORD: rootPassword MYSQL_ROOT_PASSWORD: somewordpress
MONGO_INITDB_DATABASE: databaseName MYSQL_DATABASE: wordpress
MONGO_INITDB_ROOT_USERNAME: rootUser MYSQL_USER: wordpress
MONGO_USERNAME: databaseUser MYSQL_PASSWORD: wordpress
MONGO_PASSWORD: password
artifacts: artifacts:
image: image:
type: tosca.artifacts.Deployment.Image.Container.Docker type: tosca.artifacts.Deployment.Image.Container.Docker
file: lakshminp/mongo:4.2.1 file: mysql:5.7
repository: docker_hub repository: docker_hub
...@@ -55,20 +55,12 @@ topology_template: ...@@ -55,20 +55,12 @@ topology_template:
policies: policies:
- scalability: - scalability:
type: tosca.policies.ARTICONF.Performance.CPU type: tosca.policies.ARTICONF.Performance.CPU
targets: [ mongo ] targets: [ mysql ]
properties: properties:
constraint_name: cpu_load constraint_name: cpu_load
max_value: 90 max_value: 90
- faultTolerance: - faultTolerance:
type: tosca.policies.ARTICONF.FaultTolerance type: tosca.policies.ARTICONF.FaultTolerance
targets: [ mongo ] targets: [ mysql ]
properties: properties:
level: 1 level: 1
...@@ -112,12 +112,12 @@ node_types: ...@@ -112,12 +112,12 @@ node_types:
domain: domain:
type: string type: string
required: true required: true
default: "UvA (Amsterdam, The Netherlands) XO Rack" default: "Frankfurt"
description: the domain of this topology e.g. California, UvA (Amsterdam, The Netherlands) XO Rack, Frankfurt, etc description: the domain of this topology e.g. California, UvA (Amsterdam, The Netherlands) XO Rack, Frankfurt, etc
provider: provider:
type: string type: string
required: true required: true
default: "ExoGENI" default: "EC2"
description: The name of the provider e.g. EC2, ExoGENI etc. description: The name of the provider e.g. EC2, ExoGENI etc.
coordinates: coordinates:
type: tosca.datatypes.ARTICONF.coordinates type: tosca.datatypes.ARTICONF.coordinates
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
become: yes become: yes
tasks: tasks:
#- name: replace DNS - name: replace DNS
#shell: sed -i "s/nameserver.*/nameserver 8.8.8.8/g" shell: sed -i "s/nameserver.*/nameserver 8.8.8.8/g" /etc/resolv.conf
- name: Replace a localhost entry with our own #- name: replace DNS
lineinfile: #lineinfile:
path: /etc/resolv.conf #path: /etc/resolv.conf
regexp: 'nameserver.*' #regexp: 'nameserver.*'
line: nameserver 8.8.8.8 #line: nameserver 8.8.8.8
- name: Update and upgrade apt packages - name: Update and upgrade apt packages
become: true become: true
......
...@@ -4,13 +4,9 @@ ...@@ -4,13 +4,9 @@
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment=""> <list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/__init__.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/requirements.txt" beforeDir="false" afterPath="$PROJECT_DIR$/requirements.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/node_template.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/node_template.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/topology_template.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/topology_template.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/tosca_template.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/models/tosca_template.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/test/test_default_controller.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/test/test_default_controller.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/test/test_default_controller.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/sure_tosca/test/test_default_controller.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../sure_tosca-flask-server/test-requirements.txt" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/test-requirements.txt" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -277,26 +273,26 @@ ...@@ -277,26 +273,26 @@
</state> </state>
<state x="792" y="334" width="827" height="663" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1578326180157" /> <state x="792" y="334" width="827" height="663" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1578326180157" />
<state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl/67.34.2493.1406@67.34.2493.1406" timestamp="1575907769017" /> <state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl/67.34.2493.1406@67.34.2493.1406" timestamp="1575907769017" />
<state width="2465" height="491" key="GridCell.Tab.0.bottom" timestamp="1580081355073"> <state width="2465" height="341" key="GridCell.Tab.0.bottom" timestamp="1580135261557">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state width="1825" height="454" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653154" /> <state width="1825" height="341" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646320" />
<state width="2465" height="491" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355073" /> <state width="2465" height="341" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1580135261557" />
<state width="2465" height="491" key="GridCell.Tab.0.center" timestamp="1580081355070"> <state width="2465" height="341" key="GridCell.Tab.0.center" timestamp="1580135261557">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state width="1825" height="454" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653153" /> <state width="1825" height="341" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646318" />
<state width="2465" height="491" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355070" /> <state width="2465" height="341" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1580135261557" />
<state width="2465" height="491" key="GridCell.Tab.0.left" timestamp="1580081355068"> <state width="2465" height="341" key="GridCell.Tab.0.left" timestamp="1580135261556">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state width="1825" height="454" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653152" /> <state width="1825" height="341" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646317" />
<state width="2465" height="491" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355068" /> <state width="2465" height="341" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1580135261556" />
<state width="2465" height="491" key="GridCell.Tab.0.right" timestamp="1580081355072"> <state width="2465" height="341" key="GridCell.Tab.0.right" timestamp="1580135261557">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state width="1825" height="454" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653154" /> <state width="1825" height="341" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646319" />
<state width="2465" height="491" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355072" /> <state width="2465" height="341" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1580135261557" />
<state width="2465" height="407" key="GridCell.Tab.1.bottom" timestamp="1580077545495"> <state width="2465" height="407" key="GridCell.Tab.1.bottom" timestamp="1580077545495">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
...@@ -317,10 +313,10 @@ ...@@ -317,10 +313,10 @@
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
</state> </state>
<state x="679" y="283" key="SettingsEditor/67.34.2493.1406@67.34.2493.1406" timestamp="1580078850367" /> <state x="679" y="283" key="SettingsEditor/67.34.2493.1406@67.34.2493.1406" timestamp="1580078850367" />
<state x="893" y="526" key="com.intellij.ide.util.TipDialog" timestamp="1580077838363"> <state x="669" y="394" key="com.intellij.ide.util.TipDialog" timestamp="1580127405434">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state x="681" y="400" key="com.intellij.ide.util.TipDialog/67.34.1853.1046@67.34.1853.1046" timestamp="1579175096269" /> <state x="669" y="394" key="com.intellij.ide.util.TipDialog/67.34.1853.1046@67.34.1853.1046" timestamp="1580127405434" />
<state x="893" y="526" key="com.intellij.ide.util.TipDialog/67.34.2493.1406@67.34.2493.1406" timestamp="1580077838363" /> <state x="893" y="526" key="com.intellij.ide.util.TipDialog/67.34.2493.1406@67.34.2493.1406" timestamp="1580077838363" />
<state x="882" y="239" width="862" height="993" key="find.popup" timestamp="1576090708880"> <state x="882" y="239" width="862" height="993" key="find.popup" timestamp="1576090708880">
<screen x="67" y="34" width="2493" height="1406" /> <screen x="67" y="34" width="2493" height="1406" />
......
...@@ -2,6 +2,6 @@ wheel==0.33.6 ...@@ -2,6 +2,6 @@ wheel==0.33.6
pika==1.1.0 pika==1.1.0
names==0.3.0 names==0.3.0
networkx==2.4 networkx==2.4
pyyaml==5.1.2 pyyaml==5.3
tosca-parser ==1.6.1 tosca-parser ==1.7.0
matplotlib==3.0.3 matplotlib==3.1.2
\ No newline at end of file \ No newline at end of file
...@@ -41,7 +41,6 @@ h.setFormatter(formatter) ...@@ -41,7 +41,6 @@ h.setFormatter(formatter)
logger.addHandler(h) logger.addHandler(h)
logger.handler_set = True logger.handler_set = True
root_key = 'root_key' root_key = 'root_key'
......
...@@ -20,7 +20,7 @@ class TestDefaultController(BaseTestCase): ...@@ -20,7 +20,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_properties'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_properties'.format(
...@@ -35,7 +35,7 @@ class TestDefaultController(BaseTestCase): ...@@ -35,7 +35,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_types'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_types'.format(
id=id_example, node_name='compute'), id=id_example, node_name='compute'),
...@@ -49,7 +49,7 @@ class TestDefaultController(BaseTestCase): ...@@ -49,7 +49,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_requirements'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_requirements'.format(
...@@ -65,7 +65,7 @@ class TestDefaultController(BaseTestCase): ...@@ -65,7 +65,7 @@ class TestDefaultController(BaseTestCase):
""" """
# query_string = [('anchors', 'anchors_example'), ('derived_from', 'derived_from_example')] # query_string = [('anchors', 'anchors_example'), ('derived_from', 'derived_from_example')]
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/dsl_definitions'.format(id=id_example), '/tosca-sure/1.0.0/tosca_template/{id}/dsl_definitions'.format(id=id_example),
method='GET') method='GET')
...@@ -76,7 +76,7 @@ class TestDefaultController(BaseTestCase): ...@@ -76,7 +76,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/imports'.format(id=id_example), '/tosca-sure/1.0.0/tosca_template/{id}/imports'.format(id=id_example),
method='GET') method='GET')
...@@ -87,7 +87,7 @@ class TestDefaultController(BaseTestCase): ...@@ -87,7 +87,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/outputs'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/outputs'.format(
id=id_example, node_name='compute'), id=id_example, node_name='compute'),
...@@ -101,7 +101,7 @@ class TestDefaultController(BaseTestCase): ...@@ -101,7 +101,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format(
id=id_example, node_name='compute'), id=id_example, node_name='compute'),
...@@ -115,7 +115,7 @@ class TestDefaultController(BaseTestCase): ...@@ -115,7 +115,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/requirements'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/requirements'.format(
id=id_example, node_name='kubernetes'), id=id_example, node_name='kubernetes'),
...@@ -129,7 +129,7 @@ class TestDefaultController(BaseTestCase): ...@@ -129,7 +129,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
query_string = [('type_name', None), query_string = [('type_name', None),
('node_name', 'compute'), ('node_name', 'compute'),
('has_interfaces', True), ('has_interfaces', True),
...@@ -183,7 +183,7 @@ class TestDefaultController(BaseTestCase): ...@@ -183,7 +183,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/type_name'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/type_name'.format(
id=id_example, node_name='compute'), id=id_example, node_name='compute'),
...@@ -197,7 +197,7 @@ class TestDefaultController(BaseTestCase): ...@@ -197,7 +197,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from'.format(
id=id_example, node_name='kubernetes'), id=id_example, node_name='kubernetes'),
...@@ -211,7 +211,7 @@ class TestDefaultController(BaseTestCase): ...@@ -211,7 +211,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/related'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/related'.format(
id=id_example, node_name='mysql'), id=id_example, node_name='mysql'),
...@@ -225,7 +225,7 @@ class TestDefaultController(BaseTestCase): ...@@ -225,7 +225,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
query_string = [('type_name', None), query_string = [('type_name', None),
('derived_from', None)] ('derived_from', None)]
response = self.client.open( response = self.client.open(
...@@ -239,7 +239,7 @@ class TestDefaultController(BaseTestCase): ...@@ -239,7 +239,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template'.format(id=id_example), '/tosca-sure/1.0.0/tosca_template/{id}/topology_template'.format(id=id_example),
method='GET') method='GET')
...@@ -252,7 +252,7 @@ class TestDefaultController(BaseTestCase): ...@@ -252,7 +252,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}'.format(id=id_example), '/tosca-sure/1.0.0/tosca_template/{id}'.format(id=id_example),
method='GET') method='GET')
...@@ -265,7 +265,7 @@ class TestDefaultController(BaseTestCase): ...@@ -265,7 +265,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
query_string = [('kind_of_type', 'interface_types'), query_string = [('kind_of_type', 'interface_types'),
('has_interfaces', None), ('has_interfaces', None),
('type_name', 'tosca.interfaces.ARTICONF.CloudsStorm'), ('type_name', 'tosca.interfaces.ARTICONF.CloudsStorm'),
...@@ -304,7 +304,7 @@ class TestDefaultController(BaseTestCase): ...@@ -304,7 +304,7 @@ class TestDefaultController(BaseTestCase):
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
properties = {'properties': {'cpu_frequency': '2 GHz'}} properties = {'properties': {'cpu_frequency': '2 GHz'}}
response = self.client.open( response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format( '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format(
...@@ -316,9 +316,9 @@ class TestDefaultController(BaseTestCase): ...@@ -316,9 +316,9 @@ class TestDefaultController(BaseTestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json, list) self.assertIsInstance(response.json, list)
def upload_file(self): def upload_2_topologies_file(self):
tosca_path = "../../../TOSCA/" tosca_path = "../../../TOSCA/"
file_name = 'application_example_2_topologies.yaml' #'application_example_updated.yaml' # 'application_example_2_topologies.yaml' file_name = 'application_example_2_topologies.yaml' # 'application_example_updated.yaml' # 'application_example_2_topologies.yaml'
input_tosca_file_path = tosca_path + '/' + file_name input_tosca_file_path = tosca_path + '/' + file_name
if not os.path.exists(input_tosca_file_path): if not os.path.exists(input_tosca_file_path):
tosca_path = "../TOSCA/" tosca_path = "../TOSCA/"
...@@ -340,12 +340,52 @@ class TestDefaultController(BaseTestCase): ...@@ -340,12 +340,52 @@ class TestDefaultController(BaseTestCase):
file_id = response.data.decode('utf-8').replace('\n', '') file_id = response.data.decode('utf-8').replace('\n', '')
return file_id return file_id
def upload_application_example_file(self):
tosca_path = "../../../TOSCA/"
file_name = 'application_example_updated.yaml' # 'application_example_updated.yaml' # 'application_example_2_topologies.yaml'
input_tosca_file_path = tosca_path + '/' + file_name
if not os.path.exists(input_tosca_file_path):
tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + '/' + file_name
dir_path = os.path.dirname(os.path.realpath(__file__))
self.assertEqual(True, os.path.exists(input_tosca_file_path),
'Starting from: ' + dir_path + ' Input TOSCA file: ' + input_tosca_file_path + ' not found')
with open(input_tosca_file_path, 'r') as file:
contents = file.read()
byte_contents = bytes(contents, 'utf8')
data = dict(file=(BytesIO(byte_contents), input_tosca_file_path))
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template',
method='POST',
data=data,
content_type='multipart/form-data')
file_id = response.data.decode('utf-8').replace('\n', '')
return file_id
def test_get_node_templates2(self):
"""Test case for get_node_templates
"""
id_example = self.upload_application_example_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates'.format(id=id_example),
method='GET',
query_string=None)
self.assertTrue(response.is_json)
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json, list)
self.assertTrue(response.json)
def test_get_default_interface(self): def test_get_default_interface(self):
"""Test case for get_default_interface """Test case for get_default_interface
""" """
id_example = self.upload_file() id_example = self.upload_2_topologies_file()
query_string = [('instance_name', 'instance_name_example'), query_string = [('instance_name', 'instance_name_example'),
('operation_name', 'provision')] ('operation_name', 'provision')]
response = self.client.open( response = self.client.open(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment