diff options
author | jimmydot <jf2512@att.com> | 2017-06-08 11:54:45 -0400 |
---|---|---|
committer | jimmydot <jf2512@att.com> | 2017-06-08 11:54:45 -0400 |
commit | 36c86ad506206ed1a038f1129b1bde37efa0eaaa (patch) | |
tree | 388292dca8ad2812be23413cedba4f6f5b4cee3a /vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java | |
parent | 6c7dcba5be04a502a2d5de7e7c5f14eedf9eaa2a (diff) |
[VID-15] fixes for various issues
Change-Id: I392a0427078d337a5d501a813dff73c1959481e2
Signed-off-by: jimmydot <jf2512@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java')
-rwxr-xr-x | vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java | 25 |
1 files changed, 15 insertions, 10 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 e22448ae..f7bf3a54 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) {
|