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
93f050a4
Commit
93f050a4
authored
Mar 02, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parse input message correctly
parent
86b8f9db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
21 deletions
+20
-21
PlannerController.java
...main/java/nl/uva/sne/drip/api/rest/PlannerController.java
+2
-5
PlannerService.java
...main/java/nl/uva/sne/drip/api/service/PlannerService.java
+2
-1
ICPCP.pyc
drip-planner/ICPCP.pyc
+0
-0
NewInstance.pyc
drip-planner/NewInstance.pyc
+0
-0
rpc_server.py
drip-planner/rpc_server.py
+16
-15
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/rest/PlannerController.java
View file @
93f050a4
...
@@ -47,9 +47,6 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -47,9 +47,6 @@ import org.springframework.web.bind.annotation.RequestParam;
@Component
@Component
public
class
PlannerController
{
public
class
PlannerController
{
@Autowired
private
ToscaService
toscaService
;
@Autowired
@Autowired
private
SimplePlannerService
simplePlannerService
;
private
SimplePlannerService
simplePlannerService
;
...
@@ -62,8 +59,8 @@ public class PlannerController {
...
@@ -62,8 +59,8 @@ public class PlannerController {
String
plan
(
@PathVariable
(
"tosca_id"
)
String
toscaId
)
{
String
plan
(
@PathVariable
(
"tosca_id"
)
String
toscaId
)
{
try
{
try
{
Plan
plan
=
simplePlannerService
.
getPlan
(
toscaId
);
//
Plan plan = simplePlannerService.getPlan(toscaId);
//
Plan plan = plannerService.getPlan(toscaId);
Plan
plan
=
plannerService
.
getPlan
(
toscaId
);
if
(
plan
==
null
)
{
if
(
plan
==
null
)
{
throw
new
NotFoundException
(
"Could not make plan"
);
throw
new
NotFoundException
(
"Could not make plan"
);
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/PlannerService.java
View file @
93f050a4
...
@@ -25,6 +25,7 @@ import nl.uva.sne.drip.api.exception.BadRequestException;
...
@@ -25,6 +25,7 @@ import nl.uva.sne.drip.api.exception.BadRequestException;
import
nl.uva.sne.drip.api.rpc.PlannerCaller
;
import
nl.uva.sne.drip.api.rpc.PlannerCaller
;
import
nl.uva.sne.drip.commons.types.Message
;
import
nl.uva.sne.drip.commons.types.Message
;
import
nl.uva.sne.drip.commons.types.MessageParameter
;
import
nl.uva.sne.drip.commons.types.MessageParameter
;
import
nl.uva.sne.drip.commons.types.Plan
;
import
nl.uva.sne.drip.commons.types.ToscaRepresentation
;
import
nl.uva.sne.drip.commons.types.ToscaRepresentation
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
org.json.JSONException
;
import
org.json.JSONException
;
...
@@ -45,7 +46,7 @@ public class PlannerService {
...
@@ -45,7 +46,7 @@ public class PlannerService {
@Value
(
"${message.broker.host}"
)
@Value
(
"${message.broker.host}"
)
private
String
messageBrokerHost
;
private
String
messageBrokerHost
;
public
ToscaRepresentatio
n
getPlan
(
String
toscaId
)
throws
JSONException
,
UnsupportedEncodingException
,
IOException
,
TimeoutException
,
InterruptedException
{
public
Pla
n
getPlan
(
String
toscaId
)
throws
JSONException
,
UnsupportedEncodingException
,
IOException
,
TimeoutException
,
InterruptedException
{
try
(
PlannerCaller
planner
=
new
PlannerCaller
(
messageBrokerHost
))
{
try
(
PlannerCaller
planner
=
new
PlannerCaller
(
messageBrokerHost
))
{
Message
plannerInvokationMessage
=
buildPlannerMessage
(
toscaId
);
Message
plannerInvokationMessage
=
buildPlannerMessage
(
toscaId
);
...
...
drip-planner/ICPCP.pyc
View file @
93f050a4
No preview for this file type
drip-planner/NewInstance.pyc
View file @
93f050a4
No preview for this file type
drip-planner/rpc_server.py
View file @
93f050a4
...
@@ -17,27 +17,24 @@ import json
...
@@ -17,27 +17,24 @@ import json
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
'172.17.0.
2
'
))
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
'172.17.0.
3
'
))
channel
=
connection
.
channel
()
channel
=
connection
.
channel
()
channel
.
queue_declare
(
queue
=
'planner_queue'
)
channel
.
queue_declare
(
queue
=
'planner_queue'
)
def
handleDelivery
(
message
):
def
handleDelivery
(
message
):
parsed_json
=
json
.
loads
(
message
)
parsed_json_message
=
json
.
loads
(
message
)
params
=
parsed_json
[
"parameters"
]
params
=
parsed_json_message
[
"parameters"
]
for
param
in
params
:
param
=
params
[
0
]
name
=
param
[
"name"
]
value
=
param
[
"value"
]
value
=
param
[
"value"
]
parsed_json_value
=
json
.
loads
(
value
)
def
on_request
(
ch
,
method
,
props
,
body
):
topology_template
=
parsed_json_value
[
'topology_template'
]
handleDelivery
(
body
)
node_templates
=
topology_template
[
"node_templates"
]
print
(
" Message
%
s"
%
body
)
response
=
"AAAAAAAAAAAAAAAAAAAAAA"
json1
=
node_templates
json1
=
response
.
get
(
'parameters'
)[
0
]
.
get
(
'value'
)
.
get
(
'topology_template'
)
.
get
(
'node_templates'
)
deadline
=
0
deadline
=
0
for
j
in
json1
:
for
j
in
json1
:
...
@@ -122,9 +119,13 @@ def on_request(ch, method, props, body):
...
@@ -122,9 +119,13 @@ def on_request(ch, method, props, body):
par1
[
"value"
]
=
res1
par1
[
"value"
]
=
res1
par1
[
"attributes"
]
=
"null"
par1
[
"attributes"
]
=
"null"
outcontent
[
"parameters"
]
.
append
(
par1
)
outcontent
[
"parameters"
]
.
append
(
par1
)
return
outcontent
return
outcontent
response
=
outcontent
def
on_request
(
ch
,
method
,
props
,
body
):
response
=
handleDelivery
(
body
)
ch
.
basic_publish
(
exchange
=
''
,
ch
.
basic_publish
(
exchange
=
''
,
routing_key
=
props
.
reply_to
,
routing_key
=
props
.
reply_to
,
properties
=
pika
.
BasicProperties
(
correlation_id
=
\
properties
=
pika
.
BasicProperties
(
correlation_id
=
\
...
...
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