aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java112
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql38
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql13
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java42
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java8
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql6
12 files changed, 223 insertions, 30 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
index a98778bf5d..e8e3f34f28 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,13 +21,14 @@
package org.onap.so.adapters.catalogdb.catalogrest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class CatalogQuery {
protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class);
@@ -103,9 +104,10 @@ public abstract class CatalogQuery {
return false;
}
ObjectMapper mapper = new ObjectMapper();
- mapper.readValue(jsonInString, String.class);
+ mapper.readTree(jsonInString);
return true;
} catch (IOException e) {
+ logger.error("Invalid json: {}", jsonInString);
return false;
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
index 195ada37f7..d08c2e1444 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
@@ -26,7 +26,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import javax.xml.bind.annotation.XmlRootElement;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index d6e7415a77..8cd6ada792 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -23,17 +23,16 @@
package org.onap.so.adapters.catalogdb.catalogrest;
/* should be called QueryVnfResource.java */
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.ObjectMapper;
@XmlRootElement(name = "serviceVnfs")
public class QueryServiceVnfs extends CatalogQuery {
@@ -122,7 +121,7 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
- if (isJSONValid(o.getResourceInput())) {
+ if (isJSONValid(StringEscapeUtils.unescapeJava(o.getResourceInput()))) {
put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 98abf15645..f283af1ba6 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -27,6 +27,7 @@ package org.onap.so.adapters.catalogdb.rest;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@@ -46,8 +47,34 @@ import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceMacroHolder;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceNetworks;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
-import org.onap.so.db.catalog.beans.*;
-import org.onap.so.db.catalog.data.repository.*;
+import org.onap.so.db.catalog.beans.AllottedResource;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.ProcessingFlags;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
+import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
+import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
+import org.onap.so.db.catalog.data.repository.ProcessingFlagsRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleRepository;
+import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,6 +129,9 @@ public class CatalogDbAdapterRest {
@Autowired
private InstanceGroupRepository instanceGroupRepository;
+ @Autowired
+ private ProcessingFlagsRepository processingFlagsRepo;
+
private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
@@ -547,4 +577,82 @@ public class CatalogDbAdapterRest {
.entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
+
+ @GET
+ @Path("processingFlags/{flag}")
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response getProcessingFlags(@PathParam("flag") String flag) {
+ return getProcessingFlagsImpl(flag);
+ }
+
+ public Response getProcessingFlagsImpl(String flag) {
+ ProcessingFlags processingFlags = null;
+ logger.debug("Flag is: " + flag);
+ int respStatus = HttpStatus.SC_OK;
+ try {
+ processingFlags = processingFlagsRepo.findByFlag(flag);
+ if (processingFlags == null) {
+ logger.debug("ProcessingFlag not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+
+ } else {
+
+ logger.debug("ProcessingFlags processingFlags = {}", processingFlags.toString());
+ }
+ return Response.status(respStatus).entity(processingFlags)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ } catch (Exception e) {
+ logger.error("Exception - queryProcesssingFlags", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
+ }
+ }
+
+ @PUT
+ @Path("processingFlags/{flag}")
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional
+ public Response updateProcessingFlagsValue(@PathParam("flag") String flag, ProcessingFlags updatedProcessingFlag) {
+ return updateProcessingFlagsValueImpl(flag, updatedProcessingFlag);
+ }
+
+ public Response updateProcessingFlagsValueImpl(String flag, ProcessingFlags updatedProcessingFlag) {
+ ProcessingFlags processingFlags = null;
+ logger.debug("Flag is: " + flag);
+ int respStatus = HttpStatus.SC_OK;
+ try {
+ if (updatedProcessingFlag == null) {
+ logger.debug("No valid updatedProcessingFlag is provided");
+ throw new RuntimeException("No valid updatedProcessingFlag is provided");
+ }
+ String value = updatedProcessingFlag.getValue();
+ if (value == null || (!value.equalsIgnoreCase("YES") && !value.equalsIgnoreCase("NO"))) {
+ logger.debug("Value " + value + " is invalid, only yes/no are allowed");
+ throw new RuntimeException("Invalid value specified");
+ }
+ processingFlags = processingFlagsRepo.findByFlag(flag);
+ if (processingFlags == null) {
+ logger.debug("ProcessingFlag not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ } else {
+ logger.debug("ProcessingFlags processingFlags = {}", processingFlags.toString());
+ processingFlags.setValue(value);
+ processingFlagsRepo.saveAndFlush(processingFlags);
+ return Response.status(respStatus).entity(null)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ }
+ } catch (Exception e) {
+ logger.error("Exception - queryProcesssingFlags", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
+ }
+
+ return Response.status(HttpStatus.SC_NOT_FOUND).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
index e74663dbba..09c790cc6a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
@@ -68,7 +68,7 @@ public class ServiceMapper {
private List<Vnf> mapVnfs(org.onap.so.db.catalog.beans.Service service, int depth) {
List<Vnf> vnfs = new ArrayList<>();
logger.info("Vnf Count : {}", service.getVnfCustomizations().size());
- service.getVnfCustomizations().parallelStream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
+ service.getVnfCustomizations().stream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
return vnfs;
}
@@ -104,7 +104,7 @@ public class ServiceMapper {
private List<VfModule> mapVfModules(VnfResourceCustomization vnfResourceCustomization, int depth) {
List<VfModule> vfModules = new ArrayList<>();
- vnfResourceCustomization.getVfModuleCustomizations().parallelStream()
+ vnfResourceCustomization.getVfModuleCustomizations().stream()
.forEach(vfModule -> vfModules.add(mapVfModule(vfModule, depth)));
return vfModules;
}
@@ -133,8 +133,7 @@ public class ServiceMapper {
private List<Cvnfc> mapCvnfcs(VfModuleCustomization vfModuleCustomization) {
List<Cvnfc> cvnfcs = new ArrayList<>();
- vfModuleCustomization.getCvnfcCustomization().parallelStream()
- .forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
+ vfModuleCustomization.getCvnfcCustomization().stream().forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
return cvnfcs;
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
index 9202fd21d4..87526f7009 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
@@ -34,7 +34,6 @@ import javax.ws.rs.core.Response;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
-import org.onap.so.rest.catalog.beans.Service;
import org.onap.so.rest.catalog.beans.Vnf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index b70d409cd8..a5e546e093 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -632,7 +632,17 @@ VALUES
('VOLUME_GROUP', 'PENDING', 'DELETE', 'SILENT_SUCCESS'),
('VF_MODULE', 'PENDING', 'DELETE', 'FAIL'),
-('NETWORK', 'PENDING', 'DELETE', 'FAIL');
+('NETWORK', 'PENDING', 'DELETE', 'FAIL'),
+
+('VNF', 'CONFIGURED', 'ACTIVATE', 'CONTINUE'),
+('VNF', 'CONFIGURED', 'UNASSIGN', 'CONTINUE'),
+('VNF', 'CONFIGURED', 'DESACTIVATE', 'SILENT_SUCCESS'),
+
+('VNF', 'CONFIGURE', 'UNASSIGN', 'CONTINUE'),
+('VNF', 'CONFIGURE', 'DESACTIVATE', 'SILENT_SUCCESS'),
+
+('VNF', 'CONFIGASSIGNED', 'UNASSIGN', 'CONTINUE'),
+('VNF', 'CONFIGASSIGNED', 'DESACTIVATE', 'SILENT_SUCCESS');
UPDATE orchestration_flow_reference SET FLOW_NAME = 'HomingBB' WHERE FLOW_NAME = 'SniroHoming';
@@ -807,7 +817,8 @@ VALUES
('CONFIGURATION', 'PENDING CREATE', 'DEACTIVATE', 'FAIL'),
('CONFIGURATION', 'PENDING DELETE', 'DEACTIVATE', 'FAIL'),
('CONFIGURATION', 'PENDING ACTIVATION', 'DEACTIVATE', 'FAIL'),
-('CONFIGURATION', 'PENDING', 'DEACTIVATE', 'FAIL');
+('CONFIGURATION', 'PENDING', 'DEACTIVATE', 'FAIL'),
+('VNF','CONFIGDEPLOYED','ACTIVATE','CONTINUE');
UPDATE orchestration_flow_reference
SET SEQ_NO = SEQ_NO + 2 WHERE COMPOSITE_ACTION = 'Service-Macro-Create' AND SEQ_NO > 12;
@@ -876,7 +887,8 @@ UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE I
INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION)
VALUES
('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'),
-('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM');
+('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM'),
+('ControllerExecutionBB', 'NO_VALIDATE', 'CUSTOM');
UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null;
@@ -896,15 +908,15 @@ WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig';
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
VALUES
-('VNFCheckPserversLockedFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFCheckInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFSetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFCheckClosedLoopDisabledFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFSetClosedLoopDisabledFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFLockActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFUpgradePreCheckActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFQuiesceTrafficActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFStopActivity','*','*','*','*','Manual','Abort','*', '*'),
+('VNFCheckPserversLockedFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFCheckInMaintFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFSetInMaintFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFCheckClosedLoopDisabledFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFSetClosedLoopDisabledFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFLockActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFUpgradePreCheckActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFQuiesceTrafficActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFStopActivity','*','*','*','*','Rollback','Abort','*', '*'),
('VNFSnapShotActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFStartActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUpgradeBackupActivity','*','*','*','*','Manual','Abort','*', '*'),
@@ -913,5 +925,7 @@ VALUES
('VNFResumeTrafficActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnlockActivity','*','*','*','*','Manual','Abort','*', '*'),
('SDNOVnfHealthCheckBB','*','*','*','*','Manual','Abort','*', '*'),
+('VNFHealthCheckActivity','*','*','*','*','Manual','Abort','*', '*'),
+('VNFConfigModifyActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql
new file mode 100644
index 0000000000..e97df04ef6
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql
@@ -0,0 +1,6 @@
+use catalogdb;
+
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (15,NULL,'createInstance',NULL,'2.0','UNI-UNI','OTN UNI-UNI resource create recipe','/mso/async/services/CreateSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (16,NULL,'deleteInstance',NULL,'2.0','UNI-UNI','OTN UNI-UNI resource delete recipe','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (17,NULL,'createInstance',NULL,'2.0','UNI-ENNI','OTN UNI-ENNI resource create recipe','/mso/async/services/CreateSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (18,NULL,'deleteInstance',NULL,'2.0','UNI-ENNI','OTN UNI-ENNI resource delete recipe','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql
new file mode 100644
index 0000000000..2686df13a3
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql
@@ -0,0 +1,13 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `processing_flags` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `FLAG` varchar(200) NOT NULL,
+ `VALUE` varchar(200) NOT NULL,
+ `ENDPOINT` varchar(200) NOT NULL,
+ `DESCRIPTION` longtext NOT NULL,
+ `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ `UPDATE_TIMESTAMP` timestamp DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`ID`),
+ UNIQUE KEY `UK_processing_flags` (`FLAG`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 69a23a0eba..04161e9df9 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Response;
import org.json.JSONException;
import org.junit.Test;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
+import org.onap.so.db.catalog.beans.ProcessingFlags;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
@@ -36,6 +37,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
@@ -55,6 +57,8 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
private static final String ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES = "ecomp/mso/catalog/v2/serviceResources";
+ private static final String ECOMP_MSO_CATALOG_PROCESSING_FLAGS = "ecomp/mso/catalog/v2/processingFlags";
+
TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
HttpHeaders headers = new HttpHeaders();
@@ -805,6 +809,44 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value());
}
+ @Test
+ public void testGetProcessingFlagsByFlag() throws Exception {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_PROCESSING_FLAGS)).pathSegment("TESTFLAG");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ ObjectMapper mapper = new ObjectMapper();
+ ProcessingFlags processingFlagsResponse = mapper.readValue(response.getBody(), ProcessingFlags.class);
+
+ assertEquals(processingFlagsResponse.getFlag(), "TESTFLAG");
+ assertEquals(processingFlagsResponse.getValue(), "NO");
+ assertEquals(processingFlagsResponse.getEndpoint(), "TESTENDPOINT");
+ assertEquals(processingFlagsResponse.getDescription(), "TEST FLAG");
+ }
+
+ @Test
+ public void testSetProcessingFlagsFlagValue() throws JSONException {
+ ProcessingFlags updatedProcessingFlag = new ProcessingFlags();
+ updatedProcessingFlag.setFlag("TESTFLAG");
+ updatedProcessingFlag.setValue("YES");
+ HttpEntity<ProcessingFlags> entity = new HttpEntity<ProcessingFlags>(updatedProcessingFlag, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_PROCESSING_FLAGS)).pathSegment("TESTFLAG");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.PUT, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
private String createURLWithPort(String uri) {
return "http://localhost:" + port + uri;
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 03ef24ded0..d6f2c6dbcc 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -43,6 +43,7 @@ import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.PnfResource;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.ProcessingFlags;
import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -771,5 +772,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
+ @Test
+ public void testGetProcessingFlagsFromFlag() {
+ ProcessingFlags processingFlags = client.findProcessingFlagsByFlag("TESTFLAG");
+ assertNotNull(processingFlags);
+ assertEquals(processingFlags.getEndpoint(), "TESTENDPOINT");
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 8fd171bf64..31a4f126e8 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -253,4 +253,8 @@ insert into workflow(artifact_uuid, artifact_name, name, operation_name, version
('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values
-('ff2ae348-214a-11e7-93ae-92361f002671', '1'); \ No newline at end of file
+('ff2ae348-214a-11e7-93ae-92361f002671', '1');
+
+insert into processing_flags (flag,value,endpoint,description) values
+('TESTFLAG', 'NO', 'TESTENDPOINT', 'TEST FLAG');
+