aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--vid-automation/src/main/resources/registration_to_simulator/add_subinterface/get_sdc_catalog_services_vid-test-333.json4
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java6
8 files changed, 49 insertions, 11 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);
}
diff --git a/vid-automation/src/main/resources/registration_to_simulator/add_subinterface/get_sdc_catalog_services_vid-test-333.json b/vid-automation/src/main/resources/registration_to_simulator/add_subinterface/get_sdc_catalog_services_vid-test-333.json
index 91413a070..dd566f10f 100644
--- a/vid-automation/src/main/resources/registration_to_simulator/add_subinterface/get_sdc_catalog_services_vid-test-333.json
+++ b/vid-automation/src/main/resources/registration_to_simulator/add_subinterface/get_sdc_catalog_services_vid-test-333.json
@@ -6,7 +6,7 @@
},
"simulatorResponse": {
"responseCode": 200,
- "file": "service-VdorotheaSrv-csar.zip"
+ "file": "service-vDOROTHEASrv-csar.zip"
}
},
{
@@ -16,7 +16,7 @@
},
"simulatorResponse": {
"responseCode": 200,
- "file": "service-VdorotheaSrv-csar_ecomp_false6.zip"
+ "file": "service-vDOROTHEASrv-csar_ecomp_false6.zip"
}
},
{
diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
index 329291838..8201bcfa0 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
@@ -14,7 +14,9 @@ import org.testng.annotations.Test;
import vid.automation.test.infra.FeatureTogglingTest;
import vid.automation.test.infra.Features;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonStringEquals;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
@@ -79,7 +81,9 @@ public class SdcApiTest extends BaseApiTest {
ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + A_LA_CARTE_INSTANTIATION_TYPE_UUID), String.class);
Assert.assertEquals(response.getStatusCode(), HttpStatus.OK);
String aLaCarteInstantiationTypeExpectedResponse = loadResourceAsString(A_LA_CARTE_INSTANTIATION_TYPE_EXPECTED_RESPONSE);
- assertThat("The response is in the format of JSON", response.getBody(), is(jsonStringEquals(turnOffInstantiationUI(aLaCarteInstantiationTypeExpectedResponse))));
+ assertThat(response.getBody(), jsonEquals(aLaCarteInstantiationTypeExpectedResponse)
+ .when(IGNORING_ARRAY_ORDER)
+ .whenIgnoringPaths("service.vidNotions.instantiationUI"));
}