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
ec6a10f1
Commit
ec6a10f1
authored
Dec 12, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get available credentials
parent
3310ed45
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
21 deletions
+54
-21
application_example_updated.yaml
TOSCA/application_example_updated.yaml
+1
-0
data.yml
TOSCA/types/data.yml
+10
-0
nodes.yaml
TOSCA/types/nodes.yaml
+1
-3
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+9
-0
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+11
-1
Credential.yml
openAPI/schema/TOSCA/Credential.yml
+22
-17
No files found.
TOSCA/application_example_updated.yaml
View file @
ec6a10f1
...
...
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0
imports
:
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/nodes.yaml
-
data
:
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/capabilities.yaml
-
policies
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/policies.yaml
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/interfaces.yml
...
...
TOSCA/types/data.yml
0 → 100644
View file @
ec6a10f1
tosca_definitions_version
:
tosca_simple_yaml_1_0
data_types
:
tosca.datatypes.ARTICONF.Credential
:
derived_from
:
tosca.datatypes.ARTICONF.Credential
properties
:
cloud_provider_name
:
type
:
string
required
:
true
TOSCA/types/nodes.yaml
View file @
ec6a10f1
...
...
@@ -114,7 +114,7 @@ node_types:
description
:
The name of the provider e.g. EC2, ExoGeni etc.
attributes
:
credential
:
type
:
tosca.datatypes.Credential
type
:
tosca.datatypes.
ARTICONF.
Credential
required
:
false
interfaces
:
Standard
:
...
...
@@ -187,8 +187,6 @@ node_types:
Standard
:
create
:
dumy.yaml
tosca.nodes.ARTICONF.Infrastructure
:
derived_from
:
tosca.nodes.ARTICONF.Root
description
:
Base infrastructure node
...
...
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
ec6a10f1
...
...
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.Map
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.tosca.Credential
;
import
nl.uva.sne.drip.model.tosca.ToscaTemplate
;
import
nl.uva.sne.drip.sure.tosca.client.DefaultApi
;
import
org.apache.commons.io.FileUtils
;
...
...
@@ -174,4 +175,12 @@ public class ToscaHelper {
}
}
public
void
setCredentialsInVMTopology
(
NodeTemplate
vmTopology
,
Credential
credential
)
throws
Exception
{
if
(
vmTopology
.
getType
().
equals
(
VM_TOPOLOGY
))
{
vmTopology
.
getAttributes
();
}
else
{
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TOPOLOGY
+
" it is of type: "
+
vmTopology
.
getType
());
}
}
}
drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
ec6a10f1
...
...
@@ -50,9 +50,15 @@ public class DRIPService {
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
ymlToscaTemplate
);
helper
.
uploadToscaTemplate
(
toscaTemplate
);
List
<
NodeTemplate
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
List
<
Credential
>
credentials
=
null
;
for
(
NodeTemplate
vmTopology
:
vmTopologies
)
{
String
provider
=
helper
.
getTopologyProvider
(
vmTopology
);
List
<
Credential
>
credentials
=
credentialService
.
findByProvider
(
provider
);
credentials
=
credentialService
.
findByProvider
(
provider
.
toLowerCase
());
if
(
credentials
!=
null
&&
credentials
.
size
()
>
0
)
{
Credential
credential
=
getBestCredential
(
vmTopology
,
credentials
);
helper
.
setCredentialsInVMTopology
(
vmTopology
,
credential
);
break
;
}
}
Message
message
=
new
Message
();
...
...
@@ -90,4 +96,8 @@ public class DRIPService {
this
.
requestQeueName
=
requestQeueName
;
}
private
Credential
getBestCredential
(
NodeTemplate
vmTopology
,
List
<
Credential
>
credentials
)
{
return
credentials
.
get
(
0
);
}
}
openAPI/schema/TOSCA/Credential.yml
View file @
ec6a10f1
Credential
:
Credential
:
type
:
"
object"
properties
:
protocol
:
type
:
"
string"
description
:
"
The
optional
protocol
name.
e.g.
http,xauth,oauth2,ssh"
token_type
:
type
:
"
string"
description
:
"
The
required
token
type.
default:
password.
e.g.
basic_auth,X-Auth-Token,
bearer,
identifier"
token
:
type
:
"
string"
description
:
"
The
required
token
used
as
a
credential
for
authorization
or
access
to
a
networked
resource.
e.g.
mypassword,
myusername:mypassword,
604bbe45ac7143a79e14f3158df67091,
keypair_id"
keys
:
type
:
object
additionalProperties
:
type
:
string
description
:
"
The
optional
list
of
protocol-specific
keys
or
assertions."
user
:
type
:
"
string"
description
:
"
The
optional
user
(name
or
ID)
used
for
non-token
based
credentials."
cloud_provider_name
:
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