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
21bbe89f
Commit
21bbe89f
authored
Feb 16, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added maven dependency for provisoner core
Make sure we write input files correctly
parent
fbd089e7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
22 deletions
+29
-22
DRIPCaller.java
...api/src/main/java/nl/uva/sne/drip/api/rpc/DRIPCaller.java
+1
-1
drip.properties
drip-api/src/main/resources/drip.properties
+1
-2
Consumer.java
.../main/java/nl/uva/sne/drip/drip/provisioner/Consumer.java
+25
-17
RPCServer.java
...main/java/nl/uva/sne/drip/drip/provisioner/RPCServer.java
+1
-1
RPCServer.java
...src/main/java/nl/uva/sne/drip/drip/planner/RPCServer.java
+1
-1
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/rpc/DRIPCaller.java
View file @
21bbe89f
...
...
@@ -109,7 +109,7 @@ public abstract class DRIPCaller {
}
});
String
strResponse
=
response
.
take
();
System
.
err
.
println
(
strResponse
);
//
System.err.println(strResponse);
return
mapper
.
readValue
(
strResponse
,
Message
.
class
);
}
...
...
drip-api/src/main/resources/drip.properties
View file @
21bbe89f
input.tosca.folder.path
=
/tmp/
message.broker.host
=
172.17.0.3
message.broker.host
=
172.17.0.2
db.name
=
drip
db.username
=
drip-user
db.password
=
drip-pass
drip-provisioner/src/main/java/nl/uva/sne/drip/drip/provisioner/Consumer.java
View file @
21bbe89f
...
...
@@ -55,7 +55,7 @@ public class Consumer extends DefaultConsumer {
private
final
Channel
channel
;
private
final
String
propertiesPath
=
"etc/consumer.properties"
;
private
String
jarFilePath
;
//
private String jarFilePath;
public
class
topologyElement
{
...
...
@@ -70,13 +70,13 @@ public class Consumer extends DefaultConsumer {
try
(
InputStream
in
=
new
FileInputStream
(
propertiesPath
))
{
prop
.
load
(
in
);
}
jarFilePath
=
prop
.
getProperty
(
"jar.file.path"
,
"/root/SWITCH/bin/ProvisioningCore.jar"
);
File
jarFile
=
new
File
(
jarFilePath
);
if
(!
jarFile
.
exists
())
{
throw
new
IOException
(
jarFile
.
getAbsolutePath
()
+
" not found!"
);
}
else
{
jarFilePath
=
jarFile
.
getAbsolutePath
();
}
//
jarFilePath = prop.getProperty("jar.file.path", "/root/SWITCH/bin/ProvisioningCore.jar");
//
File jarFile = new File(jarFilePath);
//
if (!jarFile.exists()) {
//
throw new IOException(jarFile.getAbsolutePath() + " not found!");
//
} else {
//
jarFilePath = jarFile.getAbsolutePath();
//
}
}
@Override
...
...
@@ -135,8 +135,7 @@ public class Consumer extends DefaultConsumer {
try
{
ec2ConfFile
=
new
File
(
tempInputDirPath
+
"ec2.Conf"
);
if
(
ec2ConfFile
.
createNewFile
())
{
PrintWriter
out
=
new
PrintWriter
(
ec2ConfFile
);
out
.
print
(
param
.
get
(
Parameter
.
VALUE
));
writeValueToFile
((
String
)
param
.
get
(
Parameter
.
VALUE
),
ec2ConfFile
);
}
else
{
return
null
;
}
...
...
@@ -148,8 +147,7 @@ public class Consumer extends DefaultConsumer {
try
{
geniConfFile
=
new
File
(
tempInputDirPath
+
"geni.Conf"
);
if
(
geniConfFile
.
createNewFile
())
{
PrintWriter
out
=
new
PrintWriter
(
geniConfFile
);
out
.
print
(
param
.
get
(
Parameter
.
VALUE
));
writeValueToFile
((
String
)
param
.
get
(
Parameter
.
VALUE
),
geniConfFile
);
}
else
{
return
null
;
}
...
...
@@ -165,8 +163,8 @@ public class Consumer extends DefaultConsumer {
File
topologyFile
=
new
File
(
tempInputDirPath
+
"topology_main"
);
if
(
topologyFile
.
createNewFile
())
{
PrintWriter
out
=
new
PrintWriter
(
topologyFile
);
out
.
print
(
param
.
get
(
Parameter
.
VALUE
));
writeValueToFile
((
String
)
param
.
get
(
Parameter
.
VALUE
),
topologyFile
);
mainTopologyPath
=
topologyFile
.
getAbsolutePath
();
}
else
{
return
null
;
...
...
@@ -177,8 +175,8 @@ public class Consumer extends DefaultConsumer {
File
topologyFile
=
new
File
(
tempInputDirPath
+
fileName
+
".yml"
);
String
outputFilePath
=
tempInputDirPath
+
fileName
+
"_provisioned.yml"
;
if
(
topologyFile
.
createNewFile
())
{
PrintWriter
out
=
new
PrintWriter
(
outputFilePath
);
out
.
print
(
param
.
get
(
Parameter
.
VALUE
));
writeValueToFile
((
String
)
param
.
get
(
Parameter
.
VALUE
),
topologyFile
);
topologyElement
x
=
new
topologyElement
();
x
.
topologyName
=
fileName
;
x
.
outputFilePath
=
outputFilePath
;
...
...
@@ -240,8 +238,9 @@ public class Consumer extends DefaultConsumer {
logDir
=
System
.
getProperty
(
"java.io.tmpdir"
);
}
String
cmd
=
"
java -jar "
+
jarFilePath
+
"
ec2="
+
ec2ConfFilePath
+
" exogeni="
+
geniConfFilePath
+
" logDir="
+
logDir
+
" topology="
+
mainTopologyPath
;
String
cmd
=
"ec2="
+
ec2ConfFilePath
+
" exogeni="
+
geniConfFilePath
+
" logDir="
+
logDir
+
" topology="
+
mainTopologyPath
;
Provisioning
.
ProvisioningCore
.
main
(
cmd
.
split
(
" "
));
// String cmd = "java -jar " + jarFilePath + " ec2=" + ec2ConfFilePath + " exogeni=" + geniConfFilePath + " logDir=" + logDir + " topology=" + mainTopologyPath;
// try {
// Logger.getLogger(Consumer.class.getName()).log(Level.INFO, "Executing: " + cmd);
// Process p = Runtime.getRuntime().exec(cmd);
...
...
@@ -352,4 +351,13 @@ public class Consumer extends DefaultConsumer {
return
jo
.
toString
();
}
private
void
writeValueToFile
(
String
value
,
File
file
)
throws
FileNotFoundException
{
try
(
PrintWriter
out
=
new
PrintWriter
(
file
))
{
out
.
print
(
value
);
}
if
(!
file
.
exists
()
||
file
.
length
()
<
value
.
getBytes
().
length
)
{
throw
new
FileNotFoundException
(
"File "
+
file
.
getAbsolutePath
()
+
" doesn't exist or contents are missing "
);
}
}
}
drip-provisioner/src/main/java/nl/uva/sne/drip/drip/provisioner/RPCServer.java
View file @
21bbe89f
...
...
@@ -31,7 +31,7 @@ import java.util.logging.Logger;
public
class
RPCServer
{
private
static
final
String
RPC_QUEUE_NAME
=
"provisioner_queue"
;
private
static
final
String
HOST
=
"172.17.0.
3
"
;
private
static
final
String
HOST
=
"172.17.0.
2
"
;
public
static
void
main
(
String
[]
argv
)
{
start
();
...
...
drip-simple_planner/src/main/java/nl/uva/sne/drip/drip/planner/RPCServer.java
View file @
21bbe89f
...
...
@@ -31,7 +31,7 @@ import java.util.logging.Logger;
public
class
RPCServer
{
private
static
final
String
RPC_QUEUE_NAME
=
"planner_queue"
;
private
static
final
String
HOST
=
"172.17.0.
3
"
;
private
static
final
String
HOST
=
"172.17.0.
2
"
;
public
static
void
main
(
String
[]
argv
)
{
start
();
...
...
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