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
3890b724
Commit
3890b724
authored
Dec 24, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cloud storm credentials
parent
29d9500f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
469 additions
and
29 deletions
+469
-29
CloudCredential.java
...va/nl/uva/sne/drip/model/cloud/storm/CloudCredential.java
+103
-0
CloudCredentials.java
...a/nl/uva/sne/drip/model/cloud/storm/CloudCredentials.java
+90
-0
CredentialInfo.java
...ava/nl/uva/sne/drip/model/cloud/storm/CredentialInfo.java
+233
-0
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+1
-1
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+42
-3
cloudCreds.yml
openAPI/schema/CloudStorm/cloudCreds.yml
+0
-7
credInfo.yml
openAPI/schema/CloudStorm/credInfo.yml
+0
-18
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/CloudCredential.java
0 → 100644
View file @
3890b724
package
nl
.
uva
.
sne
.
drip
.
model
.
cloud
.
storm
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
/**
* CloudCredential
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-24T17:07:10.081Z"
)
public
class
CloudCredential
{
@JsonProperty
(
"cloudProvider"
)
private
String
cloudProvider
=
null
;
@JsonProperty
(
"credInfoFile"
)
private
String
credInfoFile
=
null
;
public
CloudCredential
cloudProvider
(
String
cloudProvider
)
{
this
.
cloudProvider
=
cloudProvider
;
return
this
;
}
/**
* Get cloudProvider
*
* @return cloudProvider
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getCloudProvider
()
{
return
cloudProvider
;
}
public
void
setCloudProvider
(
String
cloudProvider
)
{
this
.
cloudProvider
=
cloudProvider
;
}
public
CloudCredential
credInfoFile
(
String
credInfoFile
)
{
this
.
credInfoFile
=
credInfoFile
;
return
this
;
}
/**
* Get credInfoFile
*
* @return credInfoFile
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getCredInfoFile
()
{
return
credInfoFile
;
}
public
void
setCredInfoFile
(
String
credInfoFile
)
{
this
.
credInfoFile
=
credInfoFile
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
CloudCredential
cloudCredential
=
(
CloudCredential
)
o
;
return
Objects
.
equals
(
this
.
cloudProvider
,
cloudCredential
.
cloudProvider
)
&&
Objects
.
equals
(
this
.
credInfoFile
,
cloudCredential
.
credInfoFile
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
cloudProvider
,
credInfoFile
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class CloudCredential {\n"
);
sb
.
append
(
" cloudProvider: "
).
append
(
toIndentedString
(
cloudProvider
)).
append
(
"\n"
);
sb
.
append
(
" credInfoFile: "
).
append
(
toIndentedString
(
credInfoFile
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/CloudCredentials.java
0 → 100644
View file @
3890b724
package
nl
.
uva
.
sne
.
drip
.
model
.
cloud
.
storm
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
/**
* CloudCredentials
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-24T17:07:10.081Z"
)
public
class
CloudCredentials
{
@JsonProperty
(
"CloudCredential"
)
@Valid
private
List
<
CloudCredential
>
cloudCredential
=
null
;
public
CloudCredentials
cloudCredential
(
List
<
CloudCredential
>
cloudCredential
)
{
this
.
cloudCredential
=
cloudCredential
;
return
this
;
}
public
CloudCredentials
addCloudCredentialItem
(
CloudCredential
cloudCredentialItem
)
{
if
(
this
.
cloudCredential
==
null
)
{
this
.
cloudCredential
=
new
ArrayList
<
CloudCredential
>();
}
this
.
cloudCredential
.
add
(
cloudCredentialItem
);
return
this
;
}
/**
* Get cloudCredential
* @return cloudCredential
**/
@ApiModelProperty
(
value
=
""
)
@Valid
public
List
<
CloudCredential
>
getCloudCredential
()
{
return
cloudCredential
;
}
public
void
setCloudCredential
(
List
<
CloudCredential
>
cloudCredential
)
{
this
.
cloudCredential
=
cloudCredential
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
CloudCredentials
cloudCredentials
=
(
CloudCredentials
)
o
;
return
Objects
.
equals
(
this
.
cloudCredential
,
cloudCredentials
.
cloudCredential
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
cloudCredential
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class CloudCredentials {\n"
);
sb
.
append
(
" cloudCredential: "
).
append
(
toIndentedString
(
cloudCredential
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/CredentialInfo.java
0 → 100644
View file @
3890b724
package
nl
.
uva
.
sne
.
drip
.
model
.
cloud
.
storm
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
/**
* CredentialInfo
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-24T17:07:10.081Z"
)
public
class
CredentialInfo
{
@JsonProperty
(
"userKeyName"
)
private
String
userKeyName
=
null
;
@JsonProperty
(
"keyAlias"
)
private
String
keyAlias
=
null
;
@JsonProperty
(
"keyPassword"
)
private
String
keyPassword
=
null
;
@JsonProperty
(
"proxyFileName"
)
private
String
proxyFileName
=
null
;
@JsonProperty
(
"trustedCertDirName"
)
private
String
trustedCertDirName
=
null
;
@JsonProperty
(
"accessKey"
)
private
String
accessKey
=
null
;
@JsonProperty
(
"secretKey"
)
private
String
secretKey
=
null
;
public
CredentialInfo
userKeyName
(
String
userKeyName
)
{
this
.
userKeyName
=
userKeyName
;
return
this
;
}
/**
* Get userKeyName
*
* @return userKeyName
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getUserKeyName
()
{
return
userKeyName
;
}
public
void
setUserKeyName
(
String
userKeyName
)
{
this
.
userKeyName
=
userKeyName
;
}
public
CredentialInfo
keyAlias
(
String
keyAlias
)
{
this
.
keyAlias
=
keyAlias
;
return
this
;
}
/**
* Get keyAlias
*
* @return keyAlias
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getKeyAlias
()
{
return
keyAlias
;
}
public
void
setKeyAlias
(
String
keyAlias
)
{
this
.
keyAlias
=
keyAlias
;
}
public
CredentialInfo
keyPassword
(
String
keyPassword
)
{
this
.
keyPassword
=
keyPassword
;
return
this
;
}
/**
* Get keyPassword
*
* @return keyPassword
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getKeyPassword
()
{
return
keyPassword
;
}
public
void
setKeyPassword
(
String
keyPassword
)
{
this
.
keyPassword
=
keyPassword
;
}
public
CredentialInfo
proxyFileName
(
String
proxyFileName
)
{
this
.
proxyFileName
=
proxyFileName
;
return
this
;
}
/**
* Get proxyFileName
*
* @return proxyFileName
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getProxyFileName
()
{
return
proxyFileName
;
}
public
void
setProxyFileName
(
String
proxyFileName
)
{
this
.
proxyFileName
=
proxyFileName
;
}
public
CredentialInfo
trustedCertDirName
(
String
trustedCertDirName
)
{
this
.
trustedCertDirName
=
trustedCertDirName
;
return
this
;
}
/**
* Get trustedCertDirName
*
* @return trustedCertDirName
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getTrustedCertDirName
()
{
return
trustedCertDirName
;
}
public
void
setTrustedCertDirName
(
String
trustedCertDirName
)
{
this
.
trustedCertDirName
=
trustedCertDirName
;
}
public
CredentialInfo
accessKey
(
String
accessKey
)
{
this
.
accessKey
=
accessKey
;
return
this
;
}
/**
* Get accessKey
*
* @return accessKey
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getAccessKey
()
{
return
accessKey
;
}
public
void
setAccessKey
(
String
accessKey
)
{
this
.
accessKey
=
accessKey
;
}
public
CredentialInfo
secretKey
(
String
secretKey
)
{
this
.
secretKey
=
secretKey
;
return
this
;
}
/**
* Get secretKey
*
* @return secretKey
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getSecretKey
()
{
return
secretKey
;
}
public
void
setSecretKey
(
String
secretKey
)
{
this
.
secretKey
=
secretKey
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
CredentialInfo
credentialInfo
=
(
CredentialInfo
)
o
;
return
Objects
.
equals
(
this
.
userKeyName
,
credentialInfo
.
userKeyName
)
&&
Objects
.
equals
(
this
.
keyAlias
,
credentialInfo
.
keyAlias
)
&&
Objects
.
equals
(
this
.
keyPassword
,
credentialInfo
.
keyPassword
)
&&
Objects
.
equals
(
this
.
proxyFileName
,
credentialInfo
.
proxyFileName
)
&&
Objects
.
equals
(
this
.
trustedCertDirName
,
credentialInfo
.
trustedCertDirName
)
&&
Objects
.
equals
(
this
.
accessKey
,
credentialInfo
.
accessKey
)
&&
Objects
.
equals
(
this
.
secretKey
,
credentialInfo
.
secretKey
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
userKeyName
,
keyAlias
,
keyPassword
,
proxyFileName
,
trustedCertDirName
,
accessKey
,
secretKey
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class CredentialInfo {\n"
);
sb
.
append
(
" userKeyName: "
).
append
(
toIndentedString
(
userKeyName
)).
append
(
"\n"
);
sb
.
append
(
" keyAlias: "
).
append
(
toIndentedString
(
keyAlias
)).
append
(
"\n"
);
sb
.
append
(
" keyPassword: "
).
append
(
toIndentedString
(
keyPassword
)).
append
(
"\n"
);
sb
.
append
(
" proxyFileName: "
).
append
(
toIndentedString
(
proxyFileName
)).
append
(
"\n"
);
sb
.
append
(
" trustedCertDirName: "
).
append
(
toIndentedString
(
trustedCertDirName
)).
append
(
"\n"
);
sb
.
append
(
" accessKey: "
).
append
(
toIndentedString
(
accessKey
)).
append
(
"\n"
);
sb
.
append
(
" secretKey: "
).
append
(
toIndentedString
(
secretKey
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
3890b724
...
...
@@ -52,7 +52,7 @@ public class DRIPService {
if
(
requestQeueName
.
equals
(
"provisioner"
))
{
toscaTemplate
=
addCredentials
(
toscaTemplate
);
}
Logger
.
getLogger
(
DRIPService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"toscaTemplate:\n"
+
toscaTemplate
);
Message
message
=
new
Message
();
message
.
setOwner
(
"user"
);
message
.
setCreationDate
(
System
.
currentTimeMillis
());
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
3890b724
...
...
@@ -16,7 +16,9 @@ import com.jcraft.jsch.KeyPair;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,9 +28,12 @@ import nl.uva.sne.drip.commons.utils.ToscaHelper;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVM
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.NodeTemplateMap
;
import
nl.uva.sne.drip.model.cloud.storm.CloudCredential
;
import
nl.uva.sne.drip.model.cloud.storm.CloudCredentials
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormTopTopology
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVMs
;
import
nl.uva.sne.drip.model.cloud.storm.CredentialInfo
;
import
nl.uva.sne.drip.model.cloud.storm.VMMetaInfo
;
import
nl.uva.sne.drip.model.tosca.Credential
;
import
nl.uva.sne.drip.model.tosca.ToscaTemplate
;
...
...
@@ -176,12 +181,46 @@ class CloudStormService {
private
void
writeCloudStormCredentialsFiles
(
ToscaTemplate
toscaTemplate
,
String
credentialsTempInputDirPath
)
throws
ApiException
,
Exception
{
List
<
NodeTemplateMap
>
vmTopologiesMaps
=
helper
.
getVMTopologyTemplates
();
List
<
CloudCredential
>
cloudStormCredentialList
=
new
ArrayList
<>();
int
i
=
0
;
for
(
NodeTemplateMap
vmTopologyMap
:
vmTopologiesMaps
)
{
Credential
credentials
=
helper
.
getCredentialsFromVMTopology
(
vmTopologyMap
);
Cloudstorm
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"top.yml"
),
credentials
);
Credential
toscaCredentials
=
helper
.
getCredentialsFromVMTopology
(
vmTopologyMap
);
CloudCredential
cloudStormCredential
=
new
CloudCredential
();
cloudStormCredential
.
setCloudProvider
(
toscaCredentials
.
getCloudProviderName
());
String
credInfoFile
=
credentialsTempInputDirPath
+
File
.
separator
+
toscaCredentials
.
getCloudProviderName
()
+
i
+
".yml"
;
cloudStormCredential
.
setCredInfoFile
(
credInfoFile
);
CredentialInfo
cloudStormCredentialInfo
=
getCloudStormCredentialInfo
(
toscaCredentials
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"top.yml"
),
cloudStormCredentialInfo
);
i
++;
}
CloudCredentials
cloudStormCredentials
=
new
CloudCredentials
();
cloudStormCredentials
.
setCloudCredential
(
cloudStormCredentialList
);
}
private
CredentialInfo
getCloudStormCredentialInfo
(
Credential
toscaCredentials
)
throws
FileNotFoundException
{
CredentialInfo
cloudStormCredentialInfo
=
new
CredentialInfo
();
switch
(
toscaCredentials
.
getCloudProviderName
().
toLowerCase
())
{
case
"exogeni"
:
String
base64Keystore
=
toscaCredentials
.
getKeys
().
get
(
"keystore"
);
byte
[]
decoded
=
Base64
.
getDecoder
().
decode
(
base64Keystore
);
try
(
PrintWriter
out
=
new
PrintWriter
(
"user.jks"
))
{
out
.
println
(
new
String
(
decoded
));
}
cloudStormCredentialInfo
.
setUserKeyName
(
"user.jks"
);
cloudStormCredentialInfo
.
setKeyAlias
(
toscaCredentials
.
getUser
());
cloudStormCredentialInfo
.
setKeyPassword
(
toscaCredentials
.
getToken
());
return
cloudStormCredentialInfo
;
case
"ec2"
:
// cloudStormCredentialInfo.setAccessKey(toscaCredentials.get);
return
cloudStormCredentialInfo
;
}
return
null
;
}
}
openAPI/schema/CloudStorm/cloudCreds.yml
deleted
100644 → 0
View file @
29d9500f
cloudCreds
:
type
:
"
object"
properties
:
CloudCredential
:
type
:
"
array"
items
:
$ref
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/CloudCredential.yml#/CloudCredential"
openAPI/schema/CloudStorm/credInfo.yml
deleted
100644 → 0
View file @
29d9500f
CredentialInfo
:
type
:
"
object"
properties
:
userKeyName
:
type
:
"
string"
keyAlias
:
type
:
"
string"
keyPassword
:
type
:
"
string"
proxyFileName
:
type
:
"
string"
trustedCertDirName
:
type
:
"
string"
accessKey
:
type
:
"
string"
secretKey
:
type
:
"
string"
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