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
9bbf46f7
Commit
9bbf46f7
authored
Mar 14, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
e56b5026
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
690 deletions
+0
-690
drip-deployer.tar.gz
drip-deployer.tar.gz
+0
-0
cluster_file
drip-deployer/cluster_file
+0
-2
drip-planner.tar.gz
drip-planner.tar.gz
+0
-0
input.json
drip-planner2provisioner/input.json
+0
-27
ICPCP.py
drip-simple_planner/ICPCP.py
+0
-391
NewInstance.py
drip-simple_planner/NewInstance.py
+0
-7
rpc_server.py
drip-simple_planner/rpc_server.py
+0
-131
server.py
drip-simple_planner/server.py
+0
-132
No files found.
drip-deployer.tar.gz
deleted
100644 → 0
View file @
e56b5026
File deleted
drip-deployer/cluster_file
deleted
100644 → 0
View file @
e56b5026
54.236.37.228 ubuntu /tmp/1 master
54.236.8.78 ubuntu /tmp/2 slave
drip-planner.tar.gz
deleted
100644 → 0
View file @
e56b5026
File deleted
drip-planner2provisioner/input.json
deleted
100644 → 0
View file @
e56b5026
{
"creationDate"
:
1488459287833
,
"parameters"
:
[
{
"url"
:
null
,
"attributes"
:
null
,
"value"
:
[
{
"name"
:
"2d13d708e3a9441ab8336ce874e08dd1"
,
"size"
:
"Small"
,
"docker"
:
"mogswitch/InputDistributor"
},
{
"name"
:
"8fcc1788d9ee462c826572c79fdb2a6a"
,
"size"
:
"Small"
,
"docker"
:
"mogswitch/InputDistributor"
},
{
"name"
:
"5e0add703c8a43938a39301f572e46c0"
,
"size"
:
"Small"
,
"docker"
:
"mogswitch/InputDistributor"
}
],
"encoding"
:
"UTF-8"
}
]
}
\ No newline at end of file
drip-simple_planner/ICPCP.py
deleted
100644 → 0
View file @
e56b5026
This diff is collapsed.
Click to expand it.
drip-simple_planner/NewInstance.py
deleted
100644 → 0
View file @
e56b5026
class
NewInstance
(
object
):
def
__init__
(
self
,
vm_type
,
vm_start
,
vm_end
,
pcp
):
self
.
vm_type
=
vm_type
self
.
vm_start
=
vm_start
self
.
vm_end
=
vm_end
self
.
task_list
=
pcp
self
.
cost
=
0
\ No newline at end of file
drip-simple_planner/rpc_server.py
deleted
100644 → 0
View file @
e56b5026
#!/usr/bin/env python
import
pika
import
networkx
as
nx
import
sys
import
numpy
as
np
import
sys
,
argparse
import
operator
import
os
from
toscaparser
import
*
from
toscaparser.tosca_template
import
ToscaTemplate
import
re
import
getopt
from
ICPCP
import
Workflow
import
random
import
time
import
json
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
'172.17.0.2'
))
channel
=
connection
.
channel
()
channel
.
queue_declare
(
queue
=
'planner_queue'
)
def
handleDelivery
(
message
):
parsed_json
=
json
.
loads
(
message
)
params
=
parsed_json
[
"parameters"
]
for
param
in
params
:
name
=
param
[
"name"
]
value
=
param
[
"value"
]
def
on_request
(
ch
,
method
,
props
,
body
):
handleDelivery
(
body
)
print
(
" Message
%
s"
%
body
)
response
=
"AAAAAAAAAAAAAAAAAAAAAA"
json1
=
response
.
get
(
'parameters'
)[
0
]
.
get
(
'value'
)
.
get
(
'topology_template'
)
.
get
(
'node_templates'
)
deadline
=
0
for
j
in
json1
:
#print json[j]
if
not
json1
[
j
][
'type'
]
==
"Switch.nodes.Application.Connection"
:
deadline
=
int
(
re
.
search
(
r'\d+'
,
json1
[
j
][
'properties'
][
'QoS'
][
'response_time'
])
.
group
())
#get the nodes from the json
nodeDic
=
{}
nodeDic1
=
{}
i
=
1
for
j
in
json1
:
if
not
json1
[
j
][
'type'
]
==
"Switch.nodes.Application.Connection"
:
print
j
,
json1
[
j
]
nodeDic
[
j
]
=
i
nodeDic1
[
i
]
=
j
i
=
i
+
1
#get the links from the json
links
=
[]
for
j
in
json1
:
if
json1
[
j
][
'type'
]
==
"Switch.nodes.Application.Connection"
:
print
json1
[
j
][
'properties'
][
'source'
][
'component_name'
]
print
json1
[
j
][
'properties'
][
'target'
][
'component_name'
]
link
=
{}
link
[
'source'
]
=
nodeDic
[
json1
[
j
][
'properties'
][
'source'
][
'component_name'
]]
link
[
'target'
]
=
nodeDic
[
json1
[
j
][
'properties'
][
'target'
][
'component_name'
]]
link
[
'weight'
]
=
random
.
randint
(
1
,
10
)
links
.
append
(
link
)
# compose the json as input of the workflow
wfJson
=
{}
wfJson
[
'workflow'
]
=
{}
nodesList
=
[]
sorted_nodeDic
=
sorted
(
nodeDic
.
items
(),
key
=
operator
.
itemgetter
(
1
))
for
key
,
value
in
sorted_nodeDic
:
v
=
{}
v
[
'name'
]
=
value
nodesList
.
append
(
v
)
wfJson
[
'workflow'
][
'nodes'
]
=
nodesList
wfJson
[
'workflow'
][
'links'
]
=
links
#print deadline
wfJson
[
'price'
]
=
"5,2,1"
wfJson
[
'deadline'
]
=
{
'2'
:
deadline
}
#generate performance
performance
=
{}
for
key
,
value
in
sorted_nodeDic
:
performance
[
str
(
value
)]
=
"1,2,3"
wfJson
[
'performance'
]
=
performance
print
wfJson
#send request to the server
start
=
time
.
time
()
wf
=
Workflow
()
wf
.
init
(
wfJson
)
wf
.
ic_pcp
()
#print content['workflow']
#return
res
=
wf
.
generateJSON
()
end
=
time
.
time
()
print
(
end
-
start
)
# generate the json files in the corresponding format as the
outcontent
=
{}
outcontent
[
"creationDate"
]
=
1487002029722
outcontent
[
"parameters"
]
=
[]
par1
=
{}
par1
[
"url"
]
=
"null"
par1
[
"encoding"
]
=
"UTF-8"
par1
[
"value"
]
=
res
par1
[
"attributes"
]
=
"null"
outcontent
[
"parameters"
]
.
append
(
par1
)
response
=
outcontent
ch
.
basic_publish
(
exchange
=
''
,
routing_key
=
props
.
reply_to
,
properties
=
pika
.
BasicProperties
(
correlation_id
=
\
props
.
correlation_id
),
body
=
str
(
response
))
ch
.
basic_ack
(
delivery_tag
=
method
.
delivery_tag
)
channel
.
basic_qos
(
prefetch_count
=
1
)
channel
.
basic_consume
(
on_request
,
queue
=
'planner_queue'
)
print
(
" [x] Awaiting RPC requests"
)
channel
.
start_consuming
()
\ No newline at end of file
drip-simple_planner/server.py
deleted
100644 → 0
View file @
e56b5026
#https://github.com/skoulouzis/DRIP/blob/package/doc/json_samples/kbExampleMessage.json
import
networkx
as
nx
import
sys
import
numpy
as
np
import
sys
,
argparse
import
operator
import
os
from
toscaparser
import
*
from
toscaparser.tosca_template
import
ToscaTemplate
import
re
import
getopt
from
ICPCP
import
Workflow
import
random
import
time
import
json
def
main
(
argv
):
workflow_file
=
""
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
"hw:s:"
,[
"workflow="
,
"SDI="
])
except
getopt
.
GetoptError
:
print
'server.py -w <workflowfile> -s <SDI>'
sys
.
exit
(
2
)
for
opt
,
arg
in
opts
:
if
opt
==
'-h'
:
print
'server.py -w <workflowfile> -s <SDI>'
sys
.
exit
()
elif
opt
in
(
"-w"
,
"--workflow"
):
workflow_file
=
arg
elif
opt
in
(
"-s"
,
"--SDI"
):
SDI_file
=
arg
data
=
{}
print
workflow_file
with
open
(
workflow_file
)
as
data_file
:
data
=
json
.
load
(
data_file
)
#print data
#path = "input.yaml"
'''
a_file = os.path.isfile(path)
tosca = ToscaTemplate(path)
#print tosca.tpl
json = tosca.tpl.get('topology_template').get('node_templates')
#print json
'''
json1
=
data
.
get
(
'parameters'
)[
0
]
.
get
(
'value'
)
.
get
(
'topology_template'
)
.
get
(
'node_templates'
)
deadline
=
0
for
j
in
json1
:
#print json[j]
if
not
json1
[
j
][
'type'
]
==
"Switch.nodes.Application.Connection"
:
deadline
=
int
(
re
.
search
(
r'\d+'
,
json1
[
j
][
'properties'
][
'QoS'
][
'response_time'
])
.
group
())
#get the nodes from the json
nodeDic
=
{}
nodeDic1
=
{}
i
=
1
for
j
in
json1
:
if
not
json1
[
j
][
'type'
]
==
"Switch.nodes.Application.Connection"
:
print
j
,
json1
[
j
]
nodeDic
[
j
]
=
i
nodeDic1
[
i
]
=
j
i
=
i
+
1
#get the links from the json
links
=
[]
for
j
in
json1
:
if
json1
[
j
][
'type'
]
==
"Switch.nodes.Application.Connection"
:
print
json1
[
j
][
'properties'
][
'source'
][
'component_name'
]
print
json1
[
j
][
'properties'
][
'target'
][
'component_name'
]
link
=
{}
link
[
'source'
]
=
nodeDic
[
json1
[
j
][
'properties'
][
'source'
][
'component_name'
]]
link
[
'target'
]
=
nodeDic
[
json1
[
j
][
'properties'
][
'target'
][
'component_name'
]]
link
[
'weight'
]
=
random
.
randint
(
1
,
10
)
links
.
append
(
link
)
# compose the json as input of the workflow
wfJson
=
{}
wfJson
[
'workflow'
]
=
{}
nodesList
=
[]
sorted_nodeDic
=
sorted
(
nodeDic
.
items
(),
key
=
operator
.
itemgetter
(
1
))
for
key
,
value
in
sorted_nodeDic
:
v
=
{}
v
[
'name'
]
=
value
nodesList
.
append
(
v
)
wfJson
[
'workflow'
][
'nodes'
]
=
nodesList
wfJson
[
'workflow'
][
'links'
]
=
links
#print deadline
wfJson
[
'price'
]
=
"5,2,1"
wfJson
[
'deadline'
]
=
{
'2'
:
deadline
}
#generate performance
performance
=
{}
for
key
,
value
in
sorted_nodeDic
:
performance
[
str
(
value
)]
=
"1,2,3"
wfJson
[
'performance'
]
=
performance
print
wfJson
#send request to the server
start
=
time
.
time
()
wf
=
Workflow
()
wf
.
init
(
wfJson
)
wf
.
ic_pcp
()
#print content['workflow']
#return
res
=
wf
.
generateJSON
()
end
=
time
.
time
()
print
(
end
-
start
)
# generate the json files in the corresponding format as the
outcontent
=
{}
outcontent
[
"creationDate"
]
=
1487002029722
outcontent
[
"parameters"
]
=
[]
par1
=
{}
par1
[
"url"
]
=
"null"
par1
[
"encoding"
]
=
"UTF-8"
par1
[
"value"
]
=
res
par1
[
"attributes"
]
=
"null"
outcontent
[
"parameters"
]
.
append
(
par1
)
return
outcontent
if
__name__
==
'__main__'
:
main
(
sys
.
argv
[
1
:])
\ No newline at end of file
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