Merge "use epsdk 2.5.0 in VID"
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 e1d2544..132987a 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 @@
 	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 @@
 	 * @return the vf module type
 	 */
 	public String getvf_module_type() {
-		return vf_module_type;
+		return vfModuleType;
 	}
 	
 	/**
@@ -111,8 +111,8 @@
 	 *
 	 * @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 f8cffab..cdd2550 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 @@
                 .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 @@
                 .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 @@
             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 735ba43..231ed4a 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 @@
                 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 f1e3a28..6238040 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.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.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 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 9ec917d..6b75b6d 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 @@
 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 92a6d5f..7818837 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 @@
         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 91413a0..dd566f1 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 3292918..8201bcf 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 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 @@
         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"));
     }