summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenes Nemeth <denes.nemeth@nokia.com>2018-03-05 11:34:34 +0100
committerDenes Nemeth <denes.nemeth@nokia.com>2018-03-05 11:46:33 +0100
commitbe56383397388d35f41089723e912856c03f4673 (patch)
tree70fa2ec82e5de369fb7397e8b261bfcf8748282b
parent729c12f0145d4ac71e92545e7408379b48c8f389 (diff)
Fix release artifacts
Change-Id: Ic61a50d8c7b9c2121b7ebbac5324b1c2b99e1f3a Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com> Issue-ID: VFC-728
-rw-r--r--nokiav2/docs/sample/cbam.collectConnectionPoints.js16
-rw-r--r--nokiav2/docs/sampleVnfs/simple/simple.csarbin12147 -> 12044 bytes
-rw-r--r--nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csarbin11470 -> 11367 bytes
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java19
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java11
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java18
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java35
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java17
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java7
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java4
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java4
-rw-r--r--nokiav2/generatedapis/pom.xml7
12 files changed, 72 insertions, 66 deletions
diff --git a/nokiav2/docs/sample/cbam.collectConnectionPoints.js b/nokiav2/docs/sample/cbam.collectConnectionPoints.js
index f5cfc675..c721c935 100644
--- a/nokiav2/docs/sample/cbam.collectConnectionPoints.js
+++ b/nokiav2/docs/sample/cbam.collectConnectionPoints.js
@@ -26,21 +26,7 @@ function collectPorts(resourceModel, diff){
transformedPort.macAddress = port.attributes.mac_address;
transformedPort.serverProviderId = port.attributes.device_id;
transformedPort.networkProviderId = port.attributes.network_id;
- transformedPort.changeType = 'untouched';
- var added = contains(diff.add, path);
- var removed = contains(diff.remove, path);
- if(added && removed){
- transformedPort.changeType = "MODIFIED";
- }
- else{
- if(removed){
- transformedPort.changeType = "REMOVED";
- }
- if(added){
- transformedPort.changeType = "ADDED";
- }
- }
- if('untouched' != transformedPort.changeType && managedPort){
+ if(managedPort){
transformedPorts.push(transformedPort)
}
})
diff --git a/nokiav2/docs/sampleVnfs/simple/simple.csar b/nokiav2/docs/sampleVnfs/simple/simple.csar
index 3d87246d..13d35620 100644
--- a/nokiav2/docs/sampleVnfs/simple/simple.csar
+++ b/nokiav2/docs/sampleVnfs/simple/simple.csar
Binary files differ
diff --git a/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar b/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar
index 32c3f893..3545d237 100644
--- a/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar
+++ b/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar
Binary files differ
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java
index 2013a7bf..4a737480 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java
@@ -28,9 +28,16 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
+import java.io.IOException;
+
+import static org.apache.http.entity.ContentType.APPLICATION_OCTET_STREAM;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions.systemFunctions;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.DriverProperties.BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
+import static org.springframework.http.HttpHeaders.CONTENT_DISPOSITION;
+import static org.springframework.http.HttpHeaders.CONTENT_LENGTH;
+import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
+import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.TEXT_HTML_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@@ -56,10 +63,10 @@ public class ConverterApi {
logger.info("REST: convert package");
Part part = request.getParts().iterator().next();
byte[] bytes = vnfPackageConverter.covert(part.getInputStream());
- httpResponse.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_OCTET_STREAM.getMimeType());
- httpResponse.setStatus(HttpStatus.OK.value());
- httpResponse.addHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bytes.length));
- httpResponse.addHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + "core.csar" + "\"");
+ httpResponse.addHeader(CONTENT_TYPE, APPLICATION_OCTET_STREAM.getMimeType());
+ httpResponse.setStatus(OK.value());
+ httpResponse.addHeader(CONTENT_LENGTH, Integer.toString(bytes.length));
+ httpResponse.addHeader(CONTENT_DISPOSITION, "attachment; filename=\"" + "core.csar" + "\"");
httpResponse.getOutputStream().write(bytes);
httpResponse.getOutputStream().flush();
}
@@ -72,10 +79,10 @@ public class ConverterApi {
*/
@RequestMapping(value = "/convert", method = GET, produces = TEXT_HTML_VALUE)
@ResponseBody
- public void getUploadPageForConvertingVnfd(HttpServletResponse httpResponse) throws Exception {
+ public void getUploadPageForConvertingVnfd(HttpServletResponse httpResponse) throws IOException {
logger.info("REST: get converter main page");
byte[] bytes = systemFunctions().loadFile("upload.html");
- httpResponse.addHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bytes.length));
+ httpResponse.addHeader(CONTENT_LENGTH, Integer.toString(bytes.length));
httpResponse.getOutputStream().write(bytes);
}
}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java
index 6d4d19e6..659e82fd 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java
@@ -26,8 +26,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.DriverProperties.BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
+import static org.springframework.http.HttpHeaders.CONTENT_LENGTH;
+import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
+import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
/**
@@ -52,11 +57,11 @@ public class SwaggerApi {
*/
@RequestMapping(value = "/swagger.json", method = GET)
@ResponseBody
- public void getSwaggerApiDefinition(HttpServletResponse httpResponse) throws Exception {
+ public void getSwaggerApiDefinition(HttpServletResponse httpResponse) throws IOException {
logger.info("REST: get swagger definition");
- httpResponse.addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
+ httpResponse.addHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE);
byte[] bytes = selfRegistrationManager.getSwaggerApiDefinition();
- httpResponse.addHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bytes.length));
+ httpResponse.addHeader(CONTENT_LENGTH, Integer.toString(bytes.length));
httpResponse.getOutputStream().write(bytes);
}
}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java
index 7377abfc..ebd4234a 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java
@@ -20,8 +20,20 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.slf4j.Logger;
+/**
+ * Collection of utility functions
+ */
public class CbamUtils {
+ private static class OperationMustBeAborted extends RuntimeException{
+ OperationMustBeAborted(String msg){
+ super(msg);
+ }
+ OperationMustBeAborted(Exception e, String msg){
+ super(msg, e);
+ }
+ }
+
private CbamUtils() {
//use static way
}
@@ -43,7 +55,7 @@ public class CbamUtils {
public static JsonElement childElement(JsonObject parent, String name) {
JsonElement child = parent.get(name);
if (child == null) {
- throw new RuntimeException("Missing child " + name);
+ throw new OperationMustBeAborted("Missing child " + name);
}
return child;
}
@@ -58,7 +70,7 @@ public class CbamUtils {
*/
public static RuntimeException fatalFailure(Logger logger, String msg, Exception e) {
logger.error(msg, e);
- throw new RuntimeException(msg, e);
+ throw new OperationMustBeAborted(e, msg);
}
/**
@@ -70,6 +82,6 @@ public class CbamUtils {
*/
public static RuntimeException fatalFailure(Logger logger, String msg) {
logger.error(msg);
- throw new RuntimeException(msg);
+ throw new OperationMustBeAborted(msg);
}
}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java
index faa436e3..249925ea 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java
@@ -18,6 +18,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util;
import org.apache.commons.codec.binary.Base64;
+import javax.swing.text.html.Option;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.KeyFactory;
@@ -34,6 +35,9 @@ import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
+import static java.util.Optional.empty;
+import static java.util.Optional.of;
+import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.fatalFailure;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -41,7 +45,7 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
public final class StoreLoader {
- public static final String PASSWORD = "password";
+ public static final String PASS_ALIAS = "password";
private static final String RSA = "RSA";
private static final String X_509 = "X.509";
private static final String SUN = "SUN";
@@ -59,8 +63,7 @@ public final class StoreLoader {
if (rindex == -1 || lindex == -1) {
return "";
}
- String substring = content.substring(rindex, lindex) + end(scope);
- return substring;
+ return content.substring(rindex, lindex) + end(scope);
}
/**
@@ -105,17 +108,17 @@ public final class StoreLoader {
*/
public static KeyStore loadStore(String pem, String storePassword, String keyPassword) {
Optional<PrivateKey> privateKey = generatePrivateKey(pem);
- Certificate[] certs = createCertificates(pem);
+ Optional<Certificate[]> certs = createCertificates(pem);
try {
KeyStore ks = KeyStore.getInstance(JKS, SUN);
ks.load(null, storePassword.toCharArray());
if (privateKey.isPresent()) {
- ks.setKeyEntry(PASSWORD, privateKey.get(), keyPassword.toCharArray(), certs);
- } else if (certs != null) {
+ ks.setKeyEntry(PASS_ALIAS, privateKey.get(), keyPassword.toCharArray(), certs.orElse(null));
+ } else if (certs.isPresent()) {
int index = 0;
- for (Certificate cert : certs) {
+ for (Certificate cert : certs.get()) {
TrustedCertificateEntry ts = new TrustedCertificateEntry(cert);
- ks.setEntry(PASSWORD + index, ts, null);
+ ks.setEntry(PASS_ALIAS + index, ts, null);
index++;
}
}
@@ -125,7 +128,7 @@ public final class StoreLoader {
}
}
- private static Certificate[] createCertificates(String pem) {
+ private static Optional<Certificate[]> createCertificates(String pem) {
Set<Certificate> certificates = new HashSet<>();
try {
for (String certificate : getCertifacates(pem)) {
@@ -136,14 +139,13 @@ public final class StoreLoader {
certificates.addAll(c);
}
} catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RuntimeException("Unable to load certificates", e);
+ throw fatalFailure(logger, "Unable to load certificates", e);
}
if (certificates.size() > 0) {
- return certificates.toArray(new Certificate[certificates.size()]);
+ return of(certificates.toArray(new Certificate[certificates.size()]));
} else {
- return null;
+ return empty();
}
}
@@ -153,12 +155,11 @@ public final class StoreLoader {
if (!key.isEmpty()) {
KeyFactory keyFactory = KeyFactory.getInstance(RSA);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(toDer(key, RSA_PRIVATE_KEY));
- return Optional.of(keyFactory.generatePrivate(keySpec));
+ return of(keyFactory.generatePrivate(keySpec));
}
- return Optional.empty();
+ return empty();
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
- logger.error("Unable to load key", e);
- throw new RuntimeException("Unable to load key", e);
+ throw fatalFailure(logger, "Unable to load key", e);
}
}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java
index e2a2e660..805be641 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java
@@ -28,19 +28,19 @@ import java.io.PrintStream;
* the classes that uses static calls.
*/
public class SystemFunctions {
- private static SystemFunctions INSTANCE;
+ private static SystemFunctions singletonInstance;
/**
* @return singleton instance
*/
public static SystemFunctions systemFunctions() {
- if (INSTANCE != null) {
- return INSTANCE;
+ if (singletonInstance != null) {
+ return singletonInstance;
} else {
synchronized (SystemFunctions.class) {
- INSTANCE = new SystemFunctions();
+ singletonInstance = new SystemFunctions();
}
- return INSTANCE;
+ return singletonInstance;
}
}
@@ -56,6 +56,7 @@ public class SystemFunctions {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
}
@@ -108,7 +109,7 @@ public class SystemFunctions {
* destination that is typically not continuously monitored.
*/
public PrintStream err() {
- return System.err;
+ return System.err; //NO SONAR (intentional wrapping of system err
}
/**
@@ -137,7 +138,7 @@ public class SystemFunctions {
* @see java.io.PrintStream#println(java.lang.String)
*/
public PrintStream out() {
- return System.out;
+ return System.out; //NO SONAR (intentional wrapping of system out)
}
/**
@@ -147,7 +148,7 @@ public class SystemFunctions {
* the host environment or user.
*/
public InputStream in() {
- return System.in;
+ return System.in; //NO SONAR (intentional wrapping of system in)
}
/**
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java
index e013142a..c40dcfb1 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java
@@ -19,6 +19,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.ct;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.NokiaSvnfmApplication;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
@@ -33,10 +34,8 @@ public class CTReal {
* It takes parameters from application-real.properties
*/
@Test
- public void testBasicWorkflow() throws Exception {
-
-
- Thread.sleep(10000000 * 1000L);
+ public void testBasicWorkflow() {
+ SystemFunctions.systemFunctions().sleep(10000000 * 1000L);
}
}
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java
index 44263835..ea1afe5f 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java
@@ -77,7 +77,9 @@ public class TestGenericExternalSystemInfoProvider extends TestBase {
assertEquals(expectedVnfmInfo, vnfmInfo);
//when
//sleeping is required to make time pass (for cache to notice the change)
- Thread.sleep(10);
+ //cache is configured with 1 ms cache eviction without sleep it is not
+ //deterministic that at least 1 ms time will pass between calls
+ Thread.sleep(10); //NO SONAR
VnfmInfo vnfmInfo2 = genericExternalSystemInfoProvider.getVnfmInfo(VNFM_ID);
//verify source system called again
verify(logger, times(2)).info("Quering VNFM info from source with " + VNFM_ID + " identifier");
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java
index 99e95b4c..5f1d6007 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java
@@ -116,7 +116,7 @@ public class TestBase {
@Before
public void genericSetup() throws Exception {
MockitoAnnotations.initMocks(this);
- ReflectionTestUtils.setField(SystemFunctions.class, "INSTANCE", systemFunctions);
+ ReflectionTestUtils.setField(SystemFunctions.class, "singletonInstance", systemFunctions);
when(cbamRestApiProvider.getCbamLcmApi(VNFM_ID)).thenReturn(vnfApi);
when(cbamRestApiProvider.getCbamOperationExecutionApi(VNFM_ID)).thenReturn(operationExecutionApi);
when(cbamRestApiProvider.getCbamLcnApi(VNFM_ID)).thenReturn(lcnApi);
@@ -133,7 +133,7 @@ public class TestBase {
@After
public void tearGeneric() {
- ReflectionTestUtils.setField(SystemFunctions.class, "INSTANCE", null);
+ ReflectionTestUtils.setField(SystemFunctions.class, "singletonInstance", null);
}
protected void assertFileInZip(byte[] zip, String path, byte[] expectedContent) throws Exception {
diff --git a/nokiav2/generatedapis/pom.xml b/nokiav2/generatedapis/pom.xml
index 3dfeba34..1e2c7d98 100644
--- a/nokiav2/generatedapis/pom.xml
+++ b/nokiav2/generatedapis/pom.xml
@@ -121,13 +121,6 @@
</configuration>
</execution>
</executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
- <artifactId>generatortools</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>