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
2ca3c322
Commit
2ca3c322
authored
Nov 08, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test
parent
4e631d0b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
42 deletions
+21
-42
workspace.xml
drip-planner/.idea/workspace.xml
+13
-8
__main__.py
drip-planner/__main__.py
+5
-17
simple_spec_alayzer.py
drip-planner/service/simple_spec_alayzer.py
+0
-1
test_planner.py
drip-planner/test/test_planner.py
+3
-16
No files found.
drip-planner/.idea/workspace.xml
View file @
2ca3c322
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"e478ccae-5352-4e8e-9efb-3f5cda44e877"
name=
"Default Changelist"
comment=
"
added matplotlib
"
>
<list
default=
"true"
id=
"e478ccae-5352-4e8e-9efb-3f5cda44e877"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/__main__.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/__main__.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/service/simple_spec_alayzer.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/service/simple_spec_alayzer.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/test/test_planner.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/test/test_planner.py"
afterDir=
"false"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
...
@@ -169,7 +171,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1573146945740
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"10"
/>
<task
id=
"LOCAL-00010"
summary=
"fixed default property setting"
>
<created>
1573214191545
</created>
<option
name=
"number"
value=
"00010"
/>
<option
name=
"presentableId"
value=
"LOCAL-00010"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1573214191545
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"11"
/>
<servers
/>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
...
...
@@ -194,7 +203,8 @@
<MESSAGE
value=
"added pyyaml"
/>
<MESSAGE
value=
"added tosca-parser"
/>
<MESSAGE
value=
"added matplotlib"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"added matplotlib"
/>
<MESSAGE
value=
"fixed default property setting"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"fixed default property setting"
/>
</component>
<component
name=
"XDebuggerManager"
>
<breakpoint-manager>
...
...
@@ -209,11 +219,6 @@
<line>
61
</line>
<option
name=
"timeStamp"
value=
"9"
/>
</line-breakpoint>
<line-breakpoint
enabled=
"true"
suspend=
"THREAD"
type=
"python-line"
>
<url>
file://$PROJECT_DIR$/__main__.py
</url>
<line>
124
</line>
<option
name=
"timeStamp"
value=
"10"
/>
</line-breakpoint>
<line-breakpoint
enabled=
"true"
suspend=
"THREAD"
type=
"python-line"
>
<url>
file://$PROJECT_DIR$/service/simple_spec_alayzer.py
</url>
<line>
25
</line>
...
...
drip-planner/__main__.py
View file @
2ca3c322
...
...
@@ -10,6 +10,7 @@ import logging
import
pika
import
yaml
import
sys
import
copy
from
toscaparser.tosca_template
import
ToscaTemplate
...
...
@@ -124,23 +125,10 @@ if __name__ == "__main__":
template_dict
=
tosca_helper
.
get_tosca_template_2_topology_template_dictionary
(
test_tosca_template
)
logger
.
info
(
"template ----:
\n
"
+
yaml
.
dump
(
template_dict
))
try
:
tosca_folder_path
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
tosca_path
)
except
NameError
:
import
sys
ToscaTemplate
(
yaml_dict_tpl
=
copy
.
deepcopy
(
template_dict
))
# tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(),
# tosca_path)
# tosca_file_name = 'tosca_template'
# input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml'
#
# with open(input_tosca_file_path, 'w') as outfile:
# outfile.write(yaml.dump(template_dict))
#
# ToscaTemplate(input_tosca_file_path)
#
# test_response = {'toscaTemplate': template_dict}
# logger.info("Output message:" + json.dumps(test_response))
test_response
=
{
'toscaTemplate'
:
template_dict
}
logger
.
info
(
"Output message:"
+
json
.
dumps
(
test_response
))
else
:
logger
.
info
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
channel
=
init_chanel
(
sys
.
argv
)
...
...
drip-planner/service/simple_spec_alayzer.py
View file @
2ca3c322
...
...
@@ -71,7 +71,6 @@ class SimpleAnalyzer(SpecificationAnalyzer):
new_vm
.
name
=
new_vm_name
templates
=
new_vm
.
templates
.
pop
(
old_vm_name
)
new_vm
.
templates
[
new_vm_name
]
=
templates
new_vm
.
templates
[
next
(
iter
(
new_vm
.
templates
))][
'properties'
][
'role'
]
=
"worker"
return_nodes
.
append
(
new_vm
)
for
requirement
in
topology_nodes
[
0
]
.
requirements
:
...
...
drip-planner/test/test_planner.py
View file @
2ca3c322
import
copy
import
json
import
logging
import
os
...
...
@@ -19,10 +20,9 @@ class MyTestCase(unittest.TestCase):
def
test_something
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
tosca_path
=
"../TOSCA/"
input_tosca_file_path
=
tosca_path
+
'/application_example_
2_topologies
.yaml'
input_tosca_file_path
=
tosca_path
+
'/application_example_
updated
.yaml'
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
print
(
dir_path
)
self
.
assertEqual
(
True
,
os
.
path
.
exists
(
input_tosca_file_path
),
"Input TOSCA file: "
+
input_tosca_file_path
+
" not found"
)
...
...
@@ -35,20 +35,7 @@ class MyTestCase(unittest.TestCase):
template_dict
=
tosca_helper
.
get_tosca_template_2_topology_template_dictionary
(
test_tosca_template
)
logger
.
info
(
"template ----:
\n
"
+
yaml
.
dump
(
template_dict
))
try
:
tosca_folder_path
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
tosca_path
)
except
NameError
:
import
sys
tosca_folder_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
sys
.
argv
[
0
]))
+
os
.
path
.
join
(
tempfile
.
gettempdir
(),
tosca_path
)
tosca_file_name
=
'tosca_template'
input_tosca_file_path
=
tosca_path
+
'/application_example_output.yaml'
with
open
(
input_tosca_file_path
,
'w'
)
as
outfile
:
outfile
.
write
(
yaml
.
dump
(
template_dict
))
ToscaTemplate
(
input_tosca_file_path
)
ToscaTemplate
(
yaml_dict_tpl
=
copy
.
deepcopy
(
template_dict
))
test_response
=
{
'toscaTemplate'
:
template_dict
}
...
...
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