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
483fa864
Commit
483fa864
authored
Mar 20, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed status. It is now set as current state
parent
98c7bd7a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
186 deletions
+106
-186
.nodes.yaml.kate-swp
TOSCA/types/.nodes.yaml.kate-swp
+0
-0
nodes.yaml
TOSCA/types/nodes.yaml
+4
-0
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+0
-10
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+0
-19
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+0
-1
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+1
-1
CloudStormServiceTest.java
...va/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
+101
-155
No files found.
TOSCA/types/.nodes.yaml.kate-swp
deleted
100644 → 0
View file @
98c7bd7a
File deleted
TOSCA/types/nodes.yaml
View file @
483fa864
...
@@ -155,6 +155,10 @@ node_types:
...
@@ -155,6 +155,10 @@ node_types:
ssh_keys
:
ssh_keys
:
type
:
tosca.datatypes.ARTICONF.Credential
type
:
tosca.datatypes.ARTICONF.Credential
required
:
false
required
:
false
artifacts
:
provisioned_files
:
type
:
string
required
:
false
interfaces
:
interfaces
:
CloudsStorm
:
CloudsStorm
:
type
:
tosca.interfaces.ARTICONF.CloudsStorm
type
:
tosca.interfaces.ARTICONF.CloudsStorm
...
...
commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
483fa864
...
@@ -290,16 +290,6 @@ public class ToscaHelper {
...
@@ -290,16 +290,6 @@ public class ToscaHelper {
return
"vm_user"
;
return
"vm_user"
;
}
}
public
CloudsStormSubTopology
.
StatusEnum
getVMTopologyTemplateStatus
(
NodeTemplateMap
nodeTemplateMap
)
throws
TypeExeption
{
NodeTemplate
nodeTemplate
=
nodeTemplateMap
.
getNodeTemplate
();
if
(
nodeTemplate
.
getType
().
equals
(
VM_TOPOLOGY
))
{
String
status
=
(
String
)
nodeTemplate
.
getAttributes
().
get
(
"status"
);
return
CloudsStormSubTopology
.
StatusEnum
.
fromValue
(
status
);
}
else
{
throw
new
TypeExeption
(
"NodeTemplateMap is not of type: "
+
VM_TOPOLOGY
+
" it is of type: "
+
nodeTemplate
.
getType
());
}
}
public
NODE_STATES
getNodeCurrentState
(
NodeTemplateMap
node
)
{
public
NODE_STATES
getNodeCurrentState
(
NodeTemplateMap
node
)
{
return
getNodeState
(
node
,
"current_state"
);
return
getNodeState
(
node
,
"current_state"
);
}
}
...
...
commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
View file @
483fa864
...
@@ -420,25 +420,6 @@ public class ToscaHelperTest {
...
@@ -420,25 +420,6 @@ public class ToscaHelperTest {
}
}
}
}
/**
* Test of getVMTopologyTemplateStatus method, of class ToscaHelper.
*/
@Test
public
void
testGetVMTopologyTemplateStatus
()
throws
Exception
{
if
(
serviceUp
)
{
System
.
out
.
println
(
"getVMTopologyTemplateStatus"
);
toscaTemplateWithCredentials
=
null
;
instance
.
uploadToscaTemplate
(
provisionedToscaTemplate
);
List
<
NodeTemplateMap
>
vmTopologies
=
instance
.
getVMTopologyTemplates
();
for
(
NodeTemplateMap
vmTopology
:
vmTopologies
)
{
CloudsStormSubTopology
.
StatusEnum
status
=
instance
.
getVMTopologyTemplateStatus
(
vmTopology
);
assertEquals
(
CloudsStormSubTopology
.
StatusEnum
.
RUNNING
,
status
);
}
}
}
/**
/**
* Test of getKeyPairsFromVM method, of class ToscaHelper.
* Test of getKeyPairsFromVM method, of class ToscaHelper.
...
...
manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
483fa864
...
@@ -160,7 +160,6 @@ public class DRIPService {
...
@@ -160,7 +160,6 @@ public class DRIPService {
if
(
nodeNames
==
null
||
nodeNames
.
isEmpty
())
{
if
(
nodeNames
==
null
||
nodeNames
.
isEmpty
())
{
List
<
NodeTemplateMap
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
List
<
NodeTemplateMap
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
for
(
NodeTemplateMap
vmTopology
:
vmTopologies
)
{
for
(
NodeTemplateMap
vmTopology
:
vmTopologies
)
{
CloudsStormSubTopology
.
StatusEnum
status
=
helper
.
getVMTopologyTemplateStatus
(
vmTopology
);
toscaTemplate
=
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
NODE_STATES
.
DELETED
);
toscaTemplate
=
setDesieredSate
(
toscaTemplate
,
vmTopologies
,
NODE_STATES
.
DELETED
);
}
}
return
execute
(
toscaTemplate
,
provisionerQueueName
);
return
execute
(
toscaTemplate
,
provisionerQueueName
);
...
...
provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
483fa864
provisioner/src/test/java/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
View file @
483fa864
...
@@ -26,12 +26,8 @@ import nl.uva.sne.drip.model.NodeTemplateMap;
...
@@ -26,12 +26,8 @@ import nl.uva.sne.drip.model.NodeTemplateMap;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormInfrasCode
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormInfrasCode
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology
;
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.CloudsStormTopTopology
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVM
;
import
nl.uva.sne.drip.model.cloud.storm.CredentialInfo
;
import
nl.uva.sne.drip.model.cloud.storm.InfrasCode
;
import
nl.uva.sne.drip.model.cloud.storm.InfrasCode
;
import
nl.uva.sne.drip.model.cloud.storm.OpCode
;
import
nl.uva.sne.drip.model.cloud.storm.OpCode
;
import
nl.uva.sne.drip.model.tosca.Credential
;
import
nl.uva.sne.drip.model.tosca.ToscaTemplate
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
APP_FOLDER_NAME
;
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
.
INFRASTUCTURE_CODE_FILE_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
INFS_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
INFS_FOLDER_NAME
;
...
@@ -41,6 +37,7 @@ import static nl.uva.sne.drip.provisioner.CloudStormService.TOP_TOPOLOGY_FILE_NA
...
@@ -41,6 +37,7 @@ import static nl.uva.sne.drip.provisioner.CloudStormService.TOP_TOPOLOGY_FILE_NA
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
UC_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
UC_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
UD_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
UD_FOLDER_NAME
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
org.apache.commons.io.FilenameUtils
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.AfterClass
;
import
org.junit.AfterClass
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -93,106 +90,90 @@ public class CloudStormServiceTest {
...
@@ -93,106 +90,90 @@ public class CloudStormServiceTest {
public
void
tearDown
()
{
public
void
tearDown
()
{
}
}
// /**
private
void
initPaths
()
throws
FileNotFoundException
{
// * Test of execute method, of class CloudStormService.
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
());
}
/**
* Test of execute method, of class CloudStormService.
*/
// @Test
// @Test
// public void testExecute() throws Exception {
// public void testExecute() throws Exception {
// if (ToscaHelper.isServiceUp(sureToscaBasePath)) {
// System.out.println("execute");
// System.out.println("execute");
// CloudStormService instance = null;
// CloudStormService instance = getService(messageExampleProvisioneRequestFilePath);
// ToscaTemplate expResult = null;
// instance.execute();
// 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 writeCloudStormTopologyFiles method, of class CloudStormService.
*/
@Test
public
void
testWriteCloudStormTopologyFiles
()
throws
Exception
{
System
.
out
.
println
(
"writeCloudStormTopologyFiles"
);
CloudStormService
instance
=
getService
(
messageExampleProvisioneRequestFilePath
);
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"
);
CloudStormService
instance
=
getService
(
messageExampleProvisioneRequestFilePath
);
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
());
instance
=
getService
(
messageExampleDeleteRequestFilePath
);
result
=
instance
.
buildSSHKeyPair
(
tempInputDirPath
,
null
);
assertNotNull
(
result
);
userPublicKeyName
=
"id_rsa.pub"
;
userPrivateName
=
FilenameUtils
.
removeExtension
(
userPublicKeyName
);
assertTrue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
userPrivateName
).
exists
());
assertTrue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
userPublicKeyName
).
exists
());
}
/**
/**
* Test of writeCloudStormInfrasCodeFiles method, of class
* Test of writeCloudStormInfrasCodeFiles method, of class
* CloudStormService.
* CloudStormService.
...
@@ -227,42 +208,7 @@ public class CloudStormServiceTest {
...
@@ -227,42 +208,7 @@ public class CloudStormServiceTest {
}
}
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
());
}
private
void
testWriteCloudStormInfrasFiles
(
String
path
,
CloudsStormSubTopology
.
StatusEnum
status
,
OpCode
.
OperationEnum
opCode
)
throws
IOException
,
JsonProcessingException
,
ApiException
,
Exception
{
private
void
testWriteCloudStormInfrasFiles
(
String
path
,
CloudsStormSubTopology
.
StatusEnum
status
,
OpCode
.
OperationEnum
opCode
)
throws
IOException
,
JsonProcessingException
,
ApiException
,
Exception
{
CloudStormService
instance
=
getService
(
path
);
CloudStormService
instance
=
getService
(
path
);
...
...
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