aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/openecomp')
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java25
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java2
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java9
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java21
4 files changed, 34 insertions, 23 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java
index e22448aeb..f7bf3a54e 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java
@@ -41,6 +41,7 @@ import javax.ws.rs.client.Client;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.openecomp.vid.exceptions.VidServiceUnavailableException;
+import org.openecomp.vid.model.ModelUtil;
import org.openecomp.vid.model.ModelConstants;
import org.openecomp.vid.model.Network;
import org.openecomp.vid.model.ServiceModel;
@@ -191,12 +192,11 @@ public class VidController extends RestrictedBaseController {
LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
boolean isNewFlow = false;
- String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
+ String asdcModelNamespaces[] = VidProperties.getAsdcModelNamespace();
+ String[] vnfTags = ModelUtil.getTags(asdcModelNamespaces, ModelConstants.VNF);
+ String[] networkTags = ModelUtil.getTags(asdcModelNamespaces, ModelConstants.NETWORK);
+ String[] vfModuleTags = ModelUtil.getTags(asdcModelNamespaces, ModelConstants.VF_MODULE);
- String vnfTag = asdcModelNamespace + ModelConstants.VNF;
- String networkTag = asdcModelNamespace + ModelConstants.NETWORK;
- String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
-
try {
final ServiceModel serviceModel = new ServiceModel();
final Map<String, VNF> vnfs = new HashMap<String, VNF> ();
@@ -214,7 +214,8 @@ public class VidController extends RestrictedBaseController {
final NodeTemplate nodeTemplate = component.getValue();
final String type = nodeTemplate.getType();
- if (type.startsWith(vnfTag)) {
+ // is it a VNF?
+ if ( ModelUtil.isType (type, vnfTags) ) {
LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " found node template type: " + type);
final UUID vnfUuid = UUID.fromString(nodeTemplate.getMetadata().getUUID());
@@ -234,8 +235,9 @@ public class VidController extends RestrictedBaseController {
isNewFlow = true;
}
}
- // Networks
- if (type.startsWith(networkTag)) {
+
+ // is it a Network?
+ if ( ModelUtil.isType (type, networkTags) ) {
LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " found node template type: " + type);
final UUID networkUuid = UUID.fromString(nodeTemplate.getMetadata().getUUID());
final Network network = new Network();
@@ -291,9 +293,8 @@ public class VidController extends RestrictedBaseController {
// VF Module Customization UUID: We may have the complete set of all VF Modules for all VNFs under service and VF Modules under each VNF.
// Keep using the VF Modules under VNFs but we need to get the customization uuid from the service level and put them
// under each VF module at the VNF level
+ if ( ModelUtil.isType (type, vfModuleTags) ) {
- if (type.startsWith(vfModuleTag)) {
-
VfModule vfMod = VfModule.extractVfModule(modelCustomizationName, group);
// Add the vf module customization uuid from the service model
@@ -323,6 +324,10 @@ public class VidController extends RestrictedBaseController {
LOG.error("Failed to retrieve service definitions from SDC", e);
throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
}
+ catch (Exception e) {
+ LOG.error("Failed to retrieve service definitions from SDC", e);
+ throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
+ }
}
public ServiceModel getCustomizedServices(ToscaModel asdcServiceToscaModel, ServiceModel serviceModel) {
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java b/vid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java
index f4e427076..af5f0db91 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java
@@ -31,7 +31,7 @@ public class ModelConstants {
public static final String ASDC_SVC_API_PATH = "sdc.svc.api.path";
public static final String ASDC_RESOURCE_API_PATH = "sdc.resource.api.path";
- public static final String DEFAULT_ASDC_MODEL_NAMESPACE = "org.onap.";
+ public static final String DEFAULT_ASDC_MODEL_NAMESPACE = "org.openecomp.";
public static final String DEFAULT_ASDC_SVC_API_PATH = "sdc/v1/catalog/services";
public static final String DEFAULT_ASDC_RESOURCE_API_PATH = "sdc/v1/catalog/resources";
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java b/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java
index 140e9edf1..98e65316b 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java
@@ -182,16 +182,15 @@ public class ServiceModel {
final Map<String, VfModule> vfModules = new HashMap<String, VfModule> ();
final Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup> ();
-
- String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
- String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
-
+ String asdcModelNamespaces[] = VidProperties.getAsdcModelNamespace();
+ String[] vfModuleTags = ModelUtil.getTags(asdcModelNamespaces, ModelConstants.VF_MODULE);
+
for (Entry<String, Group> component : serviceToscaModel.gettopology_template().getGroups().entrySet()) {
final Group group = component.getValue();
final String type = group.getType();
final String customizationName = component.getKey();
- if (type.startsWith(vfModuleTag)) {
+ if ( ModelUtil.isType (type, vfModuleTags) ) {
VfModule vfMod = VfModule.extractVfModule(customizationName, group);
vfModules.put(customizationName, vfMod);
if ( vfMod.isVolumeGroupAllowed() ) {
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java b/vid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java
index 141b9b27c..38062df40 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java
@@ -53,21 +53,27 @@ public class VidProperties extends SystemProperties {
*
* @return the property value or a default value
*/
- public static String getAsdcModelNamespace() {
+ public static String[] getAsdcModelNamespace() {
String methodName = "getAsdcModelNamespace ";
- String asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
+ String[] asdcModelNamespaces = null;
+ String value = null;
try {
- asdcModelNamespace = SystemProperties.getProperty(ModelConstants.ASDC_MODEL_NAMESPACE);
- if ( asdcModelNamespace == null || asdcModelNamespace.isEmpty()) {
- asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
+ value = SystemProperties.getProperty(ModelConstants.ASDC_MODEL_NAMESPACE);
+ if ( value == null || value.isEmpty()) {
+ asdcModelNamespaces = new String[1];
+ asdcModelNamespaces[0] = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
}
+ else {
+ asdcModelNamespaces = value.split(",");
+ }
}
catch ( Exception e ) {
LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
+ ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE);
- asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
+ asdcModelNamespaces = new String[1];
+ asdcModelNamespaces[0] = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
}
- return (asdcModelNamespace);
+ return (asdcModelNamespaces);
}
/**
* Gets the specified property value. If the property is not defined, returns a default value.
@@ -90,4 +96,5 @@ public class VidProperties extends SystemProperties {
}
return (propValue);
}
+
}