Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vim instance names #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@
*/
package org.openbaton.integration.test;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Properties;
import org.ini4j.Ini;
import org.ini4j.Profile;
import org.openbaton.integration.test.utils.SubTask;
import org.openbaton.sdk.NFVORequestor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Properties;

/**
* Created by mob on 18.08.15.
*
* <p>
*
* <p>This class loads the test scenario from an .ini file.
*/
public class IntegrationTestManager {
Expand Down Expand Up @@ -106,7 +107,11 @@ private SubTask loadInstance(Properties properties, Profile.Section currentChild
String classNamePath = classPath + "." + nameClass;
Class<?> currentClass = MainIntegrationTest.class.getClassLoader().loadClass(classNamePath);
instance = (SubTask) currentClass.getConstructor(Properties.class).newInstance(properties);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
} catch (ClassNotFoundException
| InstantiationException
| IllegalAccessException
| NoSuchMethodException
| InvocationTargetException e) {
log("Problem during class loading: " + e.getMessage(), "error");
}
return instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.net.URL;
import java.util.*;
import java.util.concurrent.TimeUnit;

import org.openbaton.catalogue.mano.descriptor.NetworkServiceDescriptor;
import org.openbaton.catalogue.mano.descriptor.VirtualNetworkFunctionDescriptor;
import org.openbaton.catalogue.mano.record.NetworkServiceRecord;
Expand Down Expand Up @@ -61,8 +60,7 @@ public class MainIntegrationTest {
* @return The {@code Properties} object filled
* @throws IOException In case of IOException while opening the properties file
*/
private static Properties loadProperties()
throws IOException {
private static Properties loadProperties() throws IOException {

String propertiesFile;
// Checking whether external properties file exists
Expand Down Expand Up @@ -240,7 +238,7 @@ public static void main(String[] args) throws Exception {
String name = splittedUrl[splittedUrl.length - 1];
if (clArgs.size() > 0
&& !clArgs.contains(
name)) // if test names are passed through the command line, only these will be executed
name)) // if test names are passed through the command line, only these will be executed
{
continue;
}
Expand All @@ -254,10 +252,10 @@ public static void main(String[] args) throws Exception {
+ name
+ " finished correctly :) in "
+ String.format(
"%d min, %d sec",
TimeUnit.MILLISECONDS.toMinutes(stopTime),
TimeUnit.MILLISECONDS.toSeconds(stopTime)
- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(stopTime)))
"%d min, %d sec",
TimeUnit.MILLISECONDS.toMinutes(stopTime),
TimeUnit.MILLISECONDS.toSeconds(stopTime)
- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(stopTime)))
+ "\n");
results.put(name, "SUCCESS");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.openbaton.integration.test.testers;

import java.io.FileNotFoundException;
import java.util.Properties;
import org.ini4j.Profile;
import org.openbaton.catalogue.mano.record.NetworkServiceRecord;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ private VNFComponent createVNFComponent() {
VNFDConnectionPoint vnfdConnectionPoint = new VNFDConnectionPoint();
if (virtualLink.equals("")) log.warn("Virtual link is empty");
vnfdConnectionPoint.setVirtual_link_reference(virtualLink);
if(floatingIp!=null)
vnfdConnectionPoint.setFloatingIp(floatingIp);
if (floatingIp != null) vnfdConnectionPoint.setFloatingIp(floatingIp);
vnfdConnectionPointSet.add(vnfdConnectionPoint);
vnfc.setConnection_point(vnfdConnectionPointSet);
return vnfc;
Expand Down
31 changes: 24 additions & 7 deletions src/main/java/org/openbaton/integration/test/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.net.Socket;
import java.net.URL;
import java.util.*;
import org.openbaton.catalogue.security.Project;
import org.openbaton.catalogue.security.User;
import org.openbaton.sdk.NFVORequestor;
import org.openbaton.sdk.api.exception.SDKException;
Expand Down Expand Up @@ -107,8 +106,7 @@ public static LinkedList<URL> getURLFileList(String location) {
log.trace("Found dir " + dir.getName());
log.trace("Found dir " + dir.getAbsolutePath());

File[] iniFiles =
dir.listFiles((dir1, name) -> name.endsWith(".ini"));
File[] iniFiles = dir.listFiles((dir1, name) -> name.endsWith(".ini"));
LinkedList<URL> urls = new LinkedList<>();
if (iniFiles == null) return urls;
for (File f : iniFiles) {
Expand Down Expand Up @@ -154,6 +152,10 @@ public static List<String> getFileNames(List<URL> iniFileURLs) {
}

public static boolean checkFileExists(String filename) {
if (filename == null) {
log.warn("Given filename is null.");
return false;
}
File f = new File(filename);
if (f.exists()) {
log.debug("File or folder " + filename + " exists");
Expand All @@ -163,18 +165,33 @@ public static boolean checkFileExists(String filename) {
return false;
}

public static String getProjectIdByName(NFVORequestor requestor, String projectName) throws SDKException {
return requestor.getProjectAgent().findAll().stream().filter(p -> p.getName().equals(projectName)).findFirst().orElseThrow(() -> new SDKException("Did not find a project named " + projectName)).getId();
public static String getProjectIdByName(NFVORequestor requestor, String projectName)
throws SDKException {
return requestor
.getProjectAgent()
.findAll()
.stream()
.filter(p -> p.getName().equals(projectName))
.findFirst()
.orElseThrow(() -> new SDKException("Did not find a project named " + projectName))
.getId();
}

public static String getUserIdByName(NFVORequestor requestor, String userName) throws SDKException {
public static String getUserIdByName(NFVORequestor requestor, String userName)
throws SDKException {
User u = getUserByName(requestor, userName);
if (u == null) return "";
else return u.getId();
}

public static User getUserByName(NFVORequestor requestor, String userName) throws SDKException {
return requestor.getUserAgent().findAll().stream().filter(u -> u.getUsername().equals(userName)).findFirst().orElseThrow(() -> new SDKException("Did not find a user named " + userName));
return requestor
.getUserAgent()
.findAll()
.stream()
.filter(u -> u.getUsername().equals(userName))
.findFirst()
.orElseThrow(() -> new SDKException("Did not find a user named " + userName));
}

public static TextTable getResultsTable(String[] columns, Map<String, String> content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down Expand Up @@ -98,8 +97,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down Expand Up @@ -98,8 +97,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down Expand Up @@ -112,8 +111,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
}
]
}
],
"vimInstanceName": [
"vim-instance"
]
}
],
Expand Down Expand Up @@ -118,9 +115,6 @@
}
]
}
],
"vimInstanceName": [
"vim-instance"
]
}
],
Expand Down Expand Up @@ -191,9 +185,6 @@
}
]
}
],
"vimInstanceName": [
"vim-instance"
]
}
],
Expand Down Expand Up @@ -262,9 +253,6 @@
}
]
}
],
"vimInstanceName": [
"vim-instance"
]
}
],
Expand Down Expand Up @@ -337,9 +325,6 @@
}
]
}
],
"vimInstanceName": [
"vim-instance"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down Expand Up @@ -111,8 +110,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"virtual_link":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
}
]
}
],
"vimInstanceName":["vim-instance"]
]
}
],
"configurations": {
Expand Down Expand Up @@ -150,7 +149,6 @@
]
}
],
"vimInstanceName":["vim-instance"],
"monitoring_parameter":[
"net.udp.listen[5060]"
],
Expand Down