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
5d6f23dd
Commit
5d6f23dd
authored
Oct 25, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding interface to topologies
parent
6cef7540
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
ProvisionerService.java
...main/java/nl/uva/sne/drip/service/ProvisionerService.java
+18
-2
ServiceTests.java
...r/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
+6
-3
No files found.
drip-manager/src/main/java/nl/uva/sne/drip/service/ProvisionerService.java
View file @
5d6f23dd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
package
nl
.
uva
.
sne
.
drip
.
service
;
package
nl
.
uva
.
sne
.
drip
.
service
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.TimeoutException
;
...
@@ -43,7 +44,6 @@ public class ProvisionerService {
...
@@ -43,7 +44,6 @@ public class ProvisionerService {
toscaTemplate
=
addProvisionInterface
(
toscaTemplate
);
toscaTemplate
=
addProvisionInterface
(
toscaTemplate
);
return
null
;
return
null
;
}
}
...
@@ -54,11 +54,27 @@ public class ProvisionerService {
...
@@ -54,11 +54,27 @@ public class ProvisionerService {
protected
ToscaTemplate
addProvisionInterface
(
ToscaTemplate
toscaTemplate
)
{
protected
ToscaTemplate
addProvisionInterface
(
ToscaTemplate
toscaTemplate
)
{
List
<
Map
<
String
,
NodeTemplate
>>
vmTopologies
=
getVmTopologies
(
toscaTemplate
);
List
<
Map
<
String
,
NodeTemplate
>>
vmTopologies
=
getVmTopologies
(
toscaTemplate
);
for
(
Map
<
String
,
NodeTemplate
>
vmTopologyMap
:
vmTopologies
)
{
for
(
Map
<
String
,
NodeTemplate
>
vmTopologyMap
:
vmTopologies
)
{
NodeTemplate
vmTopology
=
vmTopologyMap
.
get
(
vmTopologyMap
.
keySet
().
iterator
().
next
());
String
topologyName
=
vmTopologyMap
.
keySet
().
iterator
().
next
();
NodeTemplate
vmTopology
=
vmTopologyMap
.
get
(
topologyName
);
Map
<
String
,
Object
>
interfaces
=
vmTopology
.
getInterfaces
();
Map
<
String
,
Object
>
interfaces
=
vmTopology
.
getInterfaces
();
Map
<
String
,
Object
>
cloudStormInterface
=
getCloudStormProvisionInterface
(
topologyName
);
interfaces
.
put
(
"cloudStorm"
,
cloudStormInterface
);
}
}
return
toscaTemplate
;
return
toscaTemplate
;
}
}
private
Map
<
String
,
Object
>
getCloudStormProvisionInterface
(
String
topologyName
)
{
Map
<
String
,
Object
>
csMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
provisionMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
inputs
=
new
HashMap
<>();
inputs
.
put
(
"code_type"
,
"SEQ"
);
inputs
.
put
(
"object_type"
,
"SubTopology"
);
inputs
.
put
(
"objects"
,
topologyName
);
provisionMap
.
put
(
"inputs"
,
inputs
);
csMap
.
put
(
"provision"
,
provisionMap
);
}
}
}
drip-manager/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
View file @
5d6f23dd
...
@@ -35,8 +35,10 @@ import java.util.NoSuchElementException;
...
@@ -35,8 +35,10 @@ import java.util.NoSuchElementException;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.Swagger2SpringBoot
;
import
nl.uva.sne.drip.Swagger2SpringBoot
;
import
nl.uva.sne.drip.api.ApiException
;
import
nl.uva.sne.drip.configuration.MongoConfig
;
import
nl.uva.sne.drip.configuration.MongoConfig
;
import
nl.uva.sne.drip.model.Credentials
;
import
nl.uva.sne.drip.model.Credentials
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
org.junit.Assert
;
import
org.junit.Assert
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
...
@@ -61,7 +63,7 @@ public class ServiceTests {
...
@@ -61,7 +63,7 @@ public class ServiceTests {
private
String
testApplicationExampleToscaContents
;
private
String
testApplicationExampleToscaContents
;
private
static
final
String
testApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example.yaml"
;
private
static
final
String
testApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example.yaml"
;
private
static
final
String
testUpdatedApplicationExampleToscaFilePath
=
".."
+
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
testOutputApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_
output
.yaml"
;
@Autowired
@Autowired
CredentialService
credentialService
;
CredentialService
credentialService
;
...
@@ -331,11 +333,12 @@ public class ServiceTests {
...
@@ -331,11 +333,12 @@ public class ServiceTests {
@Test
@Test
public
void
testProvisionerServiceProvision
()
{
public
void
testProvisionerServiceProvision
()
throws
FileNotFoundException
,
IOException
,
ApiException
{
FileInputStream
in
=
new
FileInputStream
(
testApplicationExampleToscaFilePath
);
FileInputStream
in
=
new
FileInputStream
(
test
Output
ApplicationExampleToscaFilePath
);
MultipartFile
file
=
new
MockMultipartFile
(
"file"
,
in
);
MultipartFile
file
=
new
MockMultipartFile
(
"file"
,
in
);
toscaTemplateID
=
toscaTemplateService
.
saveFile
(
file
);
toscaTemplateID
=
toscaTemplateService
.
saveFile
(
file
);
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
toscaTemplateService
.
findByID
(
toscaTemplateID
));
provisionService
.
addProvisionInterface
(
toscaTemplate
);
provisionService
.
addProvisionInterface
(
toscaTemplate
);
}
}
...
...
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