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
6e2537d0
Commit
6e2537d0
authored
Jan 02, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cloud storm DB and test credential service
parent
1e678e59
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
133 additions
and
47 deletions
+133
-47
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+25
-22
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+3
-2
ToscaTemplateService.java
...in/java/nl/uva/sne/drip/service/ToscaTemplateService.java
+2
-0
ServiceTests.java
...r/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
+54
-0
ExoGENI.yml
drip-provisioner/etc/UD/ExoGENI.yml
+41
-21
pom.xml
drip-provisioner/pom.xml
+1
-1
CloudStormDAO.java
.../main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
+2
-0
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+3
-1
Consumer.java
...r/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java
+2
-0
test-geni.jks
fake_credentials/test-geni.jks
+0
-0
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
6e2537d0
...
...
@@ -15,6 +15,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
utils
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
...
...
@@ -70,6 +71,8 @@ public class ToscaHelper {
api
=
new
DefaultApi
(
Configuration
.
getDefaultApiClient
());
this
.
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
}
public
void
uploadToscaTemplate
(
ToscaTemplate
toscaTemplate
)
throws
JsonProcessingException
,
IOException
,
ApiException
{
...
...
drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
View file @
6e2537d0
...
...
@@ -15,6 +15,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
utils
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
...
...
@@ -70,6 +71,8 @@ public class ToscaHelperTest {
byte
[]
bytes
=
Files
.
readAllBytes
(
Paths
.
get
(
testUpdatedApplicationExampleToscaFilePath
));
String
ymlStr
=
new
String
(
bytes
,
"UTF-8"
);
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
toscaTemplate
=
objectMapper
.
readValue
(
ymlStr
,
ToscaTemplate
.
class
);
String
serviceBasePath
=
prop
.
getProperty
(
"sure-tosca.base.path"
);
serviceUp
=
isServiceUp
(
serviceBasePath
);
...
...
@@ -228,7 +231,6 @@ public class ToscaHelperTest {
String
operation
=
"provision"
;
// for (NodeTemplateMap vmTopologyMap : vmTopologies) {
// Map<String, Object> provisionInterface = instance.getProvisionInterface(provisioner, operation);
// List<String> objects = new ArrayList<>();
// objects.add("subtopology");
...
...
@@ -249,7 +251,6 @@ public class ToscaHelperTest {
// topology_1 = toscaTemplateWithCredentials.getTopologyTemplate().getNodeTemplates().get("topology_1");
//
// topology = toscaTemplateWithCredentials.getTopologyTemplate().getNodeTemplates().get("topology");
instance
.
uploadToscaTemplate
(
toscaTemplate
);
}
}
...
...
drip-manager/src/main/java/nl/uva/sne/drip/service/ToscaTemplateService.java
View file @
6e2537d0
...
...
@@ -5,6 +5,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
service
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
...
...
@@ -33,6 +34,7 @@ public class ToscaTemplateService {
public
ToscaTemplateService
()
{
this
.
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
}
@Autowired
...
...
drip-manager/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
View file @
6e2537d0
...
...
@@ -28,12 +28,18 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.NoSuchElementException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.xml.bind.DatatypeConverter
;
import
nl.uva.sne.drip.Swagger2SpringBoot
;
import
nl.uva.sne.drip.configuration.MongoConfig
;
import
nl.uva.sne.drip.model.tosca.Credential
;
...
...
@@ -62,6 +68,7 @@ public class ServiceTests {
private
static
final
String
testApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_updated.yaml"
;
private
static
final
String
testUpdatedApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_updated.yaml"
;
private
static
final
String
testOutputApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_updated.yaml"
;
private
static
final
String
testCredentialPath
=
".."
+
File
.
separator
+
"fake_credentials"
+
File
.
separator
+
"test-geni.jks"
;
@Autowired
CredentialService
credentialService
;
...
...
@@ -264,6 +271,53 @@ public class ServiceTests {
saveCredential
();
}
@Test
public
void
testCredentialService
()
throws
IOException
,
NoSuchAlgorithmException
{
Logger
.
getLogger
(
ServiceTests
.
class
.
getName
()).
log
(
Level
.
INFO
,
"testCredentialService"
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
md
.
update
(
Files
.
readAllBytes
(
Paths
.
get
(
testCredentialPath
)));
byte
[]
digest
=
md
.
digest
();
String
fileChecksum
=
DatatypeConverter
.
printHexBinary
(
digest
).
toUpperCase
();
String
keyStore
=
new
String
(
Files
.
readAllBytes
(
Paths
.
get
(
testCredentialPath
)));
byte
[]
encodedBytes
=
Base64
.
getEncoder
().
encode
(
keyStore
.
getBytes
());
String
keyStoreEncoded
=
new
String
(
encodedBytes
,
"UTF-8"
);
Credential
credential
=
new
Credential
();
credential
.
setCloudProviderName
(
"exogeni"
);
Map
<
String
,
String
>
keys
=
new
HashMap
<>();
keys
.
put
(
"keystore"
,
keyStoreEncoded
);
credential
.
setKeys
(
keys
);
credential
.
setToken
(
"1234"
);
credential
.
setTokenType
(
"password"
);
credential
.
setUser
(
"user"
);
byte
[]
decodedBytes
=
Base64
.
getDecoder
().
decode
(
keys
.
get
(
"keystore"
));
md
=
MessageDigest
.
getInstance
(
"MD5"
);
md
.
update
(
decodedBytes
);
digest
=
md
.
digest
();
String
credentialChecksum
=
DatatypeConverter
.
printHexBinary
(
digest
).
toUpperCase
();
assertEquals
(
fileChecksum
,
credentialChecksum
);
HashMap
<
Object
,
Object
>
att
=
new
HashMap
<>();
Map
<
String
,
Object
>
toscaCredential
=
new
HashMap
<>();
toscaCredential
.
put
(
"protocol"
,
credential
.
getProtocol
());
toscaCredential
.
put
(
"token_type"
,
credential
.
getTokenType
());
toscaCredential
.
put
(
"token"
,
credential
.
getToken
());
toscaCredential
.
put
(
"keys"
,
credential
.
getKeys
());
toscaCredential
.
put
(
"user"
,
credential
.
getUser
());
toscaCredential
.
put
(
"cloud_provider_name"
,
credential
.
getCloudProviderName
());
att
.
put
(
"credential"
,
toscaCredential
);
}
public
String
saveCredential
()
{
Logger
.
getLogger
(
ServiceTests
.
class
.
getName
()).
log
(
Level
.
INFO
,
"saveCredential"
);
Credential
document
=
new
Credential
();
...
...
drip-provisioner/etc/UD/ExoGENI.yml
View file @
6e2537d0
...
...
@@ -51,6 +51,26 @@ DCMetaInfo:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
4
MEM
:
12
VMType
:
"
XOXLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
2
MEM
:
6
VMType
:
"
XOLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
50
-
domain
:
"
BBN/GPO
(Boston,
MA
USA)
XO
Rack"
endpoint
:
"
bbnvmsite.rdf#bbnvmsite"
country
:
USA
...
...
@@ -100,6 +120,26 @@ DCMetaInfo:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
4
MEM
:
12
VMType
:
"
XOXLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
2
MEM
:
6
VMType
:
"
XOLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
50
-
domain
:
"
NICTA
(Sydney,
Australia)
XO
Rack"
endpoint
:
"
nictavmsite.rdf#nictavmsite"
country
:
AUS
...
...
@@ -835,23 +875,3 @@ DCMetaInfo:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
4
MEM
:
12
VMType
:
"
XOXLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
2
MEM
:
6
VMType
:
"
XOLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
50
drip-provisioner/pom.xml
View file @
6e2537d0
...
...
@@ -63,7 +63,7 @@
<dependency>
<groupId>
nl.uva.sne.zh
</groupId>
<artifactId>
CloudsStorm
</artifactId>
<version>
1.0
</version>
<version>
b.
1.0
</version>
</dependency>
</dependencies>
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
View file @
6e2537d0
...
...
@@ -5,6 +5,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
provisioner
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
...
...
@@ -34,6 +35,7 @@ class CloudStormDAO {
this
.
cloudStormDBPath
=
cloudStormDBPath
;
this
.
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
}
List
<
VMMetaInfo
>
findVmMetaInfoByProvider
(
CloudDB
.
CloudProviderEnum
provider
)
throws
IOException
{
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
6e2537d0
...
...
@@ -5,6 +5,7 @@
*/
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
;
...
...
@@ -69,6 +70,7 @@ class CloudStormService {
this
.
helper
.
uploadToscaTemplate
(
toscaTemplate
);
this
.
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
}
public
ToscaTemplate
execute
()
throws
FileNotFoundException
,
JSchException
,
IOException
,
ApiException
,
Exception
{
...
...
@@ -218,7 +220,7 @@ class CloudStormService {
}
CloudCredentialDB
cloudStormCredentials
=
new
CloudCredentialDB
();
cloudStormCredentials
.
setCloudCreds
(
cloudStormCredentialList
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"
CloudStormCredentials
.yml"
),
cloudStormCredentials
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"
cred
.yml"
),
cloudStormCredentials
);
}
private
CredentialInfo
getCloudStormCredentialInfo
(
Credential
toscaCredentials
,
String
tmpPath
)
throws
FileNotFoundException
{
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java
View file @
6e2537d0
...
...
@@ -15,6 +15,7 @@
*/
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
;
...
...
@@ -55,6 +56,7 @@ public class Consumer extends DefaultConsumer {
logger
=
Logger
.
getLogger
(
Consumer
.
class
.
getName
());
this
.
objectMapper
=
new
ObjectMapper
();
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
}
@Override
...
...
fake_credentials/test-geni.jks
0 → 100644
View file @
6e2537d0
File added
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