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

changed defaults

parent d66cbacd
......@@ -15,25 +15,25 @@ description: >
topology_template:
node_templates:
mongo:
mysql:
type: tosca.nodes.ARTICONF.Container.Application.Docker
properties:
ports:
- "27017:27017"
- "3306:3306"
volumes:
- db_data:/var/lib/mongo
- db_data:/var/lib/mysql
environment:
MONGO_INITDB_ROOT_PASSWORD: rootPassword
MONGO_INITDB_DATABASE: databaseName
MONGO_INITDB_ROOT_USERNAME: rootUser
MONGO_USERNAME: databaseUser
MONGO_PASSWORD: password
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
artifacts:
image:
type: tosca.artifacts.Deployment.Image.Container.Docker
file: lakshminp/mongo:4.2.1
repository: docker_hub
file: mysql:5.7
repository: docker_hub
logspout:
......@@ -55,20 +55,12 @@ topology_template:
policies:
- scalability:
type: tosca.policies.ARTICONF.Performance.CPU
targets: [ mongo ]
targets: [ mysql ]
properties:
constraint_name: cpu_load
max_value: 90
- faultTolerance:
type: tosca.policies.ARTICONF.FaultTolerance
targets: [ mongo ]
targets: [ mysql ]
properties:
level: 1
......@@ -112,12 +112,12 @@ node_types:
domain:
type: string
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
provider:
type: string
required: true
default: "ExoGENI"
default: "EC2"
description: The name of the provider e.g. EC2, ExoGENI etc.
coordinates:
type: tosca.datatypes.ARTICONF.coordinates
......
......@@ -2,14 +2,14 @@
become: yes
tasks:
#- name: replace DNS
#shell: sed -i "s/nameserver.*/nameserver 8.8.8.8/g"
- name: replace DNS
shell: sed -i "s/nameserver.*/nameserver 8.8.8.8/g" /etc/resolv.conf
- name: Replace a localhost entry with our own
lineinfile:
path: /etc/resolv.conf
regexp: 'nameserver.*'
line: nameserver 8.8.8.8
#- name: replace DNS
#lineinfile:
#path: /etc/resolv.conf
#regexp: 'nameserver.*'
#line: nameserver 8.8.8.8
- name: Update and upgrade apt packages
become: true
......
......@@ -4,13 +4,9 @@
<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$/.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$/../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$/requirements.txt" beforeDir="false" afterPath="$PROJECT_DIR$/requirements.txt" 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/test-requirements.txt" beforeDir="false" afterPath="$PROJECT_DIR$/../sure_tosca-flask-server/test-requirements.txt" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -277,26 +273,26 @@
</state>
<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 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" />
</state>
<state width="1825" height="454" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653154" />
<state width="2465" height="491" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355073" />
<state width="2465" height="491" key="GridCell.Tab.0.center" timestamp="1580081355070">
<state width="1825" height="341" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646320" />
<state width="2465" height="341" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1580135261557" />
<state width="2465" height="341" key="GridCell.Tab.0.center" timestamp="1580135261557">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="1825" height="454" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653153" />
<state width="2465" height="491" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355070" />
<state width="2465" height="491" key="GridCell.Tab.0.left" timestamp="1580081355068">
<state width="1825" height="341" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646318" />
<state width="2465" height="341" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1580135261557" />
<state width="2465" height="341" key="GridCell.Tab.0.left" timestamp="1580135261556">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="1825" height="454" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653152" />
<state width="2465" height="491" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355068" />
<state width="2465" height="491" key="GridCell.Tab.0.right" timestamp="1580081355072">
<state width="1825" height="341" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646317" />
<state width="2465" height="341" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1580135261556" />
<state width="2465" height="341" key="GridCell.Tab.0.right" timestamp="1580135261557">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="1825" height="454" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1579191653154" />
<state width="2465" height="491" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1580081355072" />
<state width="1825" height="341" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1580127646319" />
<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">
<screen x="67" y="34" width="2493" height="1406" />
</state>
......@@ -317,10 +313,10 @@
<screen x="67" y="34" width="2493" height="1406" />
</state>
<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">
<screen x="67" y="34" width="2493" height="1406" />
<state x="669" y="394" key="com.intellij.ide.util.TipDialog" timestamp="1580127405434">
<screen x="67" y="34" width="1853" height="1046" />
</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="882" y="239" width="862" height="993" key="find.popup" timestamp="1576090708880">
<screen x="67" y="34" width="2493" height="1406" />
......
......@@ -2,6 +2,6 @@ wheel==0.33.6
pika==1.1.0
names==0.3.0
networkx==2.4
pyyaml==5.1.2
tosca-parser ==1.6.1
matplotlib==3.0.3
\ No newline at end of file
pyyaml==5.3
tosca-parser ==1.7.0
matplotlib==3.1.2
\ No newline at end of file
......@@ -41,7 +41,6 @@ h.setFormatter(formatter)
logger.addHandler(h)
logger.handler_set = True
root_key = 'root_key'
......@@ -101,7 +100,7 @@ def save(file):
# try:
# tosca_template_file_path = os.path.join(db_dir_path, file.filename)
start = time.time()
logger.info("Got request for tosca template")
purge_all_tables()
dictionary = yaml.safe_load(file.stream)
......
......@@ -20,7 +20,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_properties'.format(
......@@ -35,7 +35,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_types'.format(
id=id_example, node_name='compute'),
......@@ -49,7 +49,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_requirements'.format(
......@@ -65,7 +65,7 @@ class TestDefaultController(BaseTestCase):
"""
# 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(
'/tosca-sure/1.0.0/tosca_template/{id}/dsl_definitions'.format(id=id_example),
method='GET')
......@@ -76,7 +76,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/imports'.format(id=id_example),
method='GET')
......@@ -87,7 +87,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/outputs'.format(
id=id_example, node_name='compute'),
......@@ -101,7 +101,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format(
id=id_example, node_name='compute'),
......@@ -115,7 +115,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/requirements'.format(
id=id_example, node_name='kubernetes'),
......@@ -129,7 +129,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
query_string = [('type_name', None),
('node_name', 'compute'),
('has_interfaces', True),
......@@ -183,7 +183,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/type_name'.format(
id=id_example, node_name='compute'),
......@@ -197,7 +197,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from'.format(
id=id_example, node_name='kubernetes'),
......@@ -211,7 +211,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/related'.format(
id=id_example, node_name='mysql'),
......@@ -225,7 +225,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
query_string = [('type_name', None),
('derived_from', None)]
response = self.client.open(
......@@ -239,7 +239,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template'.format(id=id_example),
method='GET')
......@@ -252,7 +252,7 @@ class TestDefaultController(BaseTestCase):
"""
id_example = self.upload_file()
id_example = self.upload_2_topologies_file()
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}'.format(id=id_example),
method='GET')
......@@ -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'),
('has_interfaces', None),
('type_name', 'tosca.interfaces.ARTICONF.CloudsStorm'),
......@@ -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'}}
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format(
......@@ -316,9 +316,9 @@ class TestDefaultController(BaseTestCase):
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json, list)
def upload_file(self):
def upload_2_topologies_file(self):
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
if not os.path.exists(input_tosca_file_path):
tosca_path = "../TOSCA/"
......@@ -340,12 +340,52 @@ class TestDefaultController(BaseTestCase):
file_id = response.data.decode('utf-8').replace('\n', '')
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):
"""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'),
('operation_name', 'provision')]
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