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
2bbc0d82
Commit
2bbc0d82
authored
Mar 19, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed status from topology. All nodes have state attribute
parent
369b1304
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
517 additions
and
157 deletions
+517
-157
application_example_provisioned.yaml
TOSCA/application_example_provisioned.yaml
+54
-78
nodes.yaml
TOSCA/types/nodes.yaml
+1
-6
pom.xml
commons/pom.xml
+7
-1
Converter.java
...rc/main/java/nl/uva/sne/drip/commons/utils/Converter.java
+3
-3
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+41
-3
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+41
-0
test_deployer.py
deployer/test/test_deployer.py
+2
-2
message_example_provisioned.json
example_messages/message_example_provisioned.json
+0
-0
message_provision_request.json
example_messages/message_provision_request.json
+1
-0
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+2
-2
ServiceTests.java
...r/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
+1
-1
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+60
-36
RPCServer.java
.../src/main/java/nl/uva/sne/drip/provisioner/RPCServer.java
+42
-25
CloudStormServiceTest.java
...va/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
+262
-0
No files found.
TOSCA/application_example_provisioned.yaml
View file @
2bbc0d82
...
...
@@ -3,9 +3,9 @@ topology_template:
node_templates
:
compute
:
properties
:
disk_size
:
"
5
0000
MB"
mem_size
:
"
6
000
MB"
num_cores
:
2
.0
disk_size
:
"
1
0000
MB"
mem_size
:
"
1
000
MB"
num_cores
:
1
.0
os
:
"
Ubuntu
18.04"
user_name
:
"
vm_user"
interfaces
:
...
...
@@ -16,22 +16,22 @@ topology_template:
user_key_pair
:
protocol
:
"
ssh"
keys
:
public_key
:
"
c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FD
V3l6VEoxS1pycDVvVHVBVm15dmxKL2prMnRNdktZSlAvSWtHZ1JKeTVFNUgrbjl0eU1QRXdyUDN4c0lUMVZzRjlVNVhLTkkvVDVpZDgxNko5RmxjbEhOSHVrbEFTMlhqV3QzNnlZekorMkhsa3JET0I4Q25DdmgvQlQ5K2liNkpjVFpUd21Xb1FQbjFuVXpSelRSVGU5NUlyOUl4djgrTnNLVWYxdVYzNDBRPT0gYXV0byBnZW5lcmF0ZWQgdXNlciBhY2NlZXMga2V5cwo=
"
private_key
:
"
LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlDV3dJQkFBS0JnUUN
XeXpUSjFLWnJwNW9UdUFWbXl2bEovamsydE12S1lKUC9Ja0dnUkp5NUU1SCtuOXR5Ck1QRXdyUDN4c0lUMVZzRjlVNVhLTkkvVDVpZDgxNko5RmxjbEhOSHVrbEFTMlhqV3QzNnlZekorMkhsa3JET0IKOENuQ3ZoL0JUOStpYjZKY1RaVHdtV29RUG4xblV6UnpUUlRlOTVJcjlJeHY4K05zS1VmMXVWMzQwUUlEQVFBQgpBb0dBSUJDMStQVXZMbFZGZmt2eldoaHZTankxRGQwRU9OU3dvK0EwOUUraXcvaFZZeis2K2wxTjdIdmN4RGcxCkRiYVZEb0ZucU1ma2picXpTdWpQdEttN2ZlVThldjF3a21a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NnJWVmFXSmZFVEwxYmhnRQpacVZveTRnQzVvcE5DQmFjTER5ZTFMQnVySEE0QTcwS1d0UTlMMkhTOU1nZGpqQm1QSmo2eFRtV21iamNkNkRMTlJkdmZRaTBPbzdlCjY3MEkrREZ5L2JieHB0cktFV0hPZWdFQ2dZQmM3a0NDbGlUZ29xNkVUdUhQQXpYMnB0TUNtV2Y4MDlPc0VSY29kWGlMRWRDUWJFMU4KOGVxNHIzK2Z3cDUyMHNXZDJmcFpvNjFCeXJzUGV5N0pGeXhPN3RqdVp2WGlzN3dHeU5oOUlIdnBOaDNQNG9DSUZudkRQa04veUJWbgpwQUJSUlNyZHNEVzRxY2RXeFJlM0k4ZU16d1VzYVM0TUQvUElrYzBrdWU3dGh3S0JnUUNuUjh2NHM0bWVQeEF1MGRiVmxaR3ExUnZnCkJnR3BkZHR6SnN2Sk9qYitmWVp3a2tNU3huZGY5dzdocUVqbEFPckdNVmlBTm13R3ROVWFSMEdkS1h1OGxoRzNSUDFEbnFRdkR0ZDMKajRRTkE0WUFjZ2xFYnpLK1JsVzR1VENOeTN6enBqcC8wOERBazJOZHMvVkhkQ0gyRlBBaW9TdVkrTllESFJhTlE0Tng4QT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0t
"
host_name
:
"
vm0"
compute_1
:
properties
:
disk_size
:
"
5
0000
MB"
mem_size
:
"
6
000
MB"
num_cores
:
2
.0
disk_size
:
"
1
0000
MB"
mem_size
:
"
1
000
MB"
num_cores
:
1
.0
os
:
"
Ubuntu
18.04"
user_name
:
"
vm_user"
interfaces
:
...
...
@@ -42,21 +42,18 @@ topology_template:
user_key_pair
:
protocol
:
"
ssh"
keys
:
public_key
:
"
c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FD
V3l6VEoxS1pycDVvVHVBVm15dmxKL2prMnRNdktZSlAvSWtHZ1JKeTVFNUgrbjl0eU1QRXdyUDN4c0lUMVZzRjlVNVhLTkkvVDVp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kZHR6SnN2Sk9qYitmWVp3a2tNU3huZGY5dzdocUVqbEFPckdNVmlBTm13R3ROVWFSMEdkS1h1OGxoRzNSUDFEbnFRdkR0ZDMKajRRTkE0WUFjZ2xFYnpLK1JsVzR1VENOeTN6enBqcC8wOERBazJOZHMvVkhkQ0gyRlBBaW9TdVkrTllESFJhTlE0Tng4QT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0t
"
host_name
:
"
vm1"
kubernetes
:
properties
:
min_masters_num
:
1
min_workers_num
:
1
requirements
:
-
host
:
capability
:
"
tosca.capabilities.ARTICONF.VM.topology"
...
...
@@ -64,6 +61,9 @@ topology_template:
relationship
:
"
tosca.relationships.HostedOn"
interfaces
:
Kubernetes
:
configure
:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/dashboard.yaml"
create
:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml"
...
...
@@ -71,48 +71,6 @@ topology_template:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml"
type
:
"
tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"
logspout
:
properties
:
environment
:
publish
:
"
127.0.0.1:8000:80"
ports
:
-
"
8000:80"
volumes
:
-
"
/etc/hostname:/etc/host_hostname:ro"
-
"
/var/run/docker.sock:/var/run/docker.sock"
requirements
:
-
host
:
capability
:
"
tosca.capabilities.ARTICONF.docker.Orchestrator"
node
:
"
kubernetes"
relationship
:
"
tosca.relationships.HostedOn"
type
:
"
tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts
:
image
:
file
:
"
gliderlabs/logspout:latest"
repository
:
"
docker_hub"
type
:
"
tosca.artifacts.Deployment.Image.Container.Docker"
mysql
:
properties
:
environment
:
MYSQL_DATABASE
:
"
wordpress"
MYSQL_PASSWORD
:
"
wordpress"
MYSQL_ROOT_PASSWORD
:
"
somewordpress"
MYSQL_USER
:
"
wordpress"
ports
:
-
"
3306:3306"
volumes
:
-
"
db_data:/var/lib/mysql"
requirements
:
-
host
:
capability
:
"
tosca.capabilities.ARTICONF.docker.Orchestrator"
node
:
"
kubernetes"
relationship
:
"
tosca.relationships.HostedOn"
type
:
"
tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts
:
image
:
file
:
"
mysql:5.7"
repository
:
"
docker_hub"
type
:
"
tosca.artifacts.Deployment.Image.Container.Docker"
topology
:
properties
:
domain
:
"
Frankfurt"
...
...
@@ -128,33 +86,51 @@ topology_template:
relationship
:
"
tosca.relationships.DependsOn"
interfaces
:
CloudsStorm
:
delete
:
inputs
:
code_type
:
"
SEQ"
object_type
:
"
SubTopology"
hscale
:
inputs
:
code_type
:
"
SEQ"
object_type
:
"
SubTopology"
provision
:
inputs
:
code_type
:
"
SEQ"
object_type
:
"
SubTopology"
start
:
inputs
:
code_type
:
"
SEQ"
object_type
:
"
SubTopology"
stop
:
inputs
:
code_type
:
"
SEQ"
object_type
:
"
SubTopology"
type
:
"
tosca.nodes.ARTICONF.VM.topology"
attributes
:
credential
:
cloud_provider_name
:
"
EC2"
keys
:
aws_access_key_id
:
"
XXXXXXXXXXXXXXXXXXX
XXXXX
"
token
:
"
XXXXXXXXXXXXXXXXXXX
XXX
"
aws_access_key_id
:
"
XXXXXXXXXXXXXXXXXXX"
token
:
"
XXXXXXXXXXXXXXXXXXX"
token_type
:
"
access_key"
desired_state
:
"
PROVISION"
status
:
"
running"
policies
:
-
scalability
:
ws-pema
:
properties
:
constraint_name
:
"
cpu_load"
max_value
:
90
targets
:
-
"
mysql"
type
:
"
tosca.policies.ARTICONF.Performance.CPU"
-
faultTolerance
:
properties
:
level
:
1
targets
:
-
"
mysql"
type
:
"
tosca.policies.ARTICONF.FaultTolerance"
ports
:
-
"
30001:8080"
requirements
:
-
host
:
capability
:
"
tosca.capabilities.ARTICONF.docker.Orchestrator"
node
:
"
kubernetes"
relationship
:
"
tosca.relationships.HostedOn"
type
:
"
tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts
:
image
:
file
:
"
alogo53/ws-pema-lifewatch"
repository
:
"
docker_hub"
type
:
"
tosca.artifacts.Deployment.Image.Container.Docker"
description
:
"
TOSCA
example"
imports
:
-
nodes
:
"
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
...
...
TOSCA/types/nodes.yaml
View file @
2bbc0d82
...
...
@@ -154,11 +154,6 @@ node_types:
ssh_keys
:
type
:
tosca.datatypes.ARTICONF.Credential
required
:
false
status
:
type
:
string
required
:
false
constraints
:
-
valid_values
:
[
"
fresh"
,
"
running"
,
"
deleted"
,
"
failed"
,
"
stopped"
]
interfaces
:
CloudsStorm
:
type
:
tosca.interfaces.ARTICONF.CloudsStorm
...
...
commons/pom.xml
View file @
2bbc0d82
...
...
@@ -144,6 +144,12 @@
<version>
1.25
</version>
<type>
jar
</type>
</dependency>
<dependency>
<groupId>
com.jcraft
</groupId>
<artifactId>
jsch
</artifactId>
<version>
0.1.54
</version>
<type>
jar
</type>
</dependency>
</dependencies>
...
...
commons/src/main/java/nl/uva/sne/drip/commons/utils/Converter.java
View file @
2bbc0d82
...
...
@@ -60,7 +60,7 @@ public class Converter {
}
public
static
String
encodeFileToBase64Binary
(
String
fileName
)
throws
IOException
{
return
encode2Bas64
(
Files
.
readAllBytes
(
Paths
.
get
(
fileName
)));
return
encode2Bas
e
64
(
Files
.
readAllBytes
(
Paths
.
get
(
fileName
)));
}
public
static
void
decodeBase64BToFile
(
String
base64
,
String
fileName
)
throws
IOException
{
...
...
@@ -82,11 +82,11 @@ public class Converter {
String
name
=
System
.
currentTimeMillis
()
+
"_"
+
originalFileName
;
byte
[]
bytes
=
file
.
getBytes
();
return
encode2Bas64
(
bytes
);
return
encode2Bas
e
64
(
bytes
);
}
private
static
String
encode2Bas64
(
byte
[]
bytes
)
{
private
static
String
encode2Bas
e
64
(
byte
[]
bytes
)
{
byte
[]
encodedBytes
=
Base64
.
getEncoder
().
encode
(
bytes
);
return
new
String
(
encodedBytes
,
StandardCharsets
.
UTF_8
);
...
...
commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
2bbc0d82
...
...
@@ -21,11 +21,15 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
com.jcraft.jsch.JSch
;
import
com.jcraft.jsch.JSchException
;
import
com.jcraft.jsch.KeyPair
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -43,6 +47,7 @@ import nl.uva.sne.drip.sure.tosca.client.ApiException;
import
nl.uva.sne.drip.sure.tosca.client.Configuration
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
static
nl
.
uva
.
sne
.
drip
.
commons
.
utils
.
Constatnts
.*;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology.StatusEnum
;
/**
*
...
...
@@ -57,7 +62,7 @@ public class ToscaHelper {
private
Integer
id
;
public
static
enum
NODE_STATES
{
PROVISION
,
DELETE
,
START
,
STOP
,
H_SCALE
,
V_SCALE
,
CONFIGURE
DELETED
,
STARTED
,
STOPPED
,
H_SCALED
,
V_SCALED
,
CONFIGURED
,
RUNNING
,
FAILED
}
@Autowired
...
...
@@ -251,7 +256,7 @@ public class ToscaHelper {
return
toscaCredential
;
}
else
{
throw
new
Exc
eption
(
"NodeTemplate is not of type: "
+
VM_TOPOLOGY
+
" it is of type: "
+
vmTopology
.
getType
());
throw
new
TypeEx
eption
(
"NodeTemplate is not of type: "
+
VM_TOPOLOGY
+
" it is of type: "
+
vmTopology
.
getType
());
}
}
...
...
@@ -296,7 +301,10 @@ public class ToscaHelper {
public
NODE_STATES
getNodeCurrentState
(
NodeTemplateMap
node
)
{
return
getNodeState
(
node
,
"current_state"
);
}
public
NodeTemplateMap
setNodeCurrentState
(
NodeTemplateMap
node
,
NODE_STATES
nodeState
)
{
return
setNodeState
(
node
,
"current_state"
,
nodeState
);
}
public
NodeTemplateMap
setNodeDesiredState
(
NodeTemplateMap
node
,
NODE_STATES
nodeState
)
{
...
...
@@ -325,4 +333,34 @@ public class ToscaHelper {
return
node
;
}
public
static
NODE_STATES
cloudStormStatus2NodeState
(
StatusEnum
cloudStormStatus
)
{
if
(
cloudStormStatus
.
equals
(
StatusEnum
.
FRESH
)){
return
null
;
}
String
cloudStormStatusStr
=
cloudStormStatus
.
toString
().
toUpperCase
();
return
NODE_STATES
.
valueOf
(
cloudStormStatusStr
);
}
public
KeyPair
getKeyPairsFromVM
(
NodeTemplate
vmMap
)
throws
ApiException
,
TypeExeption
,
JSchException
{
if
(
vmMap
.
getType
().
equals
(
VM_TYPE
))
{
Map
<
String
,
Object
>
attributes
=
vmMap
.
getAttributes
();
if
(
attributes
!=
null
&&
attributes
.
containsKey
(
"user_key_pair"
))
{
Map
<
String
,
Object
>
userKeyPair
=
(
Map
<
String
,
Object
>)
attributes
.
get
(
"user_key_pair"
);
if
(
userKeyPair
.
containsKey
(
"protocol"
)
&&
userKeyPair
.
get
(
"protocol"
).
equals
(
"ssh"
))
{
Map
<
String
,
Object
>
keysMap
=
(
Map
<
String
,
Object
>)
userKeyPair
.
get
(
"keys"
);
JSch
jsch
=
new
JSch
();
byte
[]
privatekeyBytes
=
Base64
.
getDecoder
().
decode
(((
String
)
keysMap
.
get
(
"private_key"
)));
byte
[]
publicKeyBytes
=
Base64
.
getDecoder
().
decode
(((
String
)
keysMap
.
get
(
"public_key"
)));
KeyPair
keyPair
=
KeyPair
.
load
(
jsch
,
privatekeyBytes
,
publicKeyBytes
);
keyPair
.
dispose
();
return
keyPair
;
}
}
}
else
{
throw
new
TypeExeption
(
"NodeTemplate is not of type: "
+
VM_TYPE
+
" it is of type: "
+
vmMap
.
getType
());
}
return
null
;
}
}
commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
View file @
2bbc0d82
...
...
@@ -20,6 +20,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
com.jcraft.jsch.KeyPair
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.nio.file.Files
;
...
...
@@ -439,4 +440,44 @@ public class ToscaHelperTest {
}
/**
* Test of getKeyPairsFromVM method, of class ToscaHelper.
*/
@Test
public
void
testGetKeyPairsFromVM
()
throws
Exception
{
System
.
out
.
println
(
"getKeyPairsFromVM"
);
instance
.
uploadToscaTemplate
(
provisionedToscaTemplate
);
KeyPair
keyPair
;
List
<
NodeTemplateMap
>
vmTopologyTemplatesMap
=
instance
.
getVMTopologyTemplates
();
assertNotNull
(
vmTopologyTemplatesMap
);
for
(
NodeTemplateMap
nodeTemplateMap
:
vmTopologyTemplatesMap
)
{
assertNotNull
(
nodeTemplateMap
);
List
<
NodeTemplateMap
>
vmTemplatesMap
=
instance
.
getTemplateVMsForVMTopology
(
nodeTemplateMap
);
assertNotNull
(
vmTemplatesMap
);
for
(
NodeTemplateMap
vmMap
:
vmTemplatesMap
)
{
assertNotNull
(
vmMap
);
assertNotNull
(
vmMap
.
getNodeTemplate
());
keyPair
=
instance
.
getKeyPairsFromVM
(
vmMap
.
getNodeTemplate
());
assertNotNull
(
keyPair
);
}
}
}
/**
* Test of cloudStormStatus2NodeState method, of class ToscaHelper.
*/
@Test
public
void
testCloudStormStatus2NodeState
()
{
System
.
out
.
println
(
"cloudStormStatus2NodeState"
);
for
(
CloudsStormSubTopology
.
StatusEnum
value
:
CloudsStormSubTopology
.
StatusEnum
.
values
())
{
ToscaHelper
.
NODE_STATES
result
=
ToscaHelper
.
cloudStormStatus2NodeState
(
value
);
if
(
value
.
equals
(
CloudsStormSubTopology
.
StatusEnum
.
FRESH
))
{
assertNull
(
result
);
}
else
{
assertEquals
(
value
.
toString
().
toUpperCase
(),
result
.
toString
().
toUpperCase
());
}
}
}
}
deployer/test/test_deployer.py
View file @
2bbc0d82
...
...
@@ -28,10 +28,10 @@ class TestDeployer(unittest.TestCase):
def
test
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
tosca_path
=
"../../
TOSCA
/"
tosca_path
=
"../../
example_messages
/"
input_tosca_file_path
=
tosca_path
+
'/message_example_provisioned.json'
if
not
os
.
path
.
exists
(
input_tosca_file_path
):
tosca_path
=
"../
TOSCA
/"
tosca_path
=
"../
example_messages
/"
input_tosca_file_path
=
tosca_path
+
'/message_example_provisioned.json'
with
open
(
input_tosca_file_path
,
'r'
)
as
stream
:
...
...
TOSCA
/message_example_provisioned.json
→
example_messages
/message_example_provisioned.json
View file @
2bbc0d82
File moved
example_messages/message_provision_request.json
0 → 100644
View file @
2bbc0d82
{
"owner"
:
"user"
,
"creationDate"
:
1584616813246
,
"toscaTemplate"
:{
"tosca_definitions_version"
:
"tosca_simple_yaml_1_0"
,
"tosca_default_namespace"
:
null
,
"template_name"
:
null
,
"topology_template"
:{
"description"
:
null
,
"inputs"
:
null
,
"node_templates"
:{
"compute"
:{
"properties"
:{
"disk_size"
:
"10000 MB"
,
"mem_size"
:
"1000 MB"
,
"num_cores"
:
1
,
"os"
:
"Ubuntu 18.04"
,
"user_name"
:
"vm_user"
},
"interfaces"
:{
"Standard"
:{
"create"
:
"dumy.yaml"
}},
"type"
:
"tosca.nodes.ARTICONF.VM.Compute"
},
"compute_1"
:{
"properties"
:{
"disk_size"
:
"10000 MB"
,
"mem_size"
:
"1000 MB"
,
"num_cores"
:
1
,
"os"
:
"Ubuntu 18.04"
,
"user_name"
:
"vm_user"
},
"interfaces"
:{
"Standard"
:{
"create"
:
"dumy.yaml"
}},
"type"
:
"tosca.nodes.ARTICONF.VM.Compute"
},
"kubernetes"
:{
"requirements"
:[{
"host"
:{
"capability"
:
"tosca.capabilities.ARTICONF.VM.topology"
,
"node"
:
"topology"
,
"relationship"
:
"tosca.relationships.HostedOn"
}}],
"interfaces"
:{
"Kubernetes"
:{
"configure"
:{
"inputs"
:{
"playbook"
:
"https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/dashboard.yaml"
}},
"create"
:{
"inputs"
:{
"playbook"
:
"https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml"
}},
"install"
:{
"inputs"
:{
"playbook"
:
"https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml"
}}}},
"type"
:
"tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"
},
"topology"
:{
"properties"
:{
"domain"
:
"Frankfurt"
,
"provider"
:
"EC2"
},
"requirements"
:[{
"vm"
:{
"capability"
:
"tosca.capabilities.ARTICONF.VM"
,
"node"
:
"compute"
,
"relationship"
:
"tosca.relationships.DependsOn"
}},{
"vm"
:{
"capability"
:
"tosca.capabilities.ARTICONF.VM"
,
"node"
:
"compute_1"
,
"relationship"
:
"tosca.relationships.DependsOn"
}}],
"interfaces"
:{
"CloudsStorm"
:{
"delete"
:{
"inputs"
:{
"code_type"
:
"SEQ"
,
"object_type"
:
"SubTopology"
}},
"hscale"
:{
"inputs"
:{
"code_type"
:
"SEQ"
,
"object_type"
:
"SubTopology"
}},
"provision"
:{
"inputs"
:{
"code_type"
:
"SEQ"
,
"object_type"
:
"SubTopology"
}},
"start"
:{
"inputs"
:{
"code_type"
:
"SEQ"
,
"object_type"
:
"SubTopology"
}},
"stop"
:{
"inputs"
:{
"code_type"
:
"SEQ"
,
"object_type"
:
"SubTopology"
}}}},
"type"
:
"tosca.nodes.ARTICONF.VM.topology"
,
"attributes"
:{
"credential"
:{
"cloud_provider_name"
:
"EC2"
,
"keys"
:{
"aws_access_key_id"
:
"XXXXXXXXXXXXXXXXXXX"
},
"token"
:
"XXXXXXXXXXXXXXX"
,
"token_type"
:
"access_key"
},
"desired_state"
:
"PROVISION"
}},
"ws-pema"
:{
"properties"
:{
"ports"
:[
"30001:8080"
]},
"requirements"
:[{
"host"
:{
"capability"
:
"tosca.capabilities.ARTICONF.docker.Orchestrator"
,
"node"
:
"kubernetes"
,
"relationship"
:
"tosca.relationships.HostedOn"
}}],
"type"
:
"tosca.nodes.ARTICONF.Container.Application.Docker"
,
"artifacts"
:{
"image"
:{
"file"
:
"alogo53/ws-pema-lifewatch"
,
"repository"
:
"docker_hub"
,
"type"
:
"tosca.artifacts.Deployment.Image.Container.Docker"
}}}},
"relationship_templates"
:
null
,
"outputs"
:
null
,
"groups"
:
null
,
"substitution_mappings"
:
null
,
"policies"
:
null
},
"template_author"
:
null
,
"template_version"
:
null
,
"description"
:
"TOSCA example"
,
"imports"
:[{
"nodes"
:
"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
},{
"data"
:
"https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"
},{
"capabilities"
:
"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"
},{
"policies"
:
"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"
},{
"interfaces"
:
"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"
}],
"dsl_definitions"
:
null
,
"node_types"
:
null
,
"relationship_types"
:
null
,
"relationship_templates"
:
null
,
"capability_types"
:
null
,
"artifact_types"
:
null
,
"data_types"
:
null
,
"interface_types"
:
null
,
"policy_types"
:
null
,
"group_types"
:
null
,
"repositories"
:
null
}}
manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
2bbc0d82
...
...
@@ -117,7 +117,7 @@ public class DRIPService {
if
(
vmTopologies
==
null
||
vmTopologies
.
isEmpty
())
{
throw
new
MissingVMTopologyException
(
"ToscaTemplate: "
+
toscaTemplate
+
" has no VM Topologies"
);
}
toscaTemplate
=
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
NODE_STATES
.
PROVISION
);
toscaTemplate
=
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
NODE_STATES
.
RUNNING
);
return
execute
(
toscaTemplate
,
provisionerQueueName
);
}
...
...
@@ -162,7 +162,7 @@ public class DRIPService {
for
(
NodeTemplateMap
vmTopology
:
vmTopologies
)
{
CloudsStormSubTopology
.
StatusEnum
status
=
helper
.
getVMTopologyTemplateStatus
(
vmTopology
);
if
(!
status
.
equals
(
CloudsStormSubTopology
.
StatusEnum
.
DELETED
))
{
toscaTemplate
=
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
NODE_STATES
.
DELETE
);
toscaTemplate
=
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
NODE_STATES
.
DELETE
D
);
}
}
return
execute
(
toscaTemplate
,
provisionerQueueName
);
...
...
manager/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
View file @
2bbc0d82
...
...
@@ -434,7 +434,7 @@ public class ServiceTests {
Assert
.
assertTrue
(
attributes
.
containsKey
(
"credential"
));
assertNotNull
(
attributes
.
get
(
"credential"
));
}
toscaTemplate
=
dripService
.
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
ToscaHelper
.
NODE_STATES
.
PROVISION
);
toscaTemplate
=
dripService
.
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
ToscaHelper
.
NODE_STATES
.
RUNNING
);
Map
<
String
,
NodeTemplate
>
nodes
=
toscaTemplate
.
getTopologyTemplate
().
getNodeTemplates
();
Set
<
String
>
names
=
nodes
.
keySet
();
for
(
String
name
:
names
)
{
...
...
provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
2bbc0d82
...
...
@@ -31,6 +31,8 @@ import java.util.logging.Level;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
static
nl
.
uva
.
sne
.
drip
.
commons
.
utils
.
ToscaHelper
.
cloudStormStatus2NodeState
;
import
nl.uva.sne.drip.model.Exceptions.TypeExeption
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVM
;
import
nl.uva.sne.drip.model.NodeTemplateMap
;
import
nl.uva.sne.drip.model.cloud.storm.CloudCred
;
...
...
@@ -64,17 +66,19 @@ class CloudStormService {
private
final
CloudStormDAO
cloudStormDAO
;
private
final
ObjectMapper
objectMapper
;
private
final
String
cloudStormDBPath
;
p
rivate
final
String
SUB_TOPOLOGY_NAME
=
"subTopology"
;
p
rivate
final
String
TOPOLOGY_FOLDER_NAME
=
"Topology"
;
p
rivate
final
String
INFS_FOLDER_NAME
=
"Infs"
;
p
rivate
final
String
UC_FOLDER_NAME
=
"UC"
;
p
rivate
final
String
UD_FOLDER_NAME
=
"UD"
;
p
rivate
final
String
APP_FOLDER_NAME
=
"App"
;
p
rivate
final
String
TOP_TOPOLOGY_FILE_NAME
=
"_top.yml"
;
p
rivate
final
String
TOPOLOGY_RELATIVE_PATH
=
File
.
separator
p
ublic
static
final
String
SUB_TOPOLOGY_NAME
=
"subTopology"
;
p
ublic
static
final
String
TOPOLOGY_FOLDER_NAME
=
"Topology"
;
p
ublic
static
final
String
INFS_FOLDER_NAME
=
"Infs"
;
p
ublic
static
final
String
UC_FOLDER_NAME
=
"UC"
;
p
ublic
static
final
String
UD_FOLDER_NAME
=
"UD"
;
p
ublic
static
final
String
APP_FOLDER_NAME
=
"App"
;
p
ublic
static
final
String
TOP_TOPOLOGY_FILE_NAME
=
"_top.yml"
;
p
ublic
static
final
String
TOPOLOGY_RELATIVE_PATH
=
File
.
separator
+
INFS_FOLDER_NAME
+
File
.
separator
+
TOPOLOGY_FOLDER_NAME
+
File
.
separator
;
private
ToscaTemplate
toscaTemplate
;
private
String
userPublicKeyName
;
public
static
final
String
INFRASTUCTURE_CODE_FILE_NAME
=
"infrasCode.yml"
;
CloudStormService
(
Properties
properties
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
this
.
toscaTemplate
=
toscaTemplate
;
...
...
@@ -132,34 +136,39 @@ class CloudStormService {
List
<
CloudsStormSubTopology
>
cloudStormSubtopologies
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
writeCloudStormInfrasCodeFiles
(
infrasCodeTempInputDirPath
,
cloudStormSubtopologies
);
ToscaTemplate
t
oscaTemplate
=
runCloudStorm
(
tempInputDirPath
);
helper
.
uploadToscaTemplate
(
t
oscaTemplate
);
return
t
oscaTemplate
;
ToscaTemplate
newT
oscaTemplate
=
runCloudStorm
(
tempInputDirPath
);
helper
.
uploadToscaTemplate
(
newT
oscaTemplate
);
return
newT
oscaTemplate
;
}
pr
ivate
Map
<
String
,
Object
>
writeCloudStormTopologyFiles
(
String
t
empInputDirPath
)
throws
JSchException
,
IOException
,
ApiException
,
Exception
{
pr
otected
Map
<
String
,
Object
>
writeCloudStormTopologyFiles
(
String
topologyT
empInputDirPath
)
throws
JSchException
,
IOException
,
ApiException
,
Exception
{
CloudsStormTopTopology
topTopology
=
new
CloudsStormTopTopology
();
String
publicKeyPath
=
buildSSHKeyPair
(
tempInputDirPath
);
KeyPair
keyPair
=
getKeyPair
();
String
publicKeyPath
=
buildSSHKeyPair
(
topologyTempInputDirPath
,
keyPair
);
topTopology
.
setPublicKeyPath
(
publicKeyPath
);
topTopology
.
setUserName
(
helper
.
getVMTopologyUser
());
Map
<
String
,
Object
>
subTopologiesAndVMs
=
getCloudsStormSubTopologiesAndVMs
(
tempInputDirPath
);
Map
<
String
,
Object
>
subTopologiesAndVMs
=
getCloudsStormSubTopologiesAndVMs
(
t
opologyT
empInputDirPath
);
List
<
CloudsStormSubTopology
>
cloudsStormSubTopology
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
topTopology
.
setTopologies
(
cloudsStormSubTopology
);
objectMapper
.
writeValue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
TOP_TOPOLOGY_FILE_NAME
)
,
topTopology
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Wrote CloudStorm topology files in:
"
+
TOP_TOPOLOGY_FILE_NAME
,
new
Object
[]{
tempInputDirPath
,
File
.
separator
}
);
File
topTopologyFile
=
new
File
(
topologyTempInputDirPath
+
File
.
separator
+
TOP_TOPOLOGY_FILE_NAME
);
objectMapper
.
writeValue
(
topTopologyFile
,
topTopology
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Wrote CloudStorm topology files in:
{0}"
,
topTopologyFile
.
getAbsolutePath
()
);
return
subTopologiesAndVMs
;
}
pr
ivate
String
buildSSHKeyPair
(
String
tempInputDirPath
)
throws
JSchException
,
IOException
{
String
userPublicKeyName
=
"id_rsa.pub"
;
pr
otected
String
buildSSHKeyPair
(
String
tempInputDirPath
,
KeyPair
kpair
)
throws
JSchException
,
IOException
{
userPublicKeyName
=
"id_rsa.pub"
;
String
publicKeyPath
=
"name@"
+
userPublicKeyName
;
JSch
jsch
=
new
JSch
();
KeyPair
kpair
=
KeyPair
.
genKeyPair
(
jsch
,
KeyPair
.
RSA
);
String
userPrivateName
=
FilenameUtils
.
removeExtension
(
userPublicKeyName
);
if
(
kpair
==
null
)
{
JSch
jsch
=
new
JSch
();
kpair
=
KeyPair
.
genKeyPair
(
jsch
,
KeyPair
.
RSA
);
}
kpair
.
writePrivateKey
(
tempInputDirPath
+
File
.
separator
+
userPrivateName
);
kpair
.
writePublicKey
(
tempInputDirPath
+
File
.
separator
+
userPublicKeyName
,
"
auto
generated user accees keys"
);
kpair
.
writePublicKey
(
tempInputDirPath
+
File
.
separator
+
userPublicKeyName
,
"generated user accees keys"
);
kpair
.
dispose
();
Set
<
PosixFilePermission
>
perms
=
new
HashSet
<>();
...
...
@@ -169,7 +178,7 @@ class CloudStormService {
return
publicKeyPath
;
}
pr
ivate
Map
<
String
,
Object
>
getCloudsStormSubTopologiesAndVMs
(
String
tempInputDirPath
)
throws
ApiException
,
IOException
,
Exception
{
pr
otected
Map
<
String
,
Object
>
getCloudsStormSubTopologiesAndVMs
(
String
tempInputDirPath
)
throws
ApiException
,
IOException
,
Exception
{
List
<
NodeTemplateMap
>
vmTopologyTemplatesMap
=
helper
.
getVMTopologyTemplates
();
List
<
CloudsStormSubTopology
>
cloudsStormSubTopologies
=
new
ArrayList
<>();
Map
<
String
,
Object
>
cloudsStormMap
=
new
HashMap
<>();
...
...
@@ -205,7 +214,7 @@ class CloudStormService {
return
cloudsStormMap
;
}
pr
ivate
CloudsStormVM
getBestMatchingCloudStormVM
(
NodeTemplateMap
vmMap
,
String
provider
)
throws
IOException
,
Exception
{
pr
otected
CloudsStormVM
getBestMatchingCloudStormVM
(
NodeTemplateMap
vmMap
,
String
provider
)
throws
IOException
,
Exception
{
Double
requestedNumOfCores
=
helper
.
getVMNumOfCores
(
vmMap
);
Double
requestedMemSize
=
helper
.
getVMNMemSize
(
vmMap
);
String
requestedOs
=
helper
.
getVMNOS
(
vmMap
);
...
...
@@ -247,7 +256,7 @@ class CloudStormService {
return
bestMatchingVM
;
}
pr
ivate
void
writeCloudStormCredentialsFiles
(
String
credentialsTempInputDirPath
)
throws
ApiException
,
Exception
{
pr
otected
void
writeCloudStormCredentialsFiles
(
String
credentialsTempInputDirPath
)
throws
ApiException
,
Exception
{
List
<
NodeTemplateMap
>
vmTopologiesMaps
=
helper
.
getVMTopologyTemplates
();
List
<
CloudCred
>
cloudStormCredentialList
=
new
ArrayList
<>();
int
i
=
0
;
...
...
@@ -269,7 +278,7 @@ class CloudStormService {
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Wrote cloudStorm credentials at : {0}{1}cred.yml"
,
new
Object
[]{
credentialsTempInputDirPath
,
File
.
separator
});
}
pr
ivate
CredentialInfo
getCloudStormCredentialInfo
(
Credential
toscaCredentials
,
String
tmpPath
)
throws
FileNotFoundException
,
IOException
{
pr
otected
CredentialInfo
getCloudStormCredentialInfo
(
Credential
toscaCredentials
,
String
tmpPath
)
throws
FileNotFoundException
,
IOException
{
CredentialInfo
cloudStormCredentialInfo
=
new
CredentialInfo
();
switch
(
toscaCredentials
.
getCloudProviderName
().
toLowerCase
())
{
case
"exogeni"
:
...
...
@@ -288,17 +297,18 @@ class CloudStormService {
return
null
;
}
pr
ivate
void
writeCloudStormInfrasCodeFiles
(
String
infrasCodeTempInputDirPath
,
List
<
CloudsStormSubTopology
>
cloudStormSubtopologies
)
throws
ApiException
,
IOException
{
pr
otected
void
writeCloudStormInfrasCodeFiles
(
String
infrasCodeTempInputDirPath
,
List
<
CloudsStormSubTopology
>
cloudStormSubtopologies
)
throws
ApiException
,
IOException
{
List
<
NodeTemplateMap
>
vmTopologiesMaps
=
helper
.
getVMTopologyTemplates
();
int
i
=
0
;
List
<
InfrasCode
>
infrasCodes
=
new
ArrayList
<>();
for
(
NodeTemplateMap
vmTopologyMap
:
vmTopologiesMaps
)
{
ToscaHelper
.
NODE_STATES
nodeCurrentState
=
helper
.
getNodeCurrentState
(
vmTopologyMap
);
ToscaHelper
.
NODE_STATES
nodeDesiredState
=
helper
.
getNodeDesiredState
(
vmTopologyMap
);
if
(
nodeCurrentState
!=
null
&&
nodeCurrentState
.
equals
(
ToscaHelper
.
NODE_STATES
.
PROVISION
))
{
if
(
nodeCurrentState
!=
null
&&
nodeCurrentState
.
equals
(
ToscaHelper
.
NODE_STATES
.
RUNNING
))
{
//Already there
}
if
(
nodeCurrentState
==
null
||
nodeCurrentState
.
equals
(
ToscaHelper
.
NODE_STATES
.
DELETE
))
{
//Can provision
if
(
nodeCurrentState
==
null
||
nodeCurrentState
.
equals
(
ToscaHelper
.
NODE_STATES
.
DELETED
))
{
Map
<
String
,
Object
>
provisionInterface
=
helper
.
getProvisionerInterfaceFromVMTopology
(
vmTopologyMap
);
String
operation
=
nodeDesiredState
.
toString
().
toLowerCase
();
Map
<
String
,
Object
>
inputs
=
(
Map
<
String
,
Object
>)
provisionInterface
.
get
(
operation
);
...
...
@@ -317,17 +327,18 @@ class CloudStormService {
CloudsStormInfrasCode
cloudsStormInfrasCode
=
new
CloudsStormInfrasCode
();
cloudsStormInfrasCode
.
setMode
(
CloudsStormInfrasCode
.
ModeEnum
.
LOCAL
);
cloudsStormInfrasCode
.
setInfrasCodes
(
infrasCodes
);
objectMapper
.
writeValue
(
new
File
(
infrasCodeTempInputDirPath
+
File
.
separator
+
"infrasCode.yml"
),
cloudsStormInfrasCode
);
File
infrasCodeFile
=
new
File
(
infrasCodeTempInputDirPath
+
File
.
separator
+
INFRASTUCTURE_CODE_FILE_NAME
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Wrote infrasCode file: {0}"
,
infrasCodeFile
.
getAbsolutePath
());
objectMapper
.
writeValue
(
infrasCodeFile
,
cloudsStormInfrasCode
);
}
pr
ivate
void
writeCloudStormProvidersDBFiles
(
String
tempInputDirPath
)
throws
IOException
{
pr
otected
void
writeCloudStormProvidersDBFiles
(
String
tempInputDirPath
)
throws
IOException
{
File
srcDir
=
new
File
(
cloudStormDBPath
);
File
destDir
=
new
File
(
tempInputDirPath
);
FileUtils
.
copyDirectory
(
srcDir
,
destDir
);
}
pr
ivate
ToscaTemplate
runCloudStorm
(
String
tempInputDirPath
)
throws
IOException
,
ApiException
{
pr
otected
ToscaTemplate
runCloudStorm
(
String
tempInputDirPath
)
throws
IOException
,
ApiException
{
String
[]
args
=
new
String
[]{
"run"
,
tempInputDirPath
};
standalone
.
MainAsTool
.
main
(
args
);
// tempInputDirPath = "/tmp/Input-26386504078656";
...
...
@@ -347,7 +358,7 @@ class CloudStormService {
if
(
att
==
null
)
{
att
=
new
HashMap
<>();
}
att
.
put
(
"status"
,
subTopology
.
getStatus
().
toString
(
));
helper
.
setNodeCurrentState
(
vmTopologyMap
,
cloudStormStatus2NodeState
(
subTopology
.
getStatus
()
));
String
rootKeyPairFolder
=
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
+
File
.
separator
+
subTopology
.
getSshKeyPairId
();
...
...
@@ -413,4 +424,17 @@ class CloudStormService {
return
vector
;
}
protected
KeyPair
getKeyPair
()
throws
ApiException
,
TypeExeption
,
JSchException
{
KeyPair
keyPair
=
null
;
List
<
NodeTemplateMap
>
vmTopologyTemplatesMap
=
helper
.
getVMTopologyTemplates
();
for
(
NodeTemplateMap
nodeTemplateMap
:
vmTopologyTemplatesMap
)
{
List
<
NodeTemplateMap
>
vmTemplatesMap
=
helper
.
getTemplateVMsForVMTopology
(
nodeTemplateMap
);
for
(
NodeTemplateMap
vmMap
:
vmTemplatesMap
)
{
keyPair
=
helper
.
getKeyPairsFromVM
(
vmMap
.
getNodeTemplate
());
break
;
}
}
return
keyPair
;
}
}
provisioner/src/main/java/nl/uva/sne/drip/provisioner/RPCServer.java
View file @
2bbc0d82
...
...
@@ -35,45 +35,43 @@ import java.util.logging.Logger;
*/
public
class
RPCServer
{
private
static
Properties
prop
;
public
static
void
main
(
String
[]
argv
)
throws
MalformedURLException
{
prop
=
new
Properties
();
if
(
argv
.
length
>=
1
)
{
try
{
prop
.
load
(
new
FileInputStream
(
argv
[
0
]));
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
else
{
String
resourceName
=
"application.properties"
;
ClassLoader
loader
=
Thread
.
currentThread
().
getContextClassLoader
();
try
(
InputStream
resourceStream
=
loader
.
getResourceAsStream
(
resourceName
))
{
prop
.
load
(
resourceStream
);
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
/**
* @return the prop
*/
public
static
Properties
getProp
()
{
return
prop
;
}
/**
* @param aProp the prop to set
*/
public
static
void
setProp
(
Properties
aProp
)
{
prop
=
aProp
;
}
private
static
Properties
prop
;
public
static
void
main
(
String
[]
argv
)
throws
MalformedURLException
{
init
(
argv
);
start
();
}
private
static
void
start
()
{
ConnectionFactory
factory
=
new
ConnectionFactory
();
factory
.
setHost
(
prop
.
getProperty
(
"message.broker.host"
));
factory
.
setPassword
(
prop
.
getProperty
(
"message.broker.username"
));
factory
.
setUsername
(
prop
.
getProperty
(
"message.broker.password"
));
factory
.
setHost
(
getProp
()
.
getProperty
(
"message.broker.host"
));
factory
.
setPassword
(
getProp
()
.
getProperty
(
"message.broker.username"
));
factory
.
setUsername
(
getProp
()
.
getProperty
(
"message.broker.password"
));
factory
.
setPort
(
AMQP
.
PROTOCOL
.
PORT
);
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Connected to: {0}"
,
prop
.
getProperty
(
"message.broker.host"
));
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Connected to: {0}"
,
getProp
()
.
getProperty
(
"message.broker.host"
));
try
(
Connection
connection
=
factory
.
newConnection
())
{
Channel
channel
=
connection
.
createChannel
();
//We define the queue name
channel
.
queueDeclare
(
prop
.
getProperty
(
"message.broker.queue.provisioner"
,
"provisioner"
),
false
,
false
,
false
,
null
);
channel
.
queueDeclare
(
getProp
()
.
getProperty
(
"message.broker.queue.provisioner"
,
"provisioner"
),
false
,
false
,
false
,
null
);
DefaultConsumer
c
;
c
=
new
nl
.
uva
.
sne
.
drip
.
provisioner
.
Consumer
(
channel
,
prop
);
c
=
new
nl
.
uva
.
sne
.
drip
.
provisioner
.
Consumer
(
channel
,
getProp
()
);
//Start listening for messages
channel
.
basicConsume
(
prop
.
getProperty
(
"message.broker.queue.provisioner"
,
"provisioner"
),
false
,
c
);
channel
.
basicConsume
(
getProp
()
.
getProperty
(
"message.broker.queue.provisioner"
,
"provisioner"
),
false
,
c
);
//Block so we don't close the channel
while
(
true
)
{
...
...
@@ -92,4 +90,23 @@ public class RPCServer {
}
public
static
void
init
(
String
[]
argv
)
{
setProp
(
new
Properties
());
if
(
argv
.
length
>=
1
)
{
try
{
getProp
().
load
(
new
FileInputStream
(
argv
[
0
]));
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
else
{
String
resourceName
=
"application.properties"
;
ClassLoader
loader
=
Thread
.
currentThread
().
getContextClassLoader
();
try
(
InputStream
resourceStream
=
loader
.
getResourceAsStream
(
resourceName
))
{
getProp
().
load
(
resourceStream
);
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
}
}
provisioner/src/test/java/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
0 → 100644
View file @
2bbc0d82
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
nl
.
uva
.
sne
.
drip
.
provisioner
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.jcraft.jsch.KeyPair
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
nl.uva.sne.drip.model.Message
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
APP_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
INFRASTUCTURE_CODE_FILE_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
INFS_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
TOPOLOGY_RELATIVE_PATH
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
TOP_TOPOLOGY_FILE_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
UC_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
UD_FOLDER_NAME
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
org.junit.After
;
import
org.junit.AfterClass
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
/**
*
* @author alogo
*/
public
class
CloudStormServiceTest
{
private
static
final
String
messageExampleDeleteRequestFilePath
=
".."
+
File
.
separator
+
"example_messages"
+
File
.
separator
+
"message_example_provisioned.json"
;
private
static
final
String
messageExampleProvisioneRequestFilePath
=
".."
+
File
.
separator
+
"example_messages"
+
File
.
separator
+
"message_provision_request.json"
;
private
final
ObjectMapper
objectMapper
;
private
String
tempInputDirPath
;
private
String
topologyTempInputDirPath
;
private
String
sureToscaBasePath
;
private
File
tempInputDir
;
private
File
topologyTempInputDir
;
private
String
infrasCodeTempInputDirPath
;
private
String
credentialsTempInputDirPath
;
private
String
providersDBTempInputDirPath
;
public
CloudStormServiceTest
()
{
this
.
objectMapper
=
new
ObjectMapper
();
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
}
@BeforeClass
public
static
void
setUpClass
()
{
}
@AfterClass
public
static
void
tearDownClass
()
{
}
@Before
public
void
setUp
()
throws
IOException
,
JsonProcessingException
,
ApiException
{
String
[]
argv
=
new
String
[
0
];
RPCServer
.
init
(
argv
);
sureToscaBasePath
=
RPCServer
.
getProp
().
getProperty
(
"sure-tosca.base.path"
);
initPaths
();
}
@After
public
void
tearDown
()
{
}
// /**
// * Test of execute method, of class CloudStormService.
// */
// @Test
// public void testExecute() throws Exception {
// System.out.println("execute");
// CloudStormService instance = null;
// ToscaTemplate expResult = null;
// ToscaTemplate result = instance.execute();
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of writeCloudStormTopologyFiles method, of class CloudStormService.
// */
// @Test
// public void testWriteCloudStormTopologyFiles() throws Exception {
// System.out.println("writeCloudStormTopologyFiles");
// Map<String, Object> result = instance.writeCloudStormTopologyFiles(tempInputDirPath);
// assertNull(result);
// }
//
// /**
// * Test of buildSSHKeyPair method, of class CloudStormService.
// */
// @Test
// public void testBuildSSHKeyPair() throws Exception {
// System.out.println("buildSSHKeyPair");
// String result = instance.buildSSHKeyPair(tempInputDirPath, null);
// assertNotNull(result);
// String userPublicKeyName = "id_rsa.pub";
// String userPrivateName = FilenameUtils.removeExtension(userPublicKeyName);
// assertTrue(new File(tempInputDirPath + File.separator + userPrivateName).exists());
// assertTrue(new File(tempInputDirPath + File.separator + userPublicKeyName).exists());
//
// }
//
// /**
// * Test of getCloudsStormSubTopologiesAndVMs method, of class
// * CloudStormService.
// */
// @Test
// public void testGetCloudsStormSubTopologiesAndVMs() throws Exception {
// System.out.println("getCloudsStormSubTopologiesAndVMs");
// String tempInputDirPath = "";
// CloudStormService instance = null;
// Map<String, Object> expResult = null;
// Map<String, Object> result = instance.getCloudsStormSubTopologiesAndVMs(tempInputDirPath);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getBestMatchingCloudStormVM method, of class CloudStormService.
// */
// @Test
// public void testGetBestMatchingCloudStormVM() throws Exception {
// System.out.println("getBestMatchingCloudStormVM");
// NodeTemplateMap vmMap = null;
// String provider = "";
// CloudStormService instance = null;
// CloudsStormVM expResult = null;
// CloudsStormVM result = instance.getBestMatchingCloudStormVM(vmMap, provider);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of writeCloudStormCredentialsFiles method, of class
// * CloudStormService.
// */
// @Test
// public void testWriteCloudStormCredentialsFiles() throws Exception {
// System.out.println("writeCloudStormCredentialsFiles");
// String credentialsTempInputDirPath = "";
// CloudStormService instance = null;
// instance.writeCloudStormCredentialsFiles(credentialsTempInputDirPath);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getCloudStormCredentialInfo method, of class CloudStormService.
// */
// @Test
// public void testGetCloudStormCredentialInfo() throws Exception {
// System.out.println("getCloudStormCredentialInfo");
// Credential toscaCredentials = null;
// String tmpPath = "";
// CloudStormService instance = null;
// CredentialInfo expResult = null;
// CredentialInfo result = instance.getCloudStormCredentialInfo(toscaCredentials, tmpPath);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
/**
* Test of writeCloudStormInfrasCodeFiles method, of class
* CloudStormService.
*/
@Test
public
void
testWriteCloudStormInfrasCodeFiles
()
throws
Exception
{
if
(
ToscaHelper
.
isServiceUp
(
sureToscaBasePath
))
{
System
.
out
.
println
(
"writeCloudStormInfrasCodeFiles"
);
CloudStormService
instance
=
getService
(
messageExampleProvisioneRequestFilePath
);
Map
<
String
,
Object
>
subTopologiesAndVMs
=
instance
.
writeCloudStormTopologyFiles
(
topologyTempInputDirPath
);
assertNotNull
(
subTopologiesAndVMs
);
assertTrue
(
new
File
(
topologyTempInputDirPath
+
File
.
separator
+
TOP_TOPOLOGY_FILE_NAME
).
exists
());
List
<
CloudsStormSubTopology
>
cloudStormSubtopologies
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
instance
.
writeCloudStormInfrasCodeFiles
(
infrasCodeTempInputDirPath
,
cloudStormSubtopologies
);
assertTrue
(
new
File
(
infrasCodeTempInputDirPath
+
File
.
separator
+
INFRASTUCTURE_CODE_FILE_NAME
).
exists
());
instance
=
getService
(
messageExampleDeleteRequestFilePath
);
subTopologiesAndVMs
=
instance
.
writeCloudStormTopologyFiles
(
topologyTempInputDirPath
);
assertNotNull
(
subTopologiesAndVMs
);
assertTrue
(
new
File
(
topologyTempInputDirPath
+
File
.
separator
+
TOP_TOPOLOGY_FILE_NAME
).
exists
());
cloudStormSubtopologies
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
instance
.
writeCloudStormInfrasCodeFiles
(
infrasCodeTempInputDirPath
,
cloudStormSubtopologies
);
assertTrue
(
new
File
(
infrasCodeTempInputDirPath
+
File
.
separator
+
INFRASTUCTURE_CODE_FILE_NAME
).
exists
());
}
}
/**
* Test of getKeyPair method, of class CloudStormService.
*/
@Test
public
void
testGetKeyPair
()
throws
Exception
{
if
(
ToscaHelper
.
isServiceUp
(
sureToscaBasePath
))
{
System
.
out
.
println
(
"getKeyPair"
);
CloudStormService
instance
=
getService
(
messageExampleProvisioneRequestFilePath
);
KeyPair
result
=
instance
.
getKeyPair
();
assertNull
(
result
);
instance
=
getService
(
messageExampleDeleteRequestFilePath
);
result
=
instance
.
getKeyPair
();
assertNotNull
(
result
);
}
}
private
void
initPaths
()
throws
FileNotFoundException
{
tempInputDirPath
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
File
.
separator
+
"Input-"
+
Long
.
toString
(
System
.
nanoTime
())
+
File
.
separator
;
tempInputDir
=
new
File
(
tempInputDirPath
);
if
(!(
tempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
tempInputDir
.
getAbsolutePath
());
}
topologyTempInputDirPath
=
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
;
topologyTempInputDir
=
new
File
(
topologyTempInputDirPath
);
if
(!(
topologyTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
}
credentialsTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
INFS_FOLDER_NAME
+
File
.
separator
+
UC_FOLDER_NAME
;
File
credentialsTempInputDir
=
new
File
(
credentialsTempInputDirPath
);
if
(!(
credentialsTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
credentialsTempInputDir
.
getAbsolutePath
());
}
providersDBTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
INFS_FOLDER_NAME
+
File
.
separator
+
UD_FOLDER_NAME
;
File
providersDBTempInputDir
=
new
File
(
providersDBTempInputDirPath
);
if
(!(
providersDBTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
providersDBTempInputDir
.
getAbsolutePath
());
}
infrasCodeTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
APP_FOLDER_NAME
;
File
infrasCodeTempInputDir
=
new
File
(
infrasCodeTempInputDirPath
);
if
(!(
infrasCodeTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
}
}
private
CloudStormService
getService
(
String
messagefilePath
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
Message
message
=
objectMapper
.
readValue
(
new
File
(
messagefilePath
),
Message
.
class
);
return
new
CloudStormService
(
RPCServer
.
getProp
(),
message
.
getToscaTemplate
());
}
}
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