aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Group.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/parser/ServiceModelInflator.kt10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/VidRestrictedBaseController.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java2
6 files changed, 42 insertions, 8 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Group.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Group.java
index e1d2544b7..132987a22 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Group.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Group.java
@@ -38,7 +38,7 @@ public class Group {
private ToscaMetadata metadata;
/** The vf module type. */
- private String vf_module_type;
+ private String vfModuleType;
/** The properties. */
private Map<String, Object> properties;
@@ -103,7 +103,7 @@ public class Group {
* @return the vf module type
*/
public String getvf_module_type() {
- return vf_module_type;
+ return vfModuleType;
}
/**
@@ -111,8 +111,8 @@ public class Group {
*
* @param vf_module_type the new vf module type
*/
- public void setvf_module_type(String vf_module_type) {
- this.vf_module_type = vf_module_type;
+ public void setvf_module_type(String vfModuleType) {
+ this.vfModuleType = vfModuleType;
}
/**
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ServiceModelInflator.kt b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ServiceModelInflator.kt
index f8cffabde..cdd2550a8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ServiceModelInflator.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ServiceModelInflator.kt
@@ -33,6 +33,8 @@ class ServiceModelInflator {
.plus(inflate(model.networks))
.plus(inflate(model.vnfs))
.plus(inflate(model.vnfGroups))
+ .plus(inflate(model.vrfs))
+ .plus(inflate(model.collectionResources))
}
private fun inflate(instances: Map<String, *>): Map<String, Names> {
@@ -45,6 +47,11 @@ class ServiceModelInflator {
.plus(inflate(vnf.volumeGroups))
}
+ private fun inflate(modelKey: String, cr: CR): Map<String, Names> {
+ return mapOf(cr.uuid to Names(null, modelKey))
+ .plus(inflate(cr.networksCollection))
+ }
+
private fun inflate(modelKey: String, instance: Any?): Map<String, Names> {
return when (instance) {
is Network -> mapOf(instance.uuid to Names(instance.modelCustomizationName, modelKey))
@@ -52,6 +59,9 @@ class ServiceModelInflator {
is VolumeGroup -> mapOf(instance.uuid to Names(instance.modelCustomizationName, modelKey))
is ResourceGroup -> mapOf(instance.uuid to Names(instance.modelCustomizationName, modelKey))
is VNF -> inflate(modelKey, instance)
+ is CR -> inflate(modelKey, instance)
+ is NetworkCollection -> mapOf(instance.uuid to Names(null, modelKey))
+ is Node -> mapOf(instance.uuid to Names(null, modelKey))
else -> {
// sink
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java
index 735ba437c..231ed4ad1 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java
@@ -511,7 +511,9 @@ public class ToscaParserImpl2 {
final Object values = property.getValue();
final String vfModuleLabel = group.getProperties().getVfModuleLabel();
if ( values instanceof List ) {
- if ( listContainsAsString((List) values, vfModuleLabel) ) return true;
+ if ( listContainsAsString((List) values, vfModuleLabel) ) {
+ return true;
+ }
} else {
return getPropertyValueAsString(property).equals(vfModuleLabel);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/VidRestrictedBaseController.java b/vid-app-common/src/main/java/org/onap/vid/controller/VidRestrictedBaseController.java
index f1e3a28e6..623804002 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/VidRestrictedBaseController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/VidRestrictedBaseController.java
@@ -24,6 +24,9 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.exceptions.AccessDeniedException;
+import org.onap.vid.exceptions.NotFoundException;
+import org.onap.vid.exceptions.OperationNotAllowedException;
import org.onap.vid.model.ExceptionResponse;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -33,7 +36,10 @@ import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import static org.onap.vid.utils.Logging.getMethodCallerName;
+import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
+import static org.springframework.http.HttpStatus.METHOD_NOT_ALLOWED;
+import static org.springframework.http.HttpStatus.NOT_FOUND;
public abstract class VidRestrictedBaseController extends RestrictedBaseController {
@@ -59,4 +65,22 @@ public abstract class VidRestrictedBaseController extends RestrictedBaseControll
public ExceptionResponse exceptionHandler(Exception e) {
return ControllersUtils.handleException(e, LOGGER);
}
+
+ @ExceptionHandler(NotFoundException.class)
+ @ResponseStatus(value=NOT_FOUND)
+ public ExceptionResponse notFoundExceptionHandler(Exception e) {
+ return ControllersUtils.handleException(e, LOGGER);
+ }
+
+ @ExceptionHandler(AccessDeniedException.class)
+ @ResponseStatus(value=FORBIDDEN)
+ public ExceptionResponse accessDeniedExceptionHandler(Exception e) {
+ return ControllersUtils.handleException(e, LOGGER);
+ }
+
+ @ExceptionHandler(OperationNotAllowedException.class)
+ @ResponseStatus(value=METHOD_NOT_ALLOWED)
+ public ExceptionResponse illegalStateExceptionHandler(Exception e) {
+ return ControllersUtils.handleException(e, LOGGER);
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
index 9ec917d9c..6b75b6d90 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
@@ -24,8 +24,6 @@ package org.onap.vid.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.Map;
-
/**
* Created by Oren on 7/4/17.
*/
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java
index 92a6d5fd7..7818837f1 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java
@@ -577,7 +577,7 @@ public class AsyncInstantiationBusinessLogicImpl implements
return counter==0 ? name : name + "_" + String.format("%03d", counter);
}
- private boolean isNameFreeInAai(String name, ResourceType resourceType) throws ExceptionWithRequestInfo {
+ private boolean isNameFreeInAai(String name, ResourceType resourceType){
return !aaiClient.isNodeTypeExistsByName(name, resourceType);
}