diff options
Diffstat (limited to 'adapters/mso-vnf-adapter/src/main/java/org/openecomp')
-rw-r--r-- | adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java index 32720e53db..2fec3f8b43 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java @@ -30,10 +30,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Scanner; import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.jws.WebService; import javax.xml.ws.Holder; @@ -80,6 +77,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + protected MsoHeatUtils heat; + private static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER"; private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; @@ -106,6 +105,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { public MsoVnfAdapterImpl(MsoPropertiesFactory msoPropFactory, CloudConfigFactory cloudConfigFact) { this.msoPropertiesFactory = msoPropFactory; this.cloudConfigFactory = cloudConfigFact; + heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, this.msoPropertiesFactory, this.cloudConfigFactory); } /** @@ -278,8 +278,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis(); - MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory); - StackInfo heatStack = null; long subStartTime = System.currentTimeMillis(); try { @@ -339,8 +337,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis(); - MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory); - // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. // The possible outcomes of deleteStack are a StackInfo object with status // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException @@ -390,8 +386,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug("Rolling Back VNF " + vnfId + " in " + cloudSiteId + "/" + tenantId); - MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory); - // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. // The possible outcomes of deleteStack are a StackInfo object with status // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException @@ -701,8 +695,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { callHeatbridge(baseVfHeatStackId); // First, look up to see if the VF already exists. - MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory); - StackInfo heatStack = null; long subStartTime1 = System.currentTimeMillis(); try { @@ -839,7 +831,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Ready to deploy the new VNF - try (CatalogDatabase db = CatalogDatabase.getInstance()) { + try (CatalogDatabase db = getCatalogDatabase()) { // Retrieve the VF VfModule vf = null; VnfResource vnfResource = null; @@ -1375,8 +1367,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis(); - MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory); - // 1702 capture the output parameters on a delete // so we'll need to query first Map<String, Object> stackOutputs = null; @@ -1519,7 +1509,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vfRollback.setModelCustomizationUuid(mcu); // First, look up to see if the VNF already exists. - MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory); MsoHeatUtilsWithUpdate heatU = new MsoHeatUtilsWithUpdate(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory); StackInfo heatStack = null; @@ -1633,7 +1622,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Get a handle to the Catalog Database // Make sure DB session is closed - try (CatalogDatabase db = CatalogDatabase.getInstance()) { + try (CatalogDatabase db = this.getCatalogDatabase()) { // Retrieve the VF definition VnfResource vnfResource = null; VfModule vf = null; @@ -2169,5 +2158,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } return vfModuleName; } + + private CatalogDatabase getCatalogDatabase(){ + return CatalogDatabase.getInstance(); + } } |