Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
500b0688
Commit
500b0688
authored
Mar 26, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test upload file
parent
96924a93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
47 deletions
+66
-47
test_deployer.py
deployer/test/test_deployer.py
+30
-9
docker-compose.yml
docker-compose.yml
+20
-20
workspace.xml
sure_tosca-client_python_stubs/.idea/workspace.xml
+16
-18
No files found.
deployer/test/test_deployer.py
View file @
500b0688
...
@@ -10,6 +10,8 @@ import yaml
...
@@ -10,6 +10,8 @@ import yaml
import
unittest
import
unittest
import
sure_tosca_client
import
sure_tosca_client
from
sure_tosca_client
import
Configuration
,
ApiClient
from
sure_tosca_client.api
import
default_api
class
TestDeployer
(
unittest
.
TestCase
):
class
TestDeployer
(
unittest
.
TestCase
):
...
@@ -46,9 +48,10 @@ class TestDeployer(unittest.TestCase):
...
@@ -46,9 +48,10 @@ class TestDeployer(unittest.TestCase):
with
open
(
tosca_template_path
,
'w'
)
as
outfile
:
with
open
(
tosca_template_path
,
'w'
)
as
outfile
:
yaml
.
dump
(
tosca_template_dict
,
outfile
,
default_flow_style
=
False
)
yaml
.
dump
(
tosca_template_dict
,
outfile
,
default_flow_style
=
False
)
tosca_client
=
init_sure_tosca_client
(
'http://localhost:8081/tosca-sure/1.0.0/'
)
doc_id
=
tosca_client
.
upload_tosca_template
(
tosca_template_path
)
print
(
doc_id
)
tosca_client
=
self
.
init_sure_tosca_client
(
'http://localhost:8081/tosca-sure/1.0.0/'
)
self
.
upload_tosca_template
(
'application_example_provisioned.yaml'
,
tosca_client
)
# tosca_interfaces = tosca.get_interfaces(tosca_template_dict)
# tosca_interfaces = tosca.get_interfaces(tosca_template_dict)
# tmp_path = tempfile.mkdtemp()
# tmp_path = tempfile.mkdtemp()
...
@@ -85,12 +88,30 @@ class TestDeployer(unittest.TestCase):
...
@@ -85,12 +88,30 @@ class TestDeployer(unittest.TestCase):
# print(json.dumps(response))
# print(json.dumps(response))
def
init_sure_tosca_client
(
sure_tosca_base_path
):
def
upload_tosca_template
(
self
,
file_name
,
api
):
configuration
=
sure_tosca_client
.
Configuration
()
file
=
self
.
get_tosca_file
(
file_name
)
sure_tosca_client
.
configuration
.
host
=
sure_tosca_base_path
file_id
=
api
.
upload_tosca_template
(
file
)
api_client
=
sure_tosca_client
.
ApiClient
(
configuration
=
configuration
)
return
file_id
sure_tosca_client_api
=
sure_tosca_client
.
api
.
default_api
.
DefaultApi
(
api_client
=
api_client
)
# noqa: E501
return
sure_tosca_client_api
def
get_tosca_file
(
self
,
file_name
):
tosca_path
=
"../../TOSCA/"
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'
)
return
input_tosca_file_path
def
init_sure_tosca_client
(
self
,
sure_tosca_base_path
):
configuration
=
Configuration
()
configuration
.
host
=
"http://localhost:8081/tosca-sure/1.0.0/"
api_client
=
ApiClient
(
configuration
=
configuration
)
api
=
default_api
.
DefaultApi
(
api_client
=
api_client
)
# noqa: E501
return
api
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
docker-compose.yml
View file @
500b0688
...
@@ -59,18 +59,18 @@ services:
...
@@ -59,18 +59,18 @@ services:
-
"
27017:27017"
-
"
27017:27017"
manager
:
#
manager:
depends_on
:
#
depends_on:
-
rabbit
#
- rabbit
-
mongo
#
- mongo
-
sure-tosca
#
- sure-tosca
image
:
manager:3.0.0
#
image: manager:3.0.0
environment
:
#
environment:
RABBITMQ_HOST
:
rabbit
#
RABBITMQ_HOST: rabbit
MONGO_HOST
:
mongo
#
MONGO_HOST: mongo
SURE_TOSCA_BASE_PATH
:
http://sure-tosca:8081/tosca-sure/1.0.0
#
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
ports
:
#
ports:
-
"
30000:8080"
#
- "30000:8080"
sure-tosca
:
sure-tosca
:
image
:
sure-tosca:3.0.0
image
:
sure-tosca:3.0.0
...
@@ -85,14 +85,14 @@ services:
...
@@ -85,14 +85,14 @@ services:
environment
:
environment
:
RABBITMQ_HOST
:
rabbit
RABBITMQ_HOST
:
rabbit
provisioner
:
#
provisioner:
depends_on
:
#
depends_on:
-
rabbit
#
- rabbit
-
sure-tosca
#
- sure-tosca
image
:
provisioner:3.0.0
#
image: provisioner:3.0.0
environment
:
#
environment:
RABBITMQ_HOST
:
rabbit
#
RABBITMQ_HOST: rabbit
SURE_TOSCA_BASE_PATH
:
http://sure-tosca:8081/tosca-sure/1.0.0
#
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
#deployer:
#deployer:
#depends_on:
#depends_on:
...
...
sure_tosca-client_python_stubs/.idea/workspace.xml
View file @
500b0688
...
@@ -2,11 +2,9 @@
...
@@ -2,11 +2,9 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"3f84153d-6ed1-4691-94d6-53105266f15e"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"3f84153d-6ed1-4691-94d6-53105266f15e"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/../deployer/__main__.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../deployer/__main__.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../deployer/test/test_deployer.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../deployer/test/test_deployer.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../deployer/test/test_deployer.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../deployer/test/test_deployer.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../docker-compose.yml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../docker-compose.yml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../docker-compose.yml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../docker-compose.yml"
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$/setup.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/setup.py"
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"
/>
...
@@ -67,38 +65,38 @@
...
@@ -67,38 +65,38 @@
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
x=
"723"
y=
"257"
width=
"530"
height=
"598"
key=
"FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584814061190"
/>
<state
x=
"723"
y=
"257"
width=
"530"
height=
"598"
key=
"FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584814061190"
/>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1584902089025
"
>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1585226920216
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902089025
"
/>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1585226920216
"
/>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.center"
timestamp=
"1584902089024
"
>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.center"
timestamp=
"1585226920216
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902089024
"
/>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1585226920216
"
/>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.left"
timestamp=
"1584902089023
"
>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.left"
timestamp=
"1585226920215
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902089023
"
/>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1585226920215
"
/>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.right"
timestamp=
"1584902089024
"
>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.right"
timestamp=
"1585226920216
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"3
42"
key=
"GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902089024
"
/>
<state
width=
"1825"
height=
"3
36"
key=
"GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1585226920216
"
/>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1584902065994
"
>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1584952144349
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.bottom/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902065994
"
/>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.bottom/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584952144349
"
/>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.center"
timestamp=
"1584902065993
"
>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.center"
timestamp=
"1584952144349
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.center/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902065993
"
/>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.center/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584952144349
"
/>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.left"
timestamp=
"1584902065993
"
>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.left"
timestamp=
"1584952144348
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.left/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902065993
"
/>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.left/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584952144348
"
/>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.right"
timestamp=
"1584902065994
"
>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.right"
timestamp=
"1584952144349
"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
<state
width=
"1825"
height=
"
263"
key=
"GridCell.Tab.1.right/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584902065994
"
/>
<state
width=
"1825"
height=
"
336"
key=
"GridCell.Tab.1.right/67.34.1853.1046@67.34.1853.1046"
timestamp=
"1584952144349
"
/>
<state
x=
"359"
y=
"103"
key=
"SettingsEditor"
timestamp=
"1584813615342"
>
<state
x=
"359"
y=
"103"
key=
"SettingsEditor"
timestamp=
"1584813615342"
>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
<screen
x=
"67"
y=
"34"
width=
"1853"
height=
"1046"
/>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment