From 36c86ad506206ed1a038f1129b1bde37efa0eaaa Mon Sep 17 00:00:00 2001 From: jimmydot Date: Thu, 8 Jun 2017 11:54:45 -0400 Subject: [VID-15] fixes for various issues Change-Id: I392a0427078d337a5d501a813dff73c1959481e2 Signed-off-by: jimmydot --- .../openecomp/vid/controller/VidController.java | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java') 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 vnfs = new HashMap (); @@ -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) { -- cgit 1.2.3-korg