diff options
69 files changed, 1232 insertions, 1112 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java index 7e612b3b41..eff32cf826 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java @@ -7,9 +7,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. @@ -25,18 +25,24 @@ import java.io.Serializable; public class AuditInventory implements Serializable { /** - * + * */ private static final long serialVersionUID = 4937350343452380760L; + private String msoRequestId; + private String cloudRegion; private String cloudOwner; private String tenantId; + private String vfModuleId; + private String heatStackName; + private String genericVnfId; + public String getCloudRegion() { return cloudRegion; } @@ -69,6 +75,30 @@ public class AuditInventory implements Serializable { this.heatStackName = heatStackName; } + public String getGenericVnfId() { + return genericVnfId; + } + + public void setGenericVnfId(String genericVnfId) { + this.genericVnfId = genericVnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getMsoRequestId() { + return msoRequestId; + } + + public void setMsoRequestId(String msoRequestId) { + this.msoRequestId = msoRequestId; + } + } diff --git a/adapters/mso-adapter-utils/src/main/resources/application-local.yaml b/adapters/mso-adapter-utils/src/main/resources/application-local.yaml deleted file mode 100644 index 5fc2144bd6..0000000000 --- a/adapters/mso-adapter-utils/src/main/resources/application-local.yaml +++ /dev/null @@ -1,64 +0,0 @@ -# will be used as entry in DB to say SITE OFF/ON for healthcheck -# MSO Properties go here -mso: - catalog: - db: - spring: - endpoint: "http://localhost:8080" - db: - auth: Basic YnBlbDptc28tZGItMTUwNyE= -cloud_config: - identity_services: - MT_KEYSTONE: - identity_url: "http://localhost:5000/v2.0" - mso_id: "john" - mso_pass: "313DECE408AF7759D442D7B06DD9A6AA" - admin_tenant: "admin" - member_role: "_member_" - tenant_metadata: false - identity_server_type: "KEYSTONE" - identity_authentication_type: "USERNAME_PASSWORD" - DAN_KEYSTONE: - identity_url: "http://192.168.170.21:5000/v2.0" - mso_id: "jc1348" - mso_pass: "313DECE408AF7759D442D7B06DD9A6AA" - admin_tenant: "service" - member_role: "_member_" - tenant_metadata: false - identity_server_type: "KEYSTONE" - identity_authentication_type: "USERNAME_PASSWORD" - cloud_sites: - regionOne: - region_id: "regionOne" - clli: "MT2" - aic_version: "2.5" - identity_service_id: "MT_KEYSTONE" - DAN: - region_id: "RegionOne" - clli: "MT" - aic_version: "2.5" - identity_service_id: "DAN_KEYSTONE" - DEFAULT: - region_id: "" - clli: "MTN6" - aic_version: "3.0" - identity_service_id: "ORDM3" -adapters: - po: - retryCodes: "504" - retryDelay: "5" - retryCount: "3" - tenant: - tenant_description: "ECOMP Tenant" - region_type: "single" - user_role: "admin" - success_status_string: "Success" - no_regions_status_string: "no regions" - orm_request_path: "/v1/orm/customers/" - x_aic_orm_client_string: "ECOMP-MSO" - keystone_url_version: "/v2.0" - keystone_reg_ex: "/[vV][0-9]" - orm_url_replace_this: "8080" - orm_url_replace_with_this: "7080" - quota_value: "10" - set_default_quota: "false" diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml deleted file mode 100644 index d7c13eaa14..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml +++ /dev/null @@ -1,35 +0,0 @@ - -catalog: - db: - endpoint: http://localhost:8090 - -ssl-enable: false -mso: - site-name: localDevEnv - logPath: logs - catalog: - db: - spring: - endpoint: http://localhost:8090 - db: - auth: Basic YnBlbDptc28tZGItMTUwNyE= -spring: - security: - usercredentials: - - - username: test - password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' - role: BPEL-Client - - - username: bpel - password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO' - role: BPEL-Client - - - username: mso_admin - password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' - role: ACTUATOR - -server: - port: 8090 - - diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql index 3f76334bd9..137f73cf65 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql @@ -201,5 +201,5 @@ VALUES INSERT INTO `workflow` (`ARTIFACT_UUID`,`ARTIFACT_NAME`,`NAME`,`OPERATION_NAME`,`VERSION`,`DESCRIPTION`,`RESOURCE_TARGET`,`SOURCE`) VALUES ('9d45cd30-1a89-4993-87c1-6dd09c1696cf','VFModule-ScaleOut','VNF Scale Out','ScaleOut',1.0,'native static workflow to support ScaleOut','vfModule','native'), -('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VNF In Place Software Update','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'), -('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VNF Config Update','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native');
\ No newline at end of file +('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VnfInPlaceUpdate','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'), +('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VnfConfigUpdate','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native'); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java index 5060e554eb..7500097b6a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java @@ -43,6 +43,8 @@ public abstract class AbstractAuditService { protected static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI = "Unable to find all VServers and L-Interaces in A&AI"; + protected static final String UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK = "Unable to find VServers in Openstack"; + @Autowired public Environment env; @@ -68,12 +70,12 @@ public abstract class AbstractAuditService { * @param auditList * @return */ - protected boolean didDeleteAuditFail(Optional<AAIObjectAuditList> auditList) { - if (auditList.get().getAuditList() != null && !auditList.get().getAuditList().isEmpty()) { + protected boolean didDeleteAuditFail(AAIObjectAuditList auditList) { + if (auditList.getAuditList() != null && !auditList.getAuditList().isEmpty()) { if (logger.isInfoEnabled()) { - logger.info("Audit Results: {}", auditList.get().toString()); + logger.info("Audit Results: {}", auditList.toString()); } - return auditList.get().getAuditList().stream().filter(AAIObjectAudit::isDoesObjectExist).findFirst() + return auditList.getAuditList().stream().filter(AAIObjectAudit::isDoesObjectExist).findFirst() .map(v -> true).orElse(false); } else { return false; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java new file mode 100644 index 0000000000..1c707fe795 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java @@ -0,0 +1,77 @@ +package org.onap.so.adapters.audit; + +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.objects.audit.AAIObjectAuditList; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; + +@Component +public class AuditDataService { + + @Autowired + private RequestsDbClient requestsDbClient; + + /** + * Checks to see if an entry already exist for the given heat stack and writes audit stack data to the request + * database if it doesn't. + * + * @throws JsonProcessingException + */ + public void writeStackDataToRequestDb(AuditInventory auditInventory, AAIObjectAuditList auditList) + throws JsonProcessingException { + List<RequestProcessingData> requestProcessingDataList = + requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(), + auditInventory.getHeatStackName(), "AuditStackData"); + if (requestProcessingDataList.isEmpty()) { + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + String auditListString = objectMapper.getMapper().writeValueAsString(auditList);; + + RequestProcessingData requestProcessingData = new RequestProcessingData(); + requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId()); + requestProcessingData.setGroupingId(auditInventory.getVfModuleId()); + requestProcessingData.setName(auditInventory.getHeatStackName()); + requestProcessingData.setTag("AuditStackData"); + requestProcessingData.setValue(auditListString); + + requestsDbClient.saveRequestProcessingData(requestProcessingData); + } + } + + /** + * Retrieves audit stack data from the request database. + * + * @throws IOException + * @throws JsonMappingException + * @throws JsonParseException + */ + public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory) + throws JsonParseException, JsonMappingException, IOException { + + List<RequestProcessingData> requestProcessingDataList = + requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(), + auditInventory.getHeatStackName(), "AuditStackData"); + if (!requestProcessingDataList.isEmpty()) { + RequestProcessingData requestProcessingData = requestProcessingDataList.get(0); + String auditListString = requestProcessingData.getValue(); + + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + AAIObjectAuditList auditList = + objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class); + + return Optional.of(auditList); + } else { + return Optional.empty(); + } + } + + +} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java index 9b245ba695..b99eaa98d9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java @@ -40,10 +40,16 @@ public class AuditDeleteStackService extends AbstractAuditService { private static final Logger logger = LoggerFactory.getLogger(AuditDeleteStackService.class); @Autowired - public HeatStackAudit heatStackAudit; + protected HeatStackAudit heatStackAudit; @Autowired - public Environment environment; + protected AuditVServer auditVservers; + + @Autowired + protected AuditDataService auditDataService; + + @Autowired + protected Environment env; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { AuditInventory auditInventory = externalTask.getVariable("auditInventory"); @@ -51,17 +57,21 @@ public class AuditDeleteStackService extends AbstractAuditService { setupMDC(externalTask); boolean success = false; try { - logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory, - externalTask.getRetries()); - Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(), - auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName()); + logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries()); + Optional<AAIObjectAuditList> auditListOpt = auditDataService.getStackDataFromRequestDb(auditInventory); if (auditListOpt.isPresent()) { - auditListOpt.get().setAuditType("delete"); - auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName()); - GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); - variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get())); - success = !didDeleteAuditFail(auditListOpt); + auditVservers.auditVservers(auditListOpt.get()); + } else { + logger.debug("Auditing Vservers based on vf module relationships"); + auditListOpt = auditVservers.auditVserversThroughRelationships(auditInventory.getGenericVnfId(), + auditInventory.getHeatStackName()); } + auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName()); + auditListOpt.get().setAuditType("delete"); + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get())); + success = !didDeleteAuditFail(auditListOpt.get()); + } catch (Exception e) { logger.error("Error during audit of stack", e); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java new file mode 100644 index 0000000000..c8ac9d1a58 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java @@ -0,0 +1,68 @@ +package org.onap.so.adapters.audit; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import org.camunda.bpm.client.task.ExternalTask; +import org.camunda.bpm.client.task.ExternalTaskService; +import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.objects.audit.AAIObjectAuditList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AuditQueryStackService extends AbstractAuditService { + + private static final Logger logger = LoggerFactory.getLogger(AuditQueryStackService.class); + + @Autowired + protected HeatStackAudit heatStackAudit; + + @Autowired + protected AuditDataService auditDataService; + + protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { + AuditInventory auditInventory = externalTask.getVariable("auditInventory"); + setupMDC(externalTask); + boolean success = false; + Map<String, Object> variables = new HashMap<>(); + try { + logger.info("Executing External Task Query Audit Inventory. Audit Inventory: {} \n Retry Number: {}", + auditInventory.toString(), externalTask.getRetries()); + + Optional<AAIObjectAuditList> auditList = heatStackAudit.queryHeatStack(auditInventory.getCloudOwner(), + auditInventory.getCloudRegion(), auditInventory.getTenantId(), auditInventory.getHeatStackName()); + + if (auditList.isPresent()) { + success = true; + auditDataService.writeStackDataToRequestDb(auditInventory, auditList.get()); + } + if (success) { + externalTaskService.complete(externalTask, variables); + logger.debug("The External Task {} was Successful", externalTask.getId()); + } else { + if (externalTask.getRetries() == null) { + logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}", + externalTask.getId(), getRetrySequence().length); + externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, + UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, getRetrySequence().length, 10000); + } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { + logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId()); + externalTaskService.complete(externalTask, variables); + } else { + logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ", + externalTask.getId(), externalTask.getRetries() - 1, + calculateRetryDelay(externalTask.getRetries())); + externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, + UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, externalTask.getRetries() - 1, + calculateRetryDelay(externalTask.getRetries())); + } + logger.debug("The External Task {} Failed", externalTask.getId()); + } + } catch (Exception e) { + logger.error("Error during audit query of stack", e); + } + } +} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java index 576acb1fd8..999d27335b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java @@ -49,6 +49,9 @@ public class AuditStackService { @Autowired private AuditDeleteStackService auditDeleteStack; + @Autowired + private AuditQueryStackService auditQueryStack; + @PostConstruct public void auditAddAAIInventory() throws Exception { for (int i = 0; i < getMaxClients(); i++) { @@ -69,6 +72,16 @@ public class AuditStackService { } } + @PostConstruct + public void auditQueryInventory() throws Exception { + for (int i = 0; i < getMaxClients(); i++) { + ExternalTaskClient client = createExternalTaskClient(); + client.subscribe("InventoryQueryAudit") + .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000"))) + .handler(auditQueryStack::executeExternalTask).open(); + } + } + protected ExternalTaskClient createExternalTaskClient() throws Exception { ClientRequestInterceptor interceptor = createClientRequestInterceptor(); ExternalTaskClient client = ExternalTaskClient.create() diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java index e009c0e2fd..89e0320615 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java @@ -20,10 +20,12 @@ package org.onap.so.adapters.audit; +import java.util.List; import java.util.Optional; import java.util.Set; import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.Vserver; +import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; @@ -40,6 +42,38 @@ import com.fasterxml.jackson.core.JsonProcessingException; public class AuditVServer extends AbstractAudit { private static final Logger logger = LoggerFactory.getLogger(AuditVServer.class); + public void auditVservers(AAIObjectAuditList aaiObjectAuditList) { + + aaiObjectAuditList.getAuditList().forEach(aaiObjectAudit -> { + boolean vserverExist = getAaiClient().exists(AAIUriFactory + .createResourceFromExistingURI(AAIObjectType.VSERVER, aaiObjectAudit.getResourceURI())); + aaiObjectAudit.setDoesObjectExist(vserverExist); + }); + } + + public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) { + AAIObjectAuditList auditList = new AAIObjectAuditList(); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId) + .queryParam("vf-module-name", vfModuleName); + if (getAaiClient().get(uri).getRelationships().isPresent()) { + List<AAIResourceUri> relatedVservers = + getAaiClient().get(uri).getRelationships().get().getRelatedUris(AAIObjectType.VSERVER); + if (!relatedVservers.isEmpty()) { + relatedVservers.forEach(vserverUri -> { + Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class); + Vserver vServerShallow = new Vserver(); + BeanUtils.copyProperties(vserver, vServerShallow); + AAIObjectAudit vServerAudit = new AAIObjectAudit(); + vServerAudit.setAaiObject(vServerShallow); + vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName()); + vServerAudit.setDoesObjectExist(true); + auditList.getAuditList().add(vServerAudit); + }); + } + } + return Optional.of(auditList); + } + public Optional<AAIObjectAuditList> auditVservers(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner, String cloudRegion) { if (vServersToAudit == null || vServersToAudit.isEmpty()) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java index 2be87ff076..06fff19205 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java @@ -35,11 +35,16 @@ import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.Vlan; import org.onap.aai.domain.yang.Vlans; import org.onap.aai.domain.yang.Vserver; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.onap.so.openstack.utils.MsoHeatUtils; import org.onap.so.openstack.utils.MsoNeutronUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.woorea.openstack.heat.model.Link; @@ -66,6 +71,28 @@ public class HeatStackAudit { @Autowired protected AuditVServer auditVservers; + public Optional<AAIObjectAuditList> queryHeatStack(String cloudOwner, String cloudRegion, String tenantId, + String heatStackName) { + try { + logger.debug("Fetching Top Level Stack Information"); + Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName, 3); + List<Resource> novaResources = resources.getList().stream() + .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList()); + if (novaResources.isEmpty()) + return Optional.of(new AAIObjectAuditList()); + else { + Set<Vserver> vserversToAudit = createVserverSet(novaResources); + AAIObjectAuditList aaiObjectAuditList = new AAIObjectAuditList(); + vserversToAudit.stream().forEach(vServer -> aaiObjectAuditList.getAuditList() + .add(createAAIObjectAudit(cloudOwner, cloudRegion, tenantId, vServer))); + return Optional.of(aaiObjectAuditList); + } + } catch (Exception e) { + logger.error("Error during query stack resources", e); + return Optional.of(new AAIObjectAuditList()); + } + } + public Optional<AAIObjectAuditList> auditHeatStack(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) { try { @@ -215,6 +242,31 @@ public class HeatStackAudit { return vserversToAudit; } + protected Set<Vserver> createVserverSet(List<Resource> novaResources) { + Set<Vserver> vserversToAudit = new HashSet<>(); + for (Resource novaResource : novaResources) { + Vserver auditVserver = new Vserver(); + auditVserver.setLInterfaces(new LInterfaces()); + auditVserver.setVserverId(novaResource.getPhysicalResourceId()); + vserversToAudit.add(auditVserver); + } + return vserversToAudit; + } + + protected AAIObjectAudit createAAIObjectAudit(String cloudOwner, String cloudRegion, String tenantId, + Vserver vServer) { + AAIObjectAudit aaiObjectAudit = new AAIObjectAudit(); + Vserver vServerShallow = new Vserver(); + BeanUtils.copyProperties(vServer, vServerShallow); + aaiObjectAudit.setAaiObject(vServerShallow); + aaiObjectAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName()); + aaiObjectAudit.setResourceURI(AAIUriFactory + .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, vServer.getVserverId()) + .build()); + + return aaiObjectAudit; + } + /** * @param novaResource Single openstack resource that is of type Nova * @param neutronPorts List of Neutron ports created within the stack diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml deleted file mode 100644 index 66d63d436b..0000000000 --- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml +++ /dev/null @@ -1,105 +0,0 @@ -# will be used as entry in DB to say SITE OFF/ON for healthcheck -# MSO Properties go here -org: - onap: - so: - adapters: - default_keystone_url_version: /v2.0 - default_keystone_reg_ex: "/[vV][0-9]" - vnf: - bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA - checkRequiredParameters: true - addGetFilesOnVolumeReq: false - sockettimeout: 30 - connecttimeout: 30 - retrycount: 5 - retryinterval: -15 - retrylist: 408,429,500,502,503,504,900 - network: - bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA - sockettimeout: 5 - connecttimeout: 5 - retrycount: 5 - retryinterval: -15 - retrylist: 408,429,500,502,503,504,900 - encryptionKey: aa3871669d893c7fb8abbcda31b88b4f - tenant: - default_x_aic_orm_client_string: ECOMP-MSO - default_keystone_url_version: /v2.0 - default_keystone_reg_ex: "/[vV][0-9]" - default_tenant_description: ECOMP Tenant - default_region_type: single - default_user_role: admin - default_success_status_string: Success - default_no_regions_status_string: no regions - default_orm_request_path: /v1/orm/customers/ - default_orm_url_replace_this: 8080 - default_orm_url_replace_with_this: 7080 - default_quota_value: 10 - set_default_quota: false - po: - retryCodes: 504 - retryDelay: 5 - retryCount: 3 - pollTimeout: 7500 - pollInterval: 15 - -server-port: 8080 -ssl-enable: false -tomcat: - max-threads: 50 -mso: - msoKey: 07a7159d3bf51a0e53be7a8f89699be7 - auth: 6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436 - audit: - lock-time: 240000 - logPath: logs - msb-ip: localhost - msb-port: ${wiremock.server.port} - workflow: - endpoint: http://bpmn-infra:8081/sobpmnengine - topics: - retryMultiplier: 1000 - config: - cadi: - aafId: test - catalog: - db: - spring: - endpoint: "http://localhost:8080" - db: - auth: Basic YnBlbDptc28tZGItMTUwNyE= - site-name: localDevEnv - async: - core-pool-size: 50 - max-pool-size: 50 - queue-capacity: 500 - -spring: - security: - usercredentials: - - - username: sdnc - password: '$2a$12$mukkC6IvLikKGBdwqGnev.H0ccvV6K13TFeLvyNhJoCuNkRjWhqi6' - role: SDNC-Client - - - username: sitecontrol - password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu' - role: SiteControl-Client - - - username: bpel - password: '$2a$12$/GW0/AVAUooTag.7GDc9a.jW7XH3nq/.QsJJJFZJ0N24iXB2W9ksO' - role: BPEL-Client - - - username: sniro - password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y' - role: SNIRO-Client - - - username: apih - password: '$2a$12$e1BGJ7qknMN/b7bqsQvU2OT9iGunt9IlfQclKlCs6n240oHBfcO5y' - role: MSO-Client - - - username: mso_admin - password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' - role: ACTUATOR - diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java new file mode 100644 index 0000000000..d3380a6a33 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java @@ -0,0 +1,101 @@ +package org.onap.so.adapters.audit; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; +import java.util.ArrayList; +import java.util.List; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.Vserver; +import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; +import com.fasterxml.jackson.core.JsonProcessingException; + +@RunWith(MockitoJUnitRunner.Silent.class) +public class AuditDataServiceTest { + + @InjectMocks + AuditDataService auditDataService = new AuditDataService(); + + @Mock + protected RequestsDbClient requestsDbClient; + + AuditInventory auditInventory = new AuditInventory(); + + @Before + public void before() throws JsonProcessingException { + auditInventory.setCloudOwner("testCloudOwner"); + auditInventory.setCloudRegion("testLcpCloudRegionId"); + auditInventory.setHeatStackName("testVfModuleName1"); + auditInventory.setVfModuleId("testVnfModuleId"); + auditInventory.setTenantId("testTenantId"); + auditInventory.setGenericVnfId("testVnfId1"); + } + + @Test + public void testWriteStackDataToRequestDb() throws Exception { + Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient) + .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any()); + Mockito.doNothing().when(requestsDbClient).saveRequestProcessingData(Mockito.any()); + + AAIObjectAuditList auditList = new AAIObjectAuditList(); + auditList.setHeatStackName("testHeatStackName"); + AAIObjectAudit audit = new AAIObjectAudit(); + Vserver vserver = new Vserver(); + vserver.setVserverId("testVserverId"); + audit.setAaiObject(vserver); + auditList.getAuditList().add(audit); + + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + String auditListString = objectMapper.getMapper().writeValueAsString(auditList);; + + RequestProcessingData requestProcessingData = new RequestProcessingData(); + requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId()); + requestProcessingData.setGroupingId(auditInventory.getVfModuleId()); + requestProcessingData.setName(auditInventory.getHeatStackName()); + requestProcessingData.setTag("AuditStackData"); + requestProcessingData.setValue(auditListString); + + auditDataService.writeStackDataToRequestDb(auditInventory, auditList); + Mockito.verify(requestsDbClient, Mockito.times(1)).saveRequestProcessingData(requestProcessingData); + } + + @Test + public void testGetStackDataToRequestDb() throws Exception { + AAIObjectAuditList auditList = new AAIObjectAuditList(); + auditList.setHeatStackName("testHeatStackName"); + AAIObjectAudit audit = new AAIObjectAudit(); + Vserver vserver = new Vserver(); + vserver.setVserverId("testVserverId"); + audit.setAaiObject(vserver); + auditList.getAuditList().add(audit); + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + String auditListString = objectMapper.getMapper().writeValueAsString(audit); + + List<RequestProcessingData> list = new ArrayList(); + RequestProcessingData requestProcessingData = new RequestProcessingData(); + requestProcessingData.setId(234321432); + requestProcessingData.setGroupingId("testVfModuleId"); + requestProcessingData.setName("heatStackName"); + requestProcessingData.setTag("AuditStackData"); + requestProcessingData.setValue(auditListString); + list.add(requestProcessingData); + + Mockito.doReturn(list).when(requestsDbClient).getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), + Mockito.any(), Mockito.any()); + auditDataService.getStackDataFromRequestDb(auditInventory); + Mockito.verify(requestsDbClient, Mockito.times(1)).getRequestProcessingDataByGroupingIdAndNameAndTag( + "testVnfModuleId", "testVfModuleName1", "AuditStackData"); + } + +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java index f23486c45c..3432e4a8b6 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java @@ -7,9 +7,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. @@ -40,6 +40,7 @@ import org.onap.so.audit.beans.AuditInventory; import org.onap.so.objects.audit.AAIObjectAuditList; import org.springframework.core.env.Environment; import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -48,6 +49,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService { @InjectMocks private AuditCreateStackService auditStackService = new AuditCreateStackService(); + @InjectMocks + private AuditQueryStackService auditQueryStackService = new AuditQueryStackService(); + @Mock private HeatStackAudit heatStackAuditMock; @@ -60,6 +64,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService { @Mock private ExternalTaskService mockExternalTaskService; + @Mock + private AuditDataService auditDataService; + private ObjectMapper objectMapper = new ObjectMapper(); private AuditInventory auditInventory = new AuditInventory(); @@ -112,6 +119,20 @@ public class AuditStackServiceDataTest extends AuditCreateStackService { } @Test + public void executeExternalTaskQueryAuditTest() throws JsonProcessingException { + doReturn(auditListOptSuccess).when(heatStackAuditMock).queryHeatStack("cloudOwner", "cloudRegion", "tenantId", + "stackName"); + Mockito.doNothing().when(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class), + Mockito.any(AAIObjectAuditList.class)); + auditQueryStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); + ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class); + ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class); + Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture()); + Mockito.verify(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class), + Mockito.any(AAIObjectAuditList.class)); + } + + @Test public void execute_external_task_audit_first_failure_Test() { doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName"); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java index 2075557721..3d9a128318 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java @@ -7,9 +7,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. @@ -33,14 +33,19 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Stream; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.LInterfaces; +import org.onap.aai.domain.yang.Relationship; +import org.onap.aai.domain.yang.RelationshipList; +import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.Vserver; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; @@ -48,6 +53,7 @@ import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.skyscreamer.jsonassert.JSONAssert; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -362,6 +368,69 @@ public class AuditVServerTest extends AuditVServer { JSONAssert.assertEquals(expected, actualString, false); } + @Test + public void testAuditVserversWithList() { + + AAIObjectAuditList auditList = new AAIObjectAuditList(); + AAIObjectAudit obj1 = new AAIObjectAudit(); + Vserver vserver = new Vserver(); + vserver.setVserverId("testVserverId"); + obj1.setAaiObject(vserver); + obj1.setResourceURI(AAIUriFactory + .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, "testVserverId").build()); + auditList.getAuditList().add(obj1); + + doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, + cloudRegion, tenantId, "testVserverId")); + + auditNova.auditVservers(auditList); + + Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, + cloudRegion, tenantId, "testVserverId")); + + Assert.assertEquals(false, auditList.getAuditList().get(0).isDoesObjectExist()); + } + + @Test + public void testAuditVserversThroughRelationships() { + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("id"); + + AAIResultWrapper wrapper = new AAIResultWrapper(vfModule); + + doReturn(wrapper).when(aaiResourcesMock) + .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId") + .queryParam("vf-module-name", "vfModuleName")); + + Optional<AAIObjectAuditList> auditList = + auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName"); + + Assert.assertTrue(auditList.get().getAuditList().isEmpty()); + } + + @Test + public void testAuditVserversThroughRelationships_exists() throws IOException { + + String vfModule = getJson("vfModule.json"); + + AAIResultWrapper wrapper = new AAIResultWrapper(vfModule); + AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver()); + + doReturn(wrapper).when(aaiResourcesMock) + .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId") + .queryParam("vf-module-name", "vfModuleName")); + + doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, + "cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1")); + + Optional<AAIObjectAuditList> auditList = + auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName"); + + Assert.assertFalse(auditList.get().getAuditList().isEmpty()); + } + + private String getJson(String filename) throws IOException { return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename))); } diff --git a/adapters/mso-openstack-adapters/src/test/resources/vfModule.json b/adapters/mso-openstack-adapters/src/test/resources/vfModule.json new file mode 100644 index 0000000000..bfdca2c144 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/vfModule.json @@ -0,0 +1,38 @@ +{ + "vf-module-id": "a62d14f0-421e-4e64-980a-a368722819db", + "vf-module-name": "vig30001vm001vig001_migrated.base.module-0", + "is-base-vf-module": false, + "resource-version": "1494001780539", + "relationship-list": { + "relationship": [ + { + "related-to": "vserver", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner/cloud-region-id/tenants/tenant/tenant-id/vservers/vserver/VUSCHGA1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "cloud-owner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "cloud-region-id" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "tenant-id" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "VUSCHGA1" + } + ], + "related-to-property": [ + { + "property-key": "vserver.vserver-name", + "property-value": "VUSCHGA1" + } + ] + } + ] + } + } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/RequestDbRepositoryConfiguration.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/RequestDbRepositoryConfiguration.java new file mode 100644 index 0000000000..c32525a62b --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/RequestDbRepositoryConfiguration.java @@ -0,0 +1,23 @@ +package org.onap.so.adapters.requestsdb; + +import java.util.stream.Collectors; +import javax.persistence.EntityManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.rest.core.config.RepositoryRestConfiguration; +import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter; + +@Configuration +public class RequestDbRepositoryConfiguration extends RepositoryRestConfigurerAdapter { + + @Autowired + private EntityManager entityManager; + + @Override + public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { + config.exposeIdsFor(entityManager.getMetamodel().getEntities().stream().map(e -> e.getJavaType()) + .collect(Collectors.toList()).toArray(new Class[0])); + } + + +} diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml deleted file mode 100644 index 5d3a837180..0000000000 --- a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# will be used as entry in DB to say SITE OFF/ON for healthcheck
-
-server:
- port: 8090
- tomcat:
- max-threads: 50
-ssl-enable: false
-mso:
- adapters:
- requestDb:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- endpoint: http://localhost:8081
- logPath: logs
- site-name: localSite
- infra-requests:
- archived:
- period: 180
-spring:
- datasource:
- url: jdbc:mariadb://localhost:3306/requestdb
- username: catalog
- password: catalog123
- driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
- jpa:
- generate-ddl: false
- show-sql: false
- hibernate:
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable-lazy-load-no-trans: true
- database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- security:
- usercredentials:
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-
-
-flyway:
- baseline-on-migrate: false
- url: jdbc:mariadb://localhost:3306/requestdb
- user: catalog
- password: catalog123
-
\ No newline at end of file diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.3__Expand_Column_Size_Archived_Infra_Active_Requests_Request_Status.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.3__Expand_Column_Size_Archived_Infra_Active_Requests_Request_Status.sql new file mode 100644 index 0000000000..0780a611db --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.3__Expand_Column_Size_Archived_Infra_Active_Requests_Request_Status.sql @@ -0,0 +1,3 @@ +use requestdb; + +ALTER TABLE archived_infra_requests MODIFY COLUMN REQUEST_STATUS varchar(25) NULL;
\ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml deleted file mode 100644 index 4141548c29..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml +++ /dev/null @@ -1,133 +0,0 @@ -management: - context-path: /manage -mso: - async: - core-pool-size: 50 - max-pool-size: 50 - queue-capacity: 500 - logPath: /app/logs/sdnc - catalog: - db: - spring: - endpoint: "http://localhost:8080" - db: - auth: Basic YnBlbDptc28tZGItMTUwNyE= - site-name: local -org: - onap: - so: - adapters: - sdnc: - '.': - put: PUT|60000|sdncurl5| - query: GET|60000|sdncurl2| - restdelete: DELETE|60000|sdncurl5| - '': - contrail-route-topology-operation: - activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - create: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - network-topology-operation: - activate: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - assign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - changeassign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - changedelete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - delete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - reserve: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - rollback: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - security-zone-topology-operation: - activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - create: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - service-topology-operation: - assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - rollback: POST|270000|sdncur10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - vnf-topology-operation: - activate: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - assign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - changeassign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - changedelete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - delete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - rollback: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf - bpelauth: BBD450258299BD2FEF7E3EBA3CD2B58AD417355332319856D761654AA876830A9839820D33DE8426A81E5D48649A4BE6FE7021F5 - bpelurl: http://localhost:8080/mso/SDNCAdapterCallbackService - generic-resource: - network-topology-operation: - activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - vf-module-topology-operation: - activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - changeassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - changedelete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - rollback: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - vnf-topology-operation: - activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - changeassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - changedelete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - rollback: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource - infra: - '': - query: GET|60000|sdncurl5| - mobility: - '': - query: GET|60000|sdncurl5| - myurl: http://localhost:8080/adapters/rest/SDNCNotify - rest: - bpelurl: http://localhost:8080/mso/WorkflowMessage - sdncauth: 1C2DC9B30545C5F673B3C33904608E942476F0C969B3CF7A2509459AB83C9062EFAAE89E91D6DB - sdncconnecttime: 5000 - sdncurl10: 'https://localhost:8443/restconf/operations/GENERIC-RESOURCE-API:' - sdncurl12: https://localhost:8443/ - sdncurl5: https://localhost:8443/restconf/config - sdncurl6: 'https://localhost:8443/restconf/operations/VNF-API:' - vfmodule: - '': - query: GET|60000|sdncurl12| - network: - encryptionKey: aa3871669d893c7fb8abbcda31b88b4f -spring: - security: - usercredentials: - - - username: sdnc - password: '$2a$12$mukkC6IvLikKGBdwqGnev.H0ccvV6K13TFeLvyNhJoCuNkRjWhqi6' - role: SDNC-Client - - - username: sitecontrol - password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu' - role: SiteControl-Client - - - username: bpel - password: '$2a$12$/GW0/AVAUooTag.7GDc9a.jW7XH3nq/.QsJJJFZJ0N24iXB2W9ksO' - role: BPEL-Client - - - username: sniro - password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y' - role: SNIRO-Client - - - username: apih - password: '$2a$12$e1BGJ7qknMN/b7bqsQvU2OT9iGunt9IlfQclKlCs6n240oHBfcO5y' - role: MSO-Client - - - username: mso_admin - password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' - role: ACTUATOR -ssl-enable: false diff --git a/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml b/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml deleted file mode 100644 index 414dabb0a1..0000000000 --- a/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml +++ /dev/null @@ -1,34 +0,0 @@ -server: - port: 8091 - tomcat: - max-threads: 50 -ssl-enable: false -mso: - logPath: logs - site-name: localSite -spring: - datasource: - jdbc-url: jdbc:mariadb://localhost:3306/requestdb - username: mso - password: mso123 - driver-class-name: org.mariadb.jdbc.Driver - initialize: true - initialization-mode: never - jpa: - generate-ddl: false - show-sql: false - hibernate: - ddl-auto: validate - naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy - enable-lazy-load-no-trans: true - database-platform: org.hibernate.dialect.MySQL5InnoDBDialect - security: - usercredentials: - - - username: bpel - password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO' - role: BPEL-Client - - - username: mso_admin - password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' - role: ACTUATOR diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml index 09c28f93f1..e2dd64d0f4 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml @@ -58,6 +58,24 @@ </configuration> </plugin> </plugins> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + <excludes> + <exclude>**/*.p12</exclude> + <exclude>**/*.jks</exclude> + </excludes> + </resource> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + <includes> + <include>**/*.p12</include> + <include>**/*.jks</include> + </includes> + </resource> + </resources> </build> <dependencies> <dependency> diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java index 57d6615d66..735e1f9d42 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java @@ -49,6 +49,7 @@ import java.util.NoSuchElementException; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import javax.net.ssl.SSLContext; import org.apache.commons.codec.binary.Base64; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; @@ -133,7 +134,7 @@ public class SdcPackageProvider { private byte[] getPackage(final String csarId) { final String SERVICE_NAME = "vnfm-adapter"; - try (CloseableHttpClient client = HttpClients.createDefault()) { + try (CloseableHttpClient client = HttpClients.custom().setSSLContext(SSLContext.getDefault()).build()) { final HttpGet httpget = new HttpGet(format(GET_PACKAGE_URL, baseUrl, csarId)); httpget.setHeader(ACCEPT, APPLICATION_OCTET_STREAM_VALUE); httpget.setHeader("X-ECOMP-InstanceID", SERVICE_NAME); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java index 1fa62efa25..019a08af78 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java @@ -28,6 +28,7 @@ import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Vserver; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.vnfmadapter.v1.model.Tenant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,8 +59,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { @Override public GenericVnfs invokeQueryGenericVnf(final String selfLink) { return aaiClientProvider.getAaiClient() - .get(GenericVnfs.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS) - .queryParam("selflink", selfLink.replaceAll("https", "http"))) + .get(GenericVnfs.class, + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam("selflink", selfLink)) .orElseGet(() -> { logger.debug("No vnf found in AAI with selflink: {}", selfLink); return null; @@ -78,7 +79,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { @Override public EsrVnfm invokeGetVnfm(final String vnfmId) { return aaiClientProvider.getAaiClient() - .get(EsrVnfm.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId)).orElseGet(() -> { + .get(EsrVnfm.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE)) + .orElseGet(() -> { logger.debug("VNFM not found in AAI"); return null; }); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java index 2aee1c06e3..3342e0d054 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java @@ -22,16 +22,34 @@ package org.onap.so.adapters.vnfmadapter.extclients.vnfm; import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; import com.google.gson.Gson; +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; import java.util.Iterator; +import java.util.ListIterator; +import javax.net.ssl.SSLContext; +import org.apache.http.client.HttpClient; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContextBuilder; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON; import org.onap.so.configuration.rest.BasicHttpHeadersProvider; import org.onap.so.configuration.rest.HttpHeadersProvider; +import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.onap.so.rest.service.HttpRestServiceProvider; import org.onap.so.rest.service.HttpRestServiceProviderImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.Resource; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.GsonHttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; @@ -43,6 +61,13 @@ import org.springframework.web.client.RestTemplate; @Configuration public class VnfmServiceProviderConfiguration { + private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderConfiguration.class); + + @Value("${http.client.ssl.trust-store}") + private Resource keyStore; + @Value("${http.client.ssl.trust-store-password}") + private String keyStorePassword; + @Bean(name = "vnfmServiceProvider") public HttpRestServiceProvider httpRestServiceProvider( @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate) { @@ -52,6 +77,8 @@ public class VnfmServiceProviderConfiguration { private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate, final HttpHeadersProvider httpHeadersProvider) { setGsonMessageConverter(restTemplate); + setTrustStore(restTemplate); + removeSpringClientFilter(restTemplate); return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider); } @@ -66,4 +93,30 @@ public class VnfmServiceProviderConfiguration { restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson)); } + private void setTrustStore(final RestTemplate restTemplate) { + SSLContext sslContext; + try { + sslContext = new SSLContextBuilder().loadTrustMaterial(keyStore.getURL(), keyStorePassword.toCharArray()) + .build(); + logger.info("Setting truststore: {}", keyStore.getURL()); + final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext); + final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build(); + final HttpComponentsClientHttpRequestFactory factory = + new HttpComponentsClientHttpRequestFactory(httpClient); + restTemplate.setRequestFactory(factory); + } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException + | IOException exception) { + logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception); + } + } + + private void removeSpringClientFilter(final RestTemplate restTemplate) { + ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator(); + while (interceptorIterator.hasNext()) { + if (interceptorIterator.next() instanceof SpringClientFilter) { + interceptorIterator.remove(); + } + } + } + } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java index 0b5b09ae39..c470008d08 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java @@ -54,7 +54,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider { @Override public Optional<InlineResponse201> getVnf(final String vnfSelfLink) { - return httpServiceProvider.get(vnfSelfLink.replaceAll("https", "http"), InlineResponse201.class); + return httpServiceProvider.get(vnfSelfLink, InlineResponse201.class); } @Override diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java index a4f7d3206d..fa2fa30b4a 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java @@ -114,7 +114,7 @@ public class LifecycleManager { private String getSelfLink(final InlineResponse201 vnfmResponse, final EsrVnfm vnfm) { if (vnfmResponse.getLinks() != null && vnfmResponse.getLinks().getSelf() != null && vnfmResponse.getLinks().getSelf().getHref() != null) { - return vnfmResponse.getLinks().getSelf().getHref().replaceAll("https", "http"); + return vnfmResponse.getLinks().getSelf().getHref(); } return vnfm.getEsrSystemInfoList().getEsrSystemInfo().iterator().next().getServiceUrl() + "/vnf_instances/" + vnfmResponse.getId(); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml index 951d4a3bb9..0bd63dffa9 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml @@ -23,6 +23,12 @@ spring: http: converters: preferred-json-mapper: gson + +http: + client: + ssl: + trust-store: classpath:org.onap.so.trust.jks + trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H' server: port: 9092 diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks Binary files differnew file mode 100644 index 0000000000..1f0d8a550a --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java index a5e3340c76..e00bb1eb36 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java @@ -38,21 +38,26 @@ import java.security.SecureRandom; @Profile("!test") public class ASDCControllerSingleton { + private static final Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class); + private final ASDCController asdcController; @Autowired - private ASDCController asdcController; - private static Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class); - - + public ASDCControllerSingleton(final ASDCController asdcController) { + this.asdcController = asdcController; + } @Scheduled(fixedRate = 50000) public void periodicControllerTask() { try { - int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE); + final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE); asdcController.setControllerName("mso-controller" + randomNumber); - asdcController.initASDC(); - } catch (ASDCControllerException e) { - logger.error("Exception occurred", e); + if (asdcController.isStopped()) { + logger.info("{} not running will try to initialize it, currrent status: {}", + asdcController.getClass().getName(), asdcController.getControllerStatus()); + asdcController.initASDC(); + } + } catch (final ASDCControllerException controllerException) { + logger.error("Exception occurred", controllerException); } } @@ -60,8 +65,8 @@ public class ASDCControllerSingleton { private void terminate() { try { asdcController.closeASDC(); - } catch (ASDCControllerException e) { - logger.error("Exception occurred", e); + } catch (final ASDCControllerException controllerException) { + logger.error("Exception occurred", controllerException); } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java index eb2957c6f8..2c8347260f 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java @@ -35,7 +35,6 @@ import org.springframework.scheduling.annotation.EnableScheduling; @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") public class Application { private static final Logger logger = LoggerFactory.getLogger(Application.class); - private static final String MSO_CONFIG_PATH = "mso.config.path"; private static final String LOGS_DIR = "logs_dir"; @Autowired @@ -47,11 +46,6 @@ public class Application { } } - private static void setConfigPath() { - if (System.getProperty(MSO_CONFIG_PATH) == null) - System.getProperties().setProperty(MSO_CONFIG_PATH, "."); - } - @PostConstruct private void deployActivities() { try { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java index 902506974a..22265a0cc6 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java @@ -24,7 +24,9 @@ import javax.annotation.PostConstruct; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.onap.so.asdc.client.test.rest.ASDCRestInterface; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.jaxrs.listing.ApiListingResource; import io.swagger.jaxrs.listing.SwaggerSerializers; @@ -33,6 +35,12 @@ import io.swagger.jaxrs.listing.SwaggerSerializers; @ApplicationPath("/test") public class JerseyConfiguration extends ResourceConfig { + private Environment environment; + + @Autowired + public JerseyConfiguration(final Environment environment) { + this.environment = environment; + } @PostConstruct public void setUp() { @@ -40,10 +48,10 @@ public class JerseyConfiguration extends ResourceConfig { register(ApiListingResource.class); register(SwaggerSerializers.class); - BeanConfig beanConfig = new BeanConfig(); + final BeanConfig beanConfig = new BeanConfig(); beanConfig.setVersion("1.0.2"); beanConfig.setSchemes(new String[] {"http"}); - beanConfig.setHost("localhost:8080"); + beanConfig.setHost("localhost:" + environment.getProperty("server.port")); beanConfig.setBasePath("/mso"); beanConfig.setResourcePackage("org.onap.so.apihandlerinfra"); beanConfig.setPrettyPrint(true); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 563291c479..3b9406a697 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -196,11 +196,9 @@ public class ASDCController { * @throws IOException In case of issues when trying to load the key file */ public void initASDC() throws ASDCControllerException { - String event = "Initialize the ASDC Controller"; - logger.debug(event); - if (this.getControllerStatus() != ASDCControllerStatus.STOPPED) { - String endEvent = "The controller is already initialized, call the closeASDC method first"; - throw new ASDCControllerException(endEvent); + logger.debug("Initialize the ASDC Controller"); + if (!isStopped()) { + throw new ASDCControllerException("The controller is already initialized, call the closeASDC method first"); } if (asdcConfig != null) { @@ -238,6 +236,13 @@ public class ASDCController { } /** + * @return true if controller is stopped + */ + public boolean isStopped() { + return this.getControllerStatus() == ASDCControllerStatus.STOPPED; + } + + /** * This method closes the ASDC Controller and the ASDC Client. * * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be closed because it's currently @@ -245,7 +250,7 @@ public class ASDCController { */ public void closeASDC() throws ASDCControllerException { - if (this.getControllerStatus() == ASDCControllerStatus.BUSY) { + if (isBusy()) { throw new ASDCControllerException("Cannot close the ASDC controller as it's currently in BUSY state"); } if (this.distributionClient != null) { @@ -261,6 +266,13 @@ public class ASDCController { this.changeControllerStatus(ASDCControllerStatus.STOPPED); } + /** + * @return true if controller is currently processing notification + */ + public boolean isBusy() { + return this.getControllerStatus() == ASDCControllerStatus.BUSY; + } + protected boolean checkResourceAlreadyDeployed(ResourceStructure resource, boolean serviceDeployed) throws ArtifactInstallerException { @@ -713,12 +725,6 @@ public class ASDCController { try { this.processCsarServiceArtifacts(iNotif, toscaResourceStructure); - IArtifactInfo iArtifact = toscaResourceStructure.getToscaArtifact(); - String filePath = - msoConfigPath + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact.getArtifactName(); - File csarFile = new File(filePath); - - if (isCsarAlreadyDeployed(iNotif, toscaResourceStructure)) { return; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java index 56690a8c38..24e1887847 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java @@ -23,7 +23,6 @@ package org.onap.so.asdc.client.test.rest; -import java.io.IOException; import javax.transaction.Transactional; import javax.ws.rs.HeaderParam; import javax.ws.rs.POST; @@ -31,15 +30,14 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.so.logger.LoggingAnchor; +import javax.ws.rs.core.Response.Status; import org.onap.so.asdc.client.ASDCController; -import org.onap.so.asdc.client.exceptions.ASDCControllerException; -import org.onap.so.asdc.client.exceptions.ASDCParametersException; import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; -import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.client.test.emulators.JsonStatusData; +import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,13 +46,15 @@ import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; /** - * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service on - * jboss without the need to be connected to the ASDC service broker. It starts the test at the treatNotification step - * and simulates both the notification step as well as the artifact download step. + * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service + * without the need to be connected to the ASDC service broker. It starts the test at the treatNotification step and + * simulates both the notification step as well as the artifact download step. * <p> - * i.e. http://localhost:8080/asdc/treatNotification/v1 + * i.e. http://localhost:8085/test/treatNotification/v1 * <p> - * i.e. http://localhost:8080/asdc/statusData/v1 + * i.e. http://localhost:8085/test/statusData/v1 + * + * This interface is also used in CSIT to simulate a distribution of a service, without using SDC * * @author jm5423 */ @@ -66,48 +66,75 @@ public class ASDCRestInterface { private static final Logger logger = LoggerFactory.getLogger(ASDCRestInterface.class); - @Autowired - private ASDCController asdcController; + private final ASDCController asdcController; + + private final ToscaResourceInstaller toscaInstaller; @Autowired - private ToscaResourceInstaller toscaInstaller; + public ASDCRestInterface(final ASDCController asdcController, final ToscaResourceInstaller toscaInstaller) { + this.asdcController = asdcController; + this.toscaInstaller = toscaInstaller; + } @POST @Path("/treatNotification/v1") @Produces(MediaType.APPLICATION_JSON) @Transactional - public Response invokeASDCService(NotificationDataImpl request, - @HeaderParam("resource-location") String resourceLocation) - throws ASDCControllerException, ASDCParametersException, IOException { - DistributionClientEmulator distributionClientEmulator = new DistributionClientEmulator(resourceLocation); - - asdcController.setControllerName("asdc-controller1"); - asdcController.setDistributionClient(distributionClientEmulator); - asdcController.initASDC(); - asdcController.treatNotification(request); - asdcController.closeASDC(); - return Response.status(200).build(); + public Response invokeASDCService(final NotificationDataImpl request, + @HeaderParam("resource-location") final String resourceLocation) { + + try { + logger.info("Received message : {}", request); + logger.info("resource-location : {}", resourceLocation); + final DistributionClientEmulator distributionClientEmulator = + getDistributionClientEmulator(resourceLocation); + + asdcController.setControllerName("asdc-controller1"); + asdcController.setDistributionClient(distributionClientEmulator); + + if (asdcController.isStopped()) { + logger.info("{} not running will try to initialize it, currrent status: {}", + asdcController.getClass().getName(), asdcController.getControllerStatus()); + asdcController.initASDC(); + } + + asdcController.treatNotification(request); + + if (!asdcController.isBusy()) { + asdcController.closeASDC(); + } + + return Response.status(Status.OK).build(); + } catch (final Exception exception) { + logger.error("Unable to process notification request", exception); + return Response.status(Status.INTERNAL_SERVER_ERROR).build(); + } + + } + + private DistributionClientEmulator getDistributionClientEmulator(final String resourceLocation) { + return new DistributionClientEmulator(resourceLocation); } @POST @Path("/statusData/v1") @Produces(MediaType.APPLICATION_JSON) @Transactional - public Response invokeASDCStatusData(String request) { + public Response invokeASDCStatusData(final String request) { try { - DistributionClientEmulator distributionClientEmulator = - new DistributionClientEmulator("resource-examples/"); - JsonStatusData statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/"); + final DistributionClientEmulator distributionClientEmulator = + getDistributionClientEmulator("resource-examples/"); + final JsonStatusData statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/"); - ASDCController controller = new ASDCController("asdc-controller1", distributionClientEmulator); - controller.initASDC(); + asdcController.setDistributionClient(distributionClientEmulator); + asdcController.initASDC(); toscaInstaller.installTheComponentStatus(statusData); - controller.closeASDC(); + asdcController.closeASDC(); logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete"); - } catch (Exception e) { + } catch (final Exception e) { logger.info("Error caught " + e.getMessage()); logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION.toString(), "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", diff --git a/asdc-controller/src/main/resources/application-local.yaml b/asdc-controller/src/main/resources/application-local.yaml deleted file mode 100644 index 1b21d8b571..0000000000 --- a/asdc-controller/src/main/resources/application-local.yaml +++ /dev/null @@ -1,95 +0,0 @@ -# will be used as entry in DB to say SITE OFF/ON for healthcheck - -server-port: 8080 -ssl-enable: false - - - -# H2 -spring: - datasource: - jdbc-url: jdbc:mariadb://localhost:3306/catalogdb - username: root - password: password - driver-class-name: org.mariadb.jdbc.Driver - initialize: true - - jpa: - show-sql: true - hibernate: - ddl-auto: validate - naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy - enable-lazy-load-no-trans: true - database-platform: org.hibernate.dialect.MySQL5InnoDBDialect - security: - usercredentials: - - - username: asdc - password: '$2a$12$4R2QhxH7elzoZYoC.HJKTOHYDoaC9LbJD44Q9/tm4t/UzPF9Cgifi' - role: Asdc-Client - - - username: mso_admin - password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' - role: ACTUATOR -request: - datasource: - jdbc-url: jdbc:mariadb://localhost:3306/requestdb - username: root - password: password - driver-class-name: org.mariadb.jdbc.Driver - initialize: true - initialization-mode: never - -#Actuator -management: - endpoints: - web: - base-path: /manage - server: - servlet: - context-path: /manage - metrics: - se-global-registry: false - export: - prometheus: - enabled: true # Whether exporting of metrics to Prometheus is enabled. - step: 1m # Step size (i.e. reporting frequency) to use. - - -mso: - logPath: logs - catalog: - db: - spring: - endpoint: "http://localhost:8090" - db: - auth: Basic YnBlbDptc28tZGItMTUwNyE= - site-name: siteName - aai: - endpoint: https://localhost:8443 - asdc-connections: - asdc-controller1: - user: msopreist - consumerGroup: msoasdc-id-local - consumerId: msoasdc-id-local - environmentName: Pre-IST - asdcAddress: localhost:8443 - password: CB655C3C236F1F0370A347E3A0E0E133BE10ADCF4D16377E7378D3FE46A4BF60C27DF1FFB4 - pollingInterval: 30 - pollingTimeout: 30 - relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL - useHttpsWithDmaap: true - activateServerTLSAuth: false - keyStorePassword: - keyStorePath: - watchDogTimeout: 1 - isFitlerInEmptyResources: true - messageBusAddress: localhost,localhost,localhost - asdc: - config: - key: 566B754875657232314F5548556D3665 - components: - count: 3, - componentNames: SO,AAI,SDNC - scheduling: - enabled: false diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java index 633736a25a..11b717c0d2 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java @@ -29,7 +29,7 @@ public class RollbackData implements Serializable { private static final long serialVersionUID = -4811571658272937718L; private String requestId; - private Map<String, String> additionalData = new HashMap<String, String>(); + private Map<String, String> additionalData = new HashMap<>(); public String getRequestId() { diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index 4e9e9fdf0e..d33e7aed0c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -45,8 +45,7 @@ public class WorkflowProcessor extends ProcessEngineAwareService { @Async public void startProcess(String processKey, VariableMapImpl variableMap) { - long startTime = System.currentTimeMillis(); - Map<String, Object> inputVariables = null; + Map<String, Object> inputVariables; String processInstanceId = null; try { inputVariables = getInputVariables(variableMap); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index 6572beaba9..a049f81906 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -52,8 +52,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @Configuration public class CXFConfiguration { - private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class); - @Autowired private Bus bus; diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index 33335ab2c4..ca0f8452cf 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -2,13 +2,12 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true"> <bpmn:startEvent id="DeleteVfModuleBB_Start"> - <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1oeootm</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Delete Vf Module VnfAdapter" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1n8gab5</bpmn:incoming> + <bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Prepare Request" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_028rmiu</bpmn:incoming> <bpmn:outgoing>SequenceFlow_08tvhtf</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1537yw5" sourceRef="DeleteVfModuleBB_Start" targetRef="ExclusiveGateway_0xrgzm7" /> <bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_01vfwtp</bpmn:incoming> <bpmn:outgoing>SequenceFlow_09l7pcg</bpmn:outgoing> @@ -70,44 +69,22 @@ <bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1n8gab5" sourceRef="ExclusiveGateway_0xrgzm7" targetRef="DeleteVfModuleVnfAdapter" /> - <bpmn:parallelGateway id="ExclusiveGateway_0xrgzm7"> - <bpmn:incoming>SequenceFlow_1537yw5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1n8gab5</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1v3jgqe</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:sequenceFlow id="SequenceFlow_032jv5j" name="Yes " sourceRef="ExclusiveGateway_1h2ystu" targetRef="Setup_Audit_Variable"> + <bpmn:sequenceFlow id="SequenceFlow_032jv5j" name="Yes " sourceRef="auditEnabledCheck" targetRef="Setup_Audit_Variable"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0qfmmgt" sourceRef="Audit_Inventory" targetRef="auditSuccessfulCheck" /> <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="aaiThrow" /> - <bpmn:sequenceFlow id="SequenceFlow_1mgunf3" name="No" sourceRef="ExclusiveGateway_1h2ystu" targetRef="ExclusiveGateway_1pydilb" /> <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isDeleteAuditNeeded(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1v3jgqe</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1odt2wt</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1oeootm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10af0fk</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1v3jgqe" sourceRef="ExclusiveGateway_0xrgzm7" targetRef="Check_Audit" /> - <bpmn:sequenceFlow id="SequenceFlow_1odt2wt" sourceRef="Check_Audit" targetRef="ExclusiveGateway_1h2ystu" /> - <bpmn:sequenceFlow id="SequenceFlow_1swistn" sourceRef="Setup_Audit_Variable" targetRef="Audit_Inventory" /> - <bpmn:serviceTask id="Audit_Inventory" name="Audit Inventory For Delete in AAI" camunda:type="external" camunda:topic="InventoryDeleteAudit"> - <bpmn:incoming>SequenceFlow_1swistn</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0qfmmgt</bpmn:outgoing> + <bpmn:serviceTask id="Audit_Inventory" name=" AAI Audit (vservers) " camunda:type="external" camunda:topic="InventoryDeleteAudit"> + <bpmn:incoming>SequenceFlow_0f5ljoh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hpj2mm</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Setup_Audit_Variable" name="Setup Audit Variable" camunda:expression="${AuditTasks.setupAuditVariable(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_032jv5j</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1swistn</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1iulltd</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1ut7n32" sourceRef="ExclusiveGateway_1pydilb" targetRef="ExclusiveGateway_1yvh16a" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_1h2ystu" name="Audit Enabled?" default="SequenceFlow_1mgunf3"> - <bpmn:incoming>SequenceFlow_1odt2wt</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_032jv5j</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1mgunf3</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:exclusiveGateway id="ExclusiveGateway_1pydilb"> - <bpmn:incoming>SequenceFlow_1mgunf3</bpmn:incoming> - <bpmn:incoming>SequenceFlow_17cd9e2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ut7n32</bpmn:outgoing> - </bpmn:exclusiveGateway> <bpmn:subProcess id="SubProcess_0grvkj2" name="Audit Exception Sub Process" triggeredByEvent="true"> <bpmn:endEvent id="EndEvent_1gzq57j"> <bpmn:incoming>SequenceFlow_1fhst92</bpmn:incoming> @@ -120,7 +97,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1fhst92" sourceRef="ServiceTask_1isbxvo" targetRef="EndEvent_1gzq57j" /> <bpmn:startEvent id="StartEvent_1euiddy" isInterrupting="false"> <bpmn:outgoing>SequenceFlow_0xuodpy</bpmn:outgoing> - <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" camunda:escalationCodeVariable="test" /> + <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" camunda:escalationCodeVariable="auditCode" /> </bpmn:startEvent> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_179btn2" sourceRef="aaiCatch" targetRef="DeleteNetworkPolicies" /> @@ -132,19 +109,14 @@ <bpmn:outgoing>SequenceFlow_179btn2</bpmn:outgoing> <bpmn:linkEventDefinition name="AAI" /> </bpmn:intermediateCatchEvent> - <bpmn:sequenceFlow id="SequenceFlow_17cd9e2" name="Yes/No" sourceRef="auditSuccessfulCheck" targetRef="ExclusiveGateway_1pydilb"> + <bpmn:sequenceFlow id="SequenceFlow_17cd9e2" name="Yes/No" sourceRef="auditSuccessfulCheck" targetRef="ExclusiveGateway_01wvywu"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful") == false || execution.getVariable("auditIsSuccessful") == true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1gdyk9j" name="No" sourceRef="auditSuccessfulCheck" targetRef="EndEvent_0b0ocu0"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful") == false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:inclusiveGateway id="ExclusiveGateway_1yvh16a"> - <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1ut7n32</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing> - </bpmn:inclusiveGateway> <bpmn:inclusiveGateway id="auditSuccessfulCheck" name="Audit Successful?"> - <bpmn:incoming>SequenceFlow_0qfmmgt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0hpj2mm</bpmn:incoming> <bpmn:outgoing>SequenceFlow_17cd9e2</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1gdyk9j</bpmn:outgoing> </bpmn:inclusiveGateway> @@ -152,6 +124,54 @@ <bpmn:incoming>SequenceFlow_1gdyk9j</bpmn:incoming> <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" /> </bpmn:endEvent> + <bpmn:exclusiveGateway id="auditEnabledCheck" name="Audit Enabled?" default="SequenceFlow_1bt1p2u"> + <bpmn:incoming>SequenceFlow_10af0fk</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_032jv5j</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1bt1p2u</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:exclusiveGateway id="ExclusiveGateway_1t9q2jl"> + <bpmn:incoming>SequenceFlow_1bt1p2u</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0dzf7hz</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1bq9g02</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1bt1p2u" name="No" sourceRef="auditEnabledCheck" targetRef="ExclusiveGateway_1t9q2jl" /> + <bpmn:sequenceFlow id="SequenceFlow_1oeootm" sourceRef="DeleteVfModuleBB_Start" targetRef="Check_Audit" /> + <bpmn:sequenceFlow id="SequenceFlow_10af0fk" sourceRef="Check_Audit" targetRef="auditEnabledCheck" /> + <bpmn:serviceTask id="aicQueryStack" name=" AIC Query (stack) " camunda:type="external" camunda:topic="InventoryQueryAudit"> + <bpmn:incoming>SequenceFlow_1iulltd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dzf7hz</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1iulltd" sourceRef="Setup_Audit_Variable" targetRef="aicQueryStack" /> + <bpmn:sequenceFlow id="SequenceFlow_0dzf7hz" sourceRef="aicQueryStack" targetRef="ExclusiveGateway_1t9q2jl" /> + <bpmn:sequenceFlow id="SequenceFlow_1bq9g02" sourceRef="ExclusiveGateway_1t9q2jl" targetRef="ExclusiveGateway_1naduhl" /> + <bpmn:sequenceFlow id="SequenceFlow_0mtzl4z" sourceRef="ExclusiveGateway_1naduhl" targetRef="ExclusiveGateway_13fhmpf" /> + <bpmn:sequenceFlow id="SequenceFlow_028rmiu" sourceRef="ExclusiveGateway_1naduhl" targetRef="DeleteVfModuleVnfAdapter" /> + <bpmn:parallelGateway id="ExclusiveGateway_1naduhl"> + <bpmn:incoming>SequenceFlow_1bq9g02</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mtzl4z</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_028rmiu</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_1yvh16a"> + <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> + <bpmn:incoming>SequenceFlow_13mlz57</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0hpj2mm" sourceRef="Audit_Inventory" targetRef="auditSuccessfulCheck" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_13fhmpf" name="Audit Enabled?" default="SequenceFlow_1gjwivp"> + <bpmn:incoming>SequenceFlow_0mtzl4z</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0f5ljoh</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1gjwivp</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0f5ljoh" name="Yes" sourceRef="ExclusiveGateway_13fhmpf" targetRef="Audit_Inventory"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_01wvywu"> + <bpmn:incoming>SequenceFlow_17cd9e2</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1gjwivp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13mlz57</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1gjwivp" name="No" sourceRef="ExclusiveGateway_13fhmpf" targetRef="ExclusiveGateway_01wvywu" /> + <bpmn:sequenceFlow id="SequenceFlow_13mlz57" sourceRef="ExclusiveGateway_01wvywu" targetRef="ExclusiveGateway_1yvh16a" /> </bpmn:process> <bpmn:error id="Error_0jjnve8" name="Error_3k24na6" errorCode="AAIInventoryFailure" /> <bpmn:escalation id="Escalation_130je8j" name="audit" escalationCode="audit1" /> @@ -164,40 +184,33 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter"> - <dc:Bounds x="382" y="303" width="100" height="80" /> + <dc:Bounds x="888" y="312" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1537yw5_di" bpmnElement="SequenceFlow_1537yw5"> - <di:waypoint xsi:type="dc:Point" x="195" y="284" /> - <di:waypoint xsi:type="dc:Point" x="282" y="284" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="194" y="263" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> <dc:Bounds x="907" y="468" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf"> - <di:waypoint xsi:type="dc:Point" x="482" y="343" /> - <di:waypoint xsi:type="dc:Point" x="511" y="343" /> + <di:waypoint xsi:type="dc:Point" x="988" y="352" /> + <di:waypoint xsi:type="dc:Point" x="1020" y="352" /> <bpmndi:BPMNLabel> - <dc:Bounds x="452" y="322" width="90" height="12" /> + <dc:Bounds x="959" y="331" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> - <dc:Bounds x="1136" y="490" width="36" height="36" /> + <dc:Bounds x="1268" y="490" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1109" y="530" width="90" height="0" /> + <dc:Bounds x="1241" y="530" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> - <dc:Bounds x="511" y="303" width="100" height="80" /> + <dc:Bounds x="1020" y="312" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87"> - <di:waypoint xsi:type="dc:Point" x="611" y="343" /> - <di:waypoint xsi:type="dc:Point" x="925" y="343" /> - <di:waypoint xsi:type="dc:Point" x="925" y="309" /> + <di:waypoint xsi:type="dc:Point" x="1120" y="352" /> + <di:waypoint xsi:type="dc:Point" x="1203" y="352" /> + <di:waypoint xsi:type="dc:Point" x="1203" y="309" /> <bpmndi:BPMNLabel> - <dc:Bounds x="723" y="328" width="90" height="0" /> + <dc:Bounds x="1116.5" y="337" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true"> @@ -234,9 +247,9 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg"> <di:waypoint xsi:type="dc:Point" x="1007" y="508" /> - <di:waypoint xsi:type="dc:Point" x="1136" y="508" /> + <di:waypoint xsi:type="dc:Point" x="1268" y="508" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1027" y="493" width="90" height="0" /> + <dc:Bounds x="1092.5" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk"> @@ -279,101 +292,29 @@ <bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> <dc:Bounds x="654" y="468" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1n8gab5_di" bpmnElement="SequenceFlow_1n8gab5"> - <di:waypoint xsi:type="dc:Point" x="307" y="309" /> - <di:waypoint xsi:type="dc:Point" x="307" y="343" /> - <di:waypoint xsi:type="dc:Point" x="382" y="343" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="277" y="320" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ParallelGateway_18x6mx2_di" bpmnElement="ExclusiveGateway_0xrgzm7"> - <dc:Bounds x="282" y="259" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="262" y="312" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_032jv5j_di" bpmnElement="SequenceFlow_032jv5j"> - <di:waypoint xsi:type="dc:Point" x="492" y="174" /> - <di:waypoint xsi:type="dc:Point" x="492" y="133" /> - <di:waypoint xsi:type="dc:Point" x="531" y="133" /> + <di:waypoint xsi:type="dc:Point" x="397" y="259" /> + <di:waypoint xsi:type="dc:Point" x="397" y="214" /> + <di:waypoint xsi:type="dc:Point" x="444" y="214" /> <bpmndi:BPMNLabel> - <dc:Bounds x="499" y="139" width="19" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0qfmmgt_di" bpmnElement="SequenceFlow_0qfmmgt"> - <di:waypoint xsi:type="dc:Point" x="754" y="133" /> - <di:waypoint xsi:type="dc:Point" x="780" y="133" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="722" y="111.5" width="90" height="13" /> + <dc:Bounds x="405.5348837209302" y="217.95121951219514" width="19" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14bu4ys_di" bpmnElement="SequenceFlow_14bu4ys"> - <di:waypoint xsi:type="dc:Point" x="950" y="284" /> - <di:waypoint xsi:type="dc:Point" x="1100" y="283" /> + <di:waypoint xsi:type="dc:Point" x="1228" y="284" /> + <di:waypoint xsi:type="dc:Point" x="1323" y="284" /> <bpmndi:BPMNLabel> - <dc:Bounds x="980" y="262" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1mgunf3_di" bpmnElement="SequenceFlow_1mgunf3"> - <di:waypoint xsi:type="dc:Point" x="492" y="224" /> - <di:waypoint xsi:type="dc:Point" x="492" y="257" /> - <di:waypoint xsi:type="dc:Point" x="868" y="257" /> - <di:waypoint xsi:type="dc:Point" x="868" y="224" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="503.9261744966443" y="237" width="14" height="12" /> + <dc:Bounds x="1230.5" y="262.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1vmz3zo_di" bpmnElement="Check_Audit"> - <dc:Bounds x="339" y="159" width="100" height="80" /> + <dc:Bounds x="244" y="244" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1v3jgqe_di" bpmnElement="SequenceFlow_1v3jgqe"> - <di:waypoint xsi:type="dc:Point" x="307" y="259" /> - <di:waypoint xsi:type="dc:Point" x="307" y="199" /> - <di:waypoint xsi:type="dc:Point" x="339" y="199" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="277" y="223" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1odt2wt_di" bpmnElement="SequenceFlow_1odt2wt"> - <di:waypoint xsi:type="dc:Point" x="439" y="199" /> - <di:waypoint xsi:type="dc:Point" x="467" y="199" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="408" y="178" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1swistn_di" bpmnElement="SequenceFlow_1swistn"> - <di:waypoint xsi:type="dc:Point" x="631" y="133" /> - <di:waypoint xsi:type="dc:Point" x="654" y="133" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="598" y="112" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1l8r2a6_di" bpmnElement="Audit_Inventory"> - <dc:Bounds x="654" y="93" width="100" height="80" /> + <dc:Bounds x="930" y="117" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1gttdjr_di" bpmnElement="Setup_Audit_Variable"> - <dc:Bounds x="531" y="93" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ut7n32_di" bpmnElement="SequenceFlow_1ut7n32"> - <di:waypoint xsi:type="dc:Point" x="893" y="199" /> - <di:waypoint xsi:type="dc:Point" x="925" y="199" /> - <di:waypoint xsi:type="dc:Point" x="925" y="259" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="864" y="177.5" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1olwkdn_di" bpmnElement="ExclusiveGateway_1h2ystu" isMarkerVisible="true"> - <dc:Bounds x="467" y="174" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="519" y="187" width="45" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1d1pmqz_di" bpmnElement="ExclusiveGateway_1pydilb" isMarkerVisible="true"> - <dc:Bounds x="843" y="174" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="733" y="227" width="90" height="13" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="444" y="174" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_0grvkj2_di" bpmnElement="SubProcess_0grvkj2" isExpanded="true"> <dc:Bounds x="231" y="642" width="350" height="200" /> @@ -409,9 +350,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1sftyjz_di" bpmnElement="aaiThrow"> - <dc:Bounds x="1100" y="266" width="36" height="36" /> + <dc:Bounds x="1323" y="266" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1092" y="305" width="55" height="12" /> + <dc:Bounds x="1315" y="305" width="55" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_13y483m_di" bpmnElement="aaiCatch"> @@ -421,30 +362,26 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_17cd9e2_di" bpmnElement="SequenceFlow_17cd9e2"> - <di:waypoint xsi:type="dc:Point" x="830" y="133" /> - <di:waypoint xsi:type="dc:Point" x="868" y="133" /> - <di:waypoint xsi:type="dc:Point" x="868" y="174" /> + <di:waypoint xsi:type="dc:Point" x="1108" y="157" /> + <di:waypoint xsi:type="dc:Point" x="1156" y="157" /> + <di:waypoint xsi:type="dc:Point" x="1156" y="189" /> <bpmndi:BPMNLabel> - <dc:Bounds x="830" y="114" width="36" height="12" /> + <dc:Bounds x="1111.0434782608695" y="137" width="36" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1gdyk9j_di" bpmnElement="SequenceFlow_1gdyk9j"> - <di:waypoint xsi:type="dc:Point" x="805" y="108" /> - <di:waypoint xsi:type="dc:Point" x="805" y="56" /> + <di:waypoint xsi:type="dc:Point" x="1083" y="132" /> + <di:waypoint xsi:type="dc:Point" x="1083" y="109" /> + <di:waypoint xsi:type="dc:Point" x="1083" y="109" /> + <di:waypoint xsi:type="dc:Point" x="1083" y="84" /> <bpmndi:BPMNLabel> - <dc:Bounds x="812" y="77" width="14" height="12" /> + <dc:Bounds x="1083" y="110.74468085106383" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="InclusiveGateway_0cjvlht_di" bpmnElement="ExclusiveGateway_1yvh16a"> - <dc:Bounds x="900" y="259" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="879" y="312" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="InclusiveGateway_0i6rdd1_di" bpmnElement="auditSuccessfulCheck"> - <dc:Bounds x="780" y="108" width="50" height="50" /> + <dc:Bounds x="1058" y="132" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="775" y="162" width="60" height="24" /> + <dc:Bounds x="1053" y="186" width="60" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_04qhoba_di" bpmnElement="StartEvent_1euiddy"> @@ -454,11 +391,143 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1onxfk1_di" bpmnElement="EndEvent_0b0ocu0"> - <dc:Bounds x="787" y="20" width="36" height="36" /> + <dc:Bounds x="1065" y="48" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1024" y="87" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_05scr6c_di" bpmnElement="auditEnabledCheck" isMarkerVisible="true"> + <dc:Bounds x="371.6051332675222" y="259" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="421" y="272" width="45" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1t9q2jl_di" bpmnElement="ExclusiveGateway_1t9q2jl" isMarkerVisible="true"> + <dc:Bounds x="697" y="259" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="677" y="313" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1bt1p2u_di" bpmnElement="SequenceFlow_1bt1p2u"> + <di:waypoint xsi:type="dc:Point" x="397" y="309" /> + <di:waypoint xsi:type="dc:Point" x="397" y="352" /> + <di:waypoint xsi:type="dc:Point" x="722" y="352" /> + <di:waypoint xsi:type="dc:Point" x="722" y="309" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="407" y="326" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1oeootm_di" bpmnElement="SequenceFlow_1oeootm"> + <di:waypoint xsi:type="dc:Point" x="195" y="284" /> + <di:waypoint xsi:type="dc:Point" x="244" y="284" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="219.5" y="263" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_10af0fk_di" bpmnElement="SequenceFlow_10af0fk"> + <di:waypoint xsi:type="dc:Point" x="344" y="284" /> + <di:waypoint xsi:type="dc:Point" x="372" y="284" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="358" y="263" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1l7z1c0_di" bpmnElement="aicQueryStack"> + <dc:Bounds x="571" y="174" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1iulltd_di" bpmnElement="SequenceFlow_1iulltd"> + <di:waypoint xsi:type="dc:Point" x="544" y="214" /> + <di:waypoint xsi:type="dc:Point" x="571" y="214" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="557.5" y="193" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0dzf7hz_di" bpmnElement="SequenceFlow_0dzf7hz"> + <di:waypoint xsi:type="dc:Point" x="671" y="214" /> + <di:waypoint xsi:type="dc:Point" x="722" y="214" /> + <di:waypoint xsi:type="dc:Point" x="722" y="259" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="651.5" y="193" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1bq9g02_di" bpmnElement="SequenceFlow_1bq9g02"> + <di:waypoint xsi:type="dc:Point" x="747" y="284" /> + <di:waypoint xsi:type="dc:Point" x="796" y="284" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="726.5" y="263" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0mtzl4z_di" bpmnElement="SequenceFlow_0mtzl4z"> + <di:waypoint xsi:type="dc:Point" x="821" y="259" /> + <di:waypoint xsi:type="dc:Point" x="821" y="214" /> + <di:waypoint xsi:type="dc:Point" x="846" y="214" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="791" y="231" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_028rmiu_di" bpmnElement="SequenceFlow_028rmiu"> + <di:waypoint xsi:type="dc:Point" x="821" y="309" /> + <di:waypoint xsi:type="dc:Point" x="821" y="352" /> + <di:waypoint xsi:type="dc:Point" x="888" y="352" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="791" y="324.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ParallelGateway_1we1ooj_di" bpmnElement="ExclusiveGateway_1naduhl"> + <dc:Bounds x="796" y="259" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="760" y="59" width="0" height="12" /> + <dc:Bounds x="775" y="313" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_07wvmp4_di" bpmnElement="ExclusiveGateway_1yvh16a"> + <dc:Bounds x="1178" y="259" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1067" y="312" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0hpj2mm_di" bpmnElement="SequenceFlow_0hpj2mm"> + <di:waypoint xsi:type="dc:Point" x="1030" y="157" /> + <di:waypoint xsi:type="dc:Point" x="1058" y="157" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="999" y="136" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_13fhmpf_di" bpmnElement="ExclusiveGateway_13fhmpf" isMarkerVisible="true"> + <dc:Bounds x="846" y="189" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="898" y="202" width="45" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0f5ljoh_di" bpmnElement="SequenceFlow_0f5ljoh"> + <di:waypoint xsi:type="dc:Point" x="871" y="189" /> + <di:waypoint xsi:type="dc:Point" x="871" y="157" /> + <di:waypoint xsi:type="dc:Point" x="930" y="157" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="877.601615925754" y="162.89580806038546" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_01wvywu_di" bpmnElement="ExclusiveGateway_01wvywu" isMarkerVisible="true"> + <dc:Bounds x="1131" y="189" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1111" y="243" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1gjwivp_di" bpmnElement="SequenceFlow_1gjwivp"> + <di:waypoint xsi:type="dc:Point" x="871" y="239" /> + <di:waypoint xsi:type="dc:Point" x="871" y="266" /> + <di:waypoint xsi:type="dc:Point" x="1156" y="266" /> + <di:waypoint xsi:type="dc:Point" x="1156" y="239" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="879" y="244" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_13mlz57_di" bpmnElement="SequenceFlow_13mlz57"> + <di:waypoint xsi:type="dc:Point" x="1181" y="214" /> + <di:waypoint xsi:type="dc:Point" x="1203" y="214" /> + <di:waypoint xsi:type="dc:Point" x="1203" y="259" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1147" y="193" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java index 051f373eaf..bd29e5570a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -93,8 +95,7 @@ public class WorkflowActionBBTest extends BaseBPMNTest { Map<String, String> map = new HashMap<>(); map.put("handlingCode", "Abort"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure) - .abortCallErrorHandling(any(DelegateExecution.class)); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure).abortCallErrorHandling(); mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java index d9166c9138..47d0ad9b7f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java @@ -46,18 +46,20 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest { mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") - .topic("InventoryDeleteAudit", 60L * 1000L).execute(); + .topic("InventoryDeleteAudit", 60L * 1000L).topic("InventoryQueryAudit", 60L * 1000L).execute(); while (!tasks.isEmpty()) { for (LockedExternalTask task : tasks) { externalTaskService.complete(task.getId(), "externalWorkerId"); } tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L) - .execute(); + .topic("InventoryQueryAudit", 60L * 1000L).execute(); } assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "ExclusiveGateway_0xrgzm7", - "ExclusiveGateway_1yvh16a", "Check_Audit", "Setup_Audit_Variable", "Audit_Inventory", - "DeleteVfModuleVnfAdapter", "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", + assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "Check_Audit", "auditEnabledCheck", + "Setup_Audit_Variable", "Setup_Audit_Variable", "aicQueryStack", "ExclusiveGateway_1t9q2jl", + "ExclusiveGateway_1naduhl", "ExclusiveGateway_13fhmpf", "DeleteVfModuleVnfAdapter", "VnfAdapter", + "Audit_Inventory", "ExclusiveGateway_1yvh16a", "auditSuccessfulCheck", "ExclusiveGateway_01wvywu", + "ExclusiveGateway_1yvh16a", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); @@ -68,19 +70,22 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest { doThrow(BpmnError.class).when(vnfAdapterDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") - .topic("InventoryDeleteAudit", 60L * 1000L).execute(); + .topic("InventoryDeleteAudit", 60L * 1000L).topic("InventoryQueryAudit", 60L * 1000L).execute(); while (!tasks.isEmpty()) { for (LockedExternalTask task : tasks) { externalTaskService.complete(task.getId(), "externalWorkerId"); } tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L) - .execute(); + .topic("InventoryQueryAudit", 60L * 1000L).execute(); } assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter").hasNotPassed( - "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", - "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", - "DeleteVfModuleBB_End"); + assertThat(pi).isStarted() + .hasPassed("DeleteVfModuleBB_Start", "Check_Audit", "auditEnabledCheck", "Setup_Audit_Variable", + "Setup_Audit_Variable", "aicQueryStack", "ExclusiveGateway_1t9q2jl", "ExclusiveGateway_1naduhl", + "ExclusiveGateway_13fhmpf") + .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn", + "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java index ad388feffc..c7c12bf4e7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java @@ -37,7 +37,7 @@ public class NsParameters { private List<LocationConstraint> locationConstraints; - private Map<String, Object> additionalParamForNs = new HashMap<String, Object>(); + private Map<String, Object> additionalParamForNs = new HashMap<>(); /** * @return Returns the locationConstraints. diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 22c4f95a6f..8fe7e4f868 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -26,6 +26,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import java.io.IOException; +import java.io.InputStream; import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.Collections; @@ -34,6 +35,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; +import java.util.Properties; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.ParseException; @@ -73,13 +75,9 @@ import org.springframework.web.util.UriUtils; public class ServicePluginFactory { - // SOTN calculate route - public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc"; - - public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; - - public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory"; - + private static String OOF_DEFAULT_ENDPOINT; + private static String THIRD_SP_DEFAULT_ENDPOINT; + private static String INVENTORY_OSS_DEFAULT_ENDPOINT; private static final int DEFAULT_TIME_OUT = 60000; static JsonUtils jsonUtil = new JsonUtils(); @@ -88,6 +86,17 @@ public class ServicePluginFactory { private static ServicePluginFactory instance; + static { + try (InputStream is = ClassLoader.class.getResourceAsStream("/application.properties")) { + Properties prop = new Properties(); + prop.load(is); + OOF_DEFAULT_ENDPOINT = prop.getProperty("oof.default.endpoint"); + THIRD_SP_DEFAULT_ENDPOINT = prop.getProperty("third.sp.default.endpoint"); + INVENTORY_OSS_DEFAULT_ENDPOINT = prop.getProperty("inventory.oss.default.endpoint"); + } catch (IOException e) { + e.printStackTrace(); + } + } public static synchronized ServicePluginFactory getInstance() { if (null == instance) { @@ -802,4 +811,5 @@ public class ServicePluginFactory { } } } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/resources/application.properties b/bpmn/so-bpmn-infrastructure-common/src/main/resources/application.properties new file mode 100644 index 0000000000..87af45139c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/resources/application.properties @@ -0,0 +1,3 @@ +oof.default.endpoint=http://192.168.1.223:8443/oof/sotncalc +third.sp.default.endpoint=http://192.168.1.223:8443/sp/resourcemgr/querytps +inventory.oss.default.endpoint=http://192.168.1.199:8443/oss/inventory diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java index 0b4050beec..1a75f125f6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.workflow.service; import static org.mockito.Mockito.doReturn; +import org.apache.commons.lang.reflect.FieldUtils; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -154,4 +155,21 @@ public class ServicePluginFactoryTest { String result = servicePluginFactory.doServiceHoming(null, invalidJsonWithOnlyNeededValues); Assert.assertEquals(result, invalidJsonWithOnlyNeededValues); } + + @Test + public void verifyExternalConfigurationLoading() throws IllegalAccessException { + + ServicePluginFactory servicePluginFactory = ServicePluginFactory.getInstance(); + + String oofDefaultEndpoint = (String) FieldUtils.readField(servicePluginFactory, "OOF_DEFAULT_ENDPOINT", true); + Assert.assertNotNull(oofDefaultEndpoint); + + String thirdSpDefaultEndpoint = + (String) FieldUtils.readField(servicePluginFactory, "THIRD_SP_DEFAULT_ENDPOINT", true); + Assert.assertNotNull(thirdSpDefaultEndpoint); + + String inventoryOssDefaultEndpoint = + (String) FieldUtils.readField(servicePluginFactory, "INVENTORY_OSS_DEFAULT_ENDPOINT", true); + Assert.assertNotNull(inventoryOssDefaultEndpoint); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index e3540ecc58..583e3e172a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -77,7 +77,6 @@ public class AAICreateTasks { private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class); private static final String networkTypeProvider = "PROVIDER"; - private static final String A_LA_CARTE = "aLaCarte"; private static String NETWORK_COLLECTION_NAME = "networkCollectionName"; private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; private static String HEAT_STACK_ID = "heatStackId"; @@ -107,12 +106,8 @@ public class AAICreateTasks { public void createServiceInstance(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - if (Boolean.TRUE.equals(alaCarte) && aaiSIResources.checkInstanceServiceNameInUse(serviceInstance)) { - throw new DuplicateNameException("service-instance", serviceInstance.getServiceInstanceName()); - } Customer customer = execution.getGeneralBuildingBlock().getCustomer(); aaiSIResources.createServiceInstance(serviceInstance, customer); } catch (Exception ex) { @@ -199,11 +194,7 @@ public class AAICreateTasks { public void createVnf(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - if (Boolean.TRUE.equals(alaCarte) && aaiVnfResources.checkNameInUse(vnf.getVnfName())) { - throw new DuplicateNameException("generic-vnf", vnf.getVnfName()); - } ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); execution.setVariable("homing", Boolean.TRUE.equals(vnf.isCallHoming())); @@ -262,10 +253,6 @@ public class AAICreateTasks { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - Boolean alaCarte = execution.getVariable(A_LA_CARTE); - if (Boolean.TRUE.equals(alaCarte) && aaiVolumeGroupResources.checkNameInUse(volumeGroup)) { - throw new DuplicateNameException("volume-group", volumeGroup.getVolumeGroupName()); - } aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion); aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion); @@ -278,10 +265,6 @@ public class AAICreateTasks { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - Boolean alaCarte = execution.getVariable(A_LA_CARTE); - if (Boolean.TRUE.equals(alaCarte) && aaiVfModuleResources.checkNameInUse(vfModule)) { - throw new DuplicateNameException("vf-module", vfModule.getVfModuleName()); - } int moduleIndex = 0; if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) { @@ -327,14 +310,9 @@ public class AAICreateTasks { */ public void createNetwork(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); - if (Boolean.TRUE.equals(alaCarte) - && aaiNetworkResources.checkNetworkNameInUse(l3network.getNetworkName())) { - throw new DuplicateNameException("l3Network", l3network.getNetworkName()); - } // set default to false. ToBe updated by SDNC l3network.setIsBoundToVpn(false); // define is bound to vpn flag as true if NEUTRON_NETWORK_TYPE is PROVIDER @@ -385,16 +363,11 @@ public class AAICreateTasks { */ public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup(); // set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME)); - if (Boolean.TRUE.equals(alaCarte) - && aaiInstanceGroupResources.checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName())) { - throw new DuplicateNameException("instance-group", instanceGroup.getInstanceGroupName()); - } // put shell in AAI aaiNetworkResources.createNetworkInstanceGroup(instanceGroup); } catch (Exception ex) { @@ -511,12 +484,7 @@ public class AAICreateTasks { public void createConfiguration(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); - if (Boolean.TRUE.equals(alaCarte) - && aaiConfigurationResources.checkConfigurationNameInUse(configuration.getConfigurationName())) { - throw new DuplicateNameException("configuration", configuration.getConfigurationName()); - } aaiConfigurationResources.createConfiguration(configuration); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -525,14 +493,9 @@ public class AAICreateTasks { public void createInstanceGroupVnf(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); - if (Boolean.TRUE.equals(alaCarte) - && aaiInstanceGroupResources.checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName())) { - throw new DuplicateNameException("instance-group", instanceGroup.getInstanceGroupName()); - } aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java index 12aade71bc..1add5e6d24 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java @@ -35,7 +35,6 @@ import org.springframework.stereotype.Component; @Component public class AAIFlagTasks { - private static final Logger logger = LoggerFactory.getLogger(AAIFlagTasks.class); @Autowired private AAIVnfResources aaiVnfResources; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java index 62878fd4f7..922b721098 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java @@ -21,15 +21,21 @@ package org.onap.so.bpmn.infrastructure.audit; +import java.util.List; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -83,12 +89,17 @@ public class AuditTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); + auditInventory.setMsoRequestId(gBBInput.getRequestContext().getMsoRequestId()); auditInventory.setCloudOwner(cloudRegion.getCloudOwner()); auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId()); auditInventory.setTenantId(cloudRegion.getTenantId()); + auditInventory.setVfModuleId(vfModule.getVfModuleId()); auditInventory.setHeatStackName(vfModule.getVfModuleName()); + auditInventory.setGenericVnfId(genericVnf.getVnfId()); return auditInventory; } + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index 7d5591af0f..4721bf56f1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -91,16 +91,18 @@ public class SDNCUnassignTasks { public void unassignVfModule(BuildingBlockExecution execution) { try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + RequestContext requestContext = gBBInput.getRequestContext(); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); SDNCRequest sdncRequest = new SDNCRequest(); UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); URI uri = builder.build(); GenericResourceApiVfModuleOperationInformation req = - sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, uri); + sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, uri); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java index 2d3f5de616..be3e06c9ea 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -143,10 +145,10 @@ public class WorkflowActionBBFailure { String errorMsg = null; try { WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); - if (exception != null && (exception.getErrorMessage() != null || !exception.getErrorMessage().equals(""))) { + if (exception != null && (exception.getErrorMessage() != null || !"".equals(exception.getErrorMessage()))) { errorMsg = exception.getErrorMessage(); } - if (errorMsg == null || errorMsg.equals("")) { + if (errorMsg == null || "".equals(errorMsg)) { errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); } if (errorMsg == null) { @@ -165,7 +167,7 @@ public class WorkflowActionBBFailure { updateRequestStatusToFailed(execution); } - public void abortCallErrorHandling(DelegateExecution execution) { + public void abortCallErrorHandling() { String msg = "Flow has failed. Rainy day handler has decided to abort the process."; logger.error(msg); throw new BpmnError(msg); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java index b83a4d5628..b3ea18df58 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java @@ -60,9 +60,9 @@ public class SDNCVfModuleResources { } public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf, - ServiceInstance serviceInstance, URI callbackURI) throws MapperException { + ServiceInstance serviceInstance, RequestContext requestContext, URI callbackURI) throws MapperException { return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, - vnf, serviceInstance, null, null, null, null, callbackURI); + vnf, serviceInstance, null, null, requestContext, null, callbackURI); } public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf, diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index 825c703b74..4f1ad996dc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -159,7 +159,7 @@ public class TestDataSetup { public RequestContext buildRequestContext() { RequestContext requestContext = new RequestContext(); - requestContext.setMsoRequestId(UUID.randomUUID().toString()); + requestContext.setMsoRequestId("fb06f44c-c797-4f38-9b17-b4b975344600"); requestContext.setProductFamilyId("testProductFamilyId"); requestContext.setRequestorId("testRequestorId"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index b889493d2e..ed3ec759c3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -60,7 +60,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; -import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.client.aai.entities.uri.AAIResourceUri; @@ -130,14 +129,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createServiceInstanceNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiServiceInstanceResources).checkInstanceServiceNameInUse(serviceInstance); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createServiceInstance(execution); - } - - @Test public void createServiceInstanceExceptionTest() throws Exception { expectedException.expect(BpmnError.class); @@ -162,14 +153,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createVolumeGroupDuplicateNameTest() throws Exception { - expectedException.expect(BpmnError.class); - execution.setVariable("aLaCarte", Boolean.TRUE); - doReturn(true).when(aaiVolumeGroupResources).checkNameInUse(volumeGroup); - aaiCreateTasks.createVolumeGroup(execution); - } - - @Test public void createVolumeGroupExceptionTest() throws Exception { expectedException.expect(BpmnError.class); @@ -349,14 +332,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createVnfDuplicateNameTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiVnfResources).checkNameInUse(genericVnf.getVnfName()); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createVnf(execution); - } - - @Test public void createVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound"); @@ -386,14 +361,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createVfModuleDuplicateNameTest() throws Exception { - expectedException.expect(BpmnError.class); - execution.setVariable("aLaCarte", Boolean.TRUE); - doReturn(true).when(aaiVfModuleResources).checkNameInUse(vfModule); - aaiCreateTasks.createVfModule(execution); - } - - @Test public void createServiceSubscriptionTest() { doNothing().when(aaiServiceInstanceResources).createServiceSubscription(customer); aaiCreateTasks.createServiceSubscription(execution); @@ -441,14 +408,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createNetworkNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - execution.setVariable("aLaCarte", Boolean.TRUE); - doReturn(true).when(aaiNetworkResources).checkNetworkNameInUse(network.getNetworkName()); - aaiCreateTasks.createNetwork(execution); - } - - @Test public void createNetworkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); @@ -560,15 +519,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createConfigurationNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiConfigurationResources) - .checkConfigurationNameInUse(configuration.getConfigurationName()); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createConfiguration(execution); - } - - @Test public void connectVnfToCloudRegionTest() throws Exception { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); @@ -609,15 +559,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createInstanceGroupVnfNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiInstanceGroupResources) - .checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName()); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createInstanceGroupVnf(execution); - } - - @Test public void createInstanceGroupVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiInstanceGroupResources) diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java index 3bf24291ea..cee06caa75 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java @@ -7,9 +7,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,14 +21,20 @@ package org.onap.so.bpmn.infrastructure.audit; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +import java.util.ArrayList; +import java.util.List; +import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mockito; +import org.onap.aai.domain.yang.Vserver; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -36,6 +42,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; +import com.fasterxml.jackson.core.JsonProcessingException; public class AuditTasksTest extends BaseTaskTest { @@ -50,16 +61,29 @@ public class AuditTasksTest extends BaseTaskTest { public final ExpectedException exception = ExpectedException.none(); @Before - public void before() throws BBObjectNotFoundException { + public void before() throws BBObjectNotFoundException, JsonProcessingException { serviceInstance = setServiceInstance(); genericVnf = setGenericVnf(); vfModule = setVfModule(); + buildRequestContext(); setCloudRegion(); + setRequestContext(); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))) .thenReturn(genericVnf); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); + execution.setVariable("auditQuerySuccess", true); + AAIObjectAuditList auditList = new AAIObjectAuditList(); + auditList.setHeatStackName("testHeatStackName"); + AAIObjectAudit audit = new AAIObjectAudit(); + Vserver vserver = new Vserver(); + vserver.setVserverId("testVserverId"); + audit.setAaiObject(vserver); + auditList.getAuditList().add(audit); + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + String auditListString = objectMapper.getMapper().writeValueAsString(audit); + execution.setVariable("auditList", auditListString); } @Test @@ -68,8 +92,12 @@ public class AuditTasksTest extends BaseTaskTest { expectedAuditInventory.setCloudOwner("testCloudOwner"); expectedAuditInventory.setCloudRegion("testLcpCloudRegionId"); expectedAuditInventory.setHeatStackName("testVfModuleName1"); + expectedAuditInventory.setVfModuleId("testVfModuleId1"); expectedAuditInventory.setTenantId("testTenantId"); + expectedAuditInventory.setGenericVnfId("testVnfId1"); + expectedAuditInventory.setMsoRequestId("fb06f44c-c797-4f38-9b17-b4b975344600"); auditTasks.setupAuditVariable(execution); assertThat((AuditInventory) execution.getVariable("auditInventory"), sameBeanAs(expectedAuditInventory)); } + } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java index 10c034dc36..b29d15c830 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java @@ -106,11 +106,11 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { @Test public void unassignVfModuleTest() throws Exception { - doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources) - .unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), any(URI.class)); + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).unassignVfModule( + eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(requestContext), any(URI.class)); sdncUnassignTasks.unassignVfModule(execution); verify(sdncVfModuleResources, times(1)).unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), - any(URI.class)); + eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology()); } @@ -119,7 +119,7 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { public void unassignVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(eq(vfModule), eq(genericVnf), - eq(serviceInstance), any(URI.class)); + eq(serviceInstance), eq(requestContext), any(URI.class)); sdncUnassignTasks.unassignVfModule(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java index 57d6496a4f..14e993281a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java @@ -98,10 +98,12 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup { @Test public void unassignVfModuleTest() throws MapperException { doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null, testURI); - sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, testURI); + SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, requestContext, null, + testURI); + sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, testURI); verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null, testURI); + SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, requestContext, null, + testURI); } @Test diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index 20e8fed32d..e9cd303c0b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -88,9 +88,9 @@ public class CloudResourcesOrchestration { public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException { TenantIsolationRequest msoRequest = new TenantIsolationRequest(requestId); - InfraActiveRequests infraActiveRequest = null; + InfraActiveRequests infraActiveRequest; - CloudOrchestrationRequest cor = null; + CloudOrchestrationRequest cor; logger.debug("requestId is: {}", requestId); @@ -140,8 +140,8 @@ public class CloudResourcesOrchestration { } else { String status = infraActiveRequest.getRequestStatus(); - if (status.equalsIgnoreCase("IN_PROGRESS") || status.equalsIgnoreCase("PENDING") - || status.equalsIgnoreCase("PENDING_MANUAL_TASK")) { + if ("IN_PROGRESS".equalsIgnoreCase(status) || "PENDING".equalsIgnoreCase(status) + || "PENDING_MANUAL_TASK".equalsIgnoreCase(status)) { infraActiveRequest.setRequestStatus("UNLOCKED"); infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER); infraActiveRequest.setRequestId(requestId); @@ -181,8 +181,7 @@ public class CloudResourcesOrchestration { String requestId = requestIdKey.get(0); CloudOrchestrationResponse cloudOrchestrationGetResponse = new CloudOrchestrationResponse(); - TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest(requestId); - InfraActiveRequests requestDB = null; + InfraActiveRequests requestDB; try { requestDB = requestDbClient.getInfraActiveRequestbyRequestId(requestId); @@ -213,8 +212,8 @@ public class CloudResourcesOrchestration { } else { TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest(); - List<InfraActiveRequests> activeRequests = null; - CloudOrchestrationRequestList orchestrationList = null; + List<InfraActiveRequests> activeRequests; + CloudOrchestrationRequestList orchestrationList; Map<String, String> orchestrationMap; @@ -233,7 +232,7 @@ public class CloudResourcesOrchestration { } activeRequests = requestDbClient.getCloudOrchestrationFiltersFromInfraActive(orchestrationMap); orchestrationList = new CloudOrchestrationRequestList(); - List<CloudOrchestrationResponse> requestLists = new ArrayList<CloudOrchestrationResponse>(); + List<CloudOrchestrationResponse> requestLists = new ArrayList<>(); for (InfraActiveRequests infraActive : activeRequests) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml deleted file mode 100644 index a39d28038c..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml +++ /dev/null @@ -1,179 +0,0 @@ -# will be used as entry in DB to say SITE OFF/ON for healthcheck
-
-server:
- port: 8080
- tomcat:
- max-threads: 50
-ssl-enable: false
-
-apih-healthcheck-urn: /ecomp/mso/healthcheck,/ecomp/mso/homing/healthcheck,/ecomp/mso/infra/healthcheck,/asdc/healthcheck,/dbadapters/healthcheck,/ecomp/mso/catalog/v2/healthcheck
-jra-healthcheck-urn: /networks/rest/healthcheck,/adapters/rest/healthcheck,/vnfs/rest/healthcheck,/tenants/rest/healthcheck,/appc/rest/healthcheck,/workflows/messages/healthcheck
-camunda-healthcheck-urn: /mso/healthcheck
-
-apih-nodehealthcheck-urn: /ecomp/mso/infra/nodehealthcheck
-jra-nodehealthcheck-urn: /adapters/rest/nodehealthcheck
-camunda-nodehealthcheck-urn: /mso/nodehealthcheck
-
-
-
-mso:
- health:
- endpoints:
- catalogdb: http://localhost:8800
- sdnc: http://localhost:8400
- openstack: http://localhost:8300
- requestdb: http://localhost:8700
- bpmn: http://localhost:8200
- asdc: http://localhost:8400
- requestdbattsvc: http://localhost:8600
-
- adapters:
- requestDb:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- endpoint: http://localhost:8081
- logPath: logs
- site-name: mtanj
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8080"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- config:
- path: /src/main/resources/
- infra:
- default:
- alacarte:
- orchestrationUri: /mso/async/services/ALaCarteOrchestrator
- recipeTimeout: 180
- testApi: VNF_API
- service:
- macro:
- default:
- testApi: GR_API
- apih:
- homing:
- sdna:
- url: http://localhost:8089/
- password: 4E0BDC08EE8EDC0572ABBE9FD2D59B62DB725A00B8469E39393D6C86D64284C5D34A57D56F7B58C375316F
- camundaURL: http://localhost:8089/
- camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE
- async:
- core-pool-size: 50
- max-pool-size: 50
- queue-capacity: 500
- sdc:
- client:
- auth: 97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF
- activate:
- instanceid: test
- userid: cs0008
- endpoint: http://localhost:28090
- msoKey: 07a7159d3bf51a0e53be7a8f89699be7
- tenant:
- isolation:
- retry:
- count: 3
- aai:
- endpoint: http://localhost:28090
- auth: 5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
- grm:
- endpoint: http://localhost:28090
- username: gmruser
- password: test
- so:
- operational-environment:
- dmaap:
- username: testuser
- password: VjR5NDcxSzA=
- host: http://localhost:28090
- publisher:
- topic: com.att.ecomp.mso.operationalEnvironmentEvent
-
-# controls what actions the infra API (APIH) allows sent in on REST request
-vnf:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-network:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-volume:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-# H2
-spring:
- datasource:
- url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
- h2:
- console:
- enabled: true
- path: /h2
-
- jpa:
- show-sql: true
- hibernate:
- dialect: org.hibernate.dialect.H2Dialect
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable_lazy_load_no_trans: true
- jersey:
- type: filter
- security:
- usercredentials:
- -
- username: sitecontrol
- password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu'
- role: SiteControl-Client
- -
- username: gui
- password: '$2a$12$9Y4daXavh.oX5fz6t/e7TuCdj7EKW5B5ibqq425fN3/xpp0/Fhyti'
- role: GUI-Client
- -
- username: infraportal
- password: '$2a$12$IpUEhQijWTNbq0fGYVkA9upZrDvdIK6QfblIaKAiwi0vBQRE.C6Ri'
- role: InfraPortal-Client
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-request:
- datasource:
- url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
-
-#Actuator
-management:
- context-path: /manage
-
-org:
- onap:
- so:
- adapters:
- network:
- encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
diff --git a/mso-api-handlers/mso-requests-db-repositories/pom.xml b/mso-api-handlers/mso-requests-db-repositories/pom.xml index f890dabedd..4dbf22cd87 100644 --- a/mso-api-handlers/mso-requests-db-repositories/pom.xml +++ b/mso-api-handlers/mso-requests-db-repositories/pom.xml @@ -30,7 +30,6 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> - <optional>true</optional> </dependency> <dependency> <groupId>com.h2database</groupId> diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/configuration/ExposeEntityIdResourceConfiguration.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/configuration/ExposeEntityIdResourceConfiguration.java new file mode 100644 index 0000000000..575e5ff347 --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/configuration/ExposeEntityIdResourceConfiguration.java @@ -0,0 +1,21 @@ +package org.onap.so.db.request.configuration; + +import org.onap.so.db.request.beans.RequestProcessingData; +import org.springframework.data.rest.core.config.RepositoryRestConfiguration; +import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter; +import org.springframework.stereotype.Component; + +@Component +public class ExposeEntityIdResourceConfiguration extends RepositoryRestConfigurerAdapter { + + /** + * Spring Data Rest hides the ID by default, in order to have it in the JSON you have to manually configure that for + * your entity + * + * @param config + */ + @Override + public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { + config.exposeIdsFor(RequestProcessingData.class); + } +} diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java index ba2d021010..708171366d 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java @@ -7,9 +7,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. @@ -38,4 +38,7 @@ public interface RequestProcessingDataRepository extends JpaRepository<RequestPr @Param("NAME") String name); List<RequestProcessingData> findBySoRequestIdOrderByGroupingIdDesc(@Param("SO_REQUEST_ID") String soRequestId); + + List<RequestProcessingData> findByGroupingIdAndNameAndTag(@Param("GROUPING_ID") String groupingId, + @Param("NAME") String name, @Param("TAG") String tag); } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index c0ce59dc66..4d16d9c272 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -7,9 +7,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. @@ -26,6 +26,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; import javax.annotation.PostConstruct; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; @@ -72,6 +74,7 @@ public class RequestsDbClient { private static final String REQUEST_ID = "REQUEST_ID"; private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENV_ID"; private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID"; + private static final String TAG = "TAG"; private static final String FLOW_EXECUTION_PATH = "flowExecutionPath"; private static final String BPMN_EXECUTION_DATA_TAG = "BPMNExecutionData"; @@ -119,6 +122,8 @@ public class RequestsDbClient { private static final String findBySoRequestIdOrderByGroupingIdDesc = "/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc"; + private static final String findByGroupingIdAndNameAndTag = + "/requestProcessingData/search/findByGroupingIdAndNameAndTag"; @Autowired protected RestTemplate restTemplate; @@ -349,7 +354,7 @@ public class RequestsDbClient { public void updateRequestProcessingData(RequestProcessingData requestProcessingData) { HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(requestProcessingDataURI); + URI uri = getUri(requestProcessingDataURI + "/" + requestProcessingData.getId()); HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers); restTemplate.put(uri, entity); } @@ -368,6 +373,20 @@ public class RequestsDbClient { .queryParam(GROUPING_ID, groupingId).build().toString())); } + public List<RequestProcessingData> getRequestProcessingDataByGroupingIdAndNameAndTag(String groupingId, String name, + String tag) { + Iterable<RequestProcessingData> requestProcessingDataListIt = + getClientFactory().create(RequestProcessingData.class) + .getAll(getUri(UriBuilder.fromUri(endpoint + findByGroupingIdAndNameAndTag) + .queryParam(GROUPING_ID, groupingId).queryParam(NAME, name).queryParam(TAG, tag).build() + .toString())); + + List<RequestProcessingData> requestProcessingDataList = + StreamSupport.stream(requestProcessingDataListIt.spliterator(), false).collect(Collectors.toList()); + + return requestProcessingDataList; + } + public RequestProcessingData getRequestProcessingDataBySoRequestIdAndName(String soRequestId, String name) { return getClientFactory().create(RequestProcessingData.class) .get(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdAndName) diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java new file mode 100644 index 0000000000..fdbc04acb4 --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java @@ -0,0 +1,35 @@ +package org.onap.so.db.request.client; + +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.times; +import java.net.URI; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.db.request.beans.RequestProcessingData; +import org.springframework.http.HttpEntity; +import org.springframework.web.client.RestTemplate; + + +@RunWith(MockitoJUnitRunner.class) +public class RequestDbClientTest { + + @InjectMocks + protected RequestsDbClient requestsDbClient; + + @Mock + protected RestTemplate restTemplate; + + @Test + public void updateRequestProcessingDataTest() { + RequestProcessingData requestProcessingData = new RequestProcessingData(); + requestProcessingData.setId(1); + URI uri = URI.create("/requestProcessingData/1"); + requestsDbClient.updateRequestProcessingData(requestProcessingData); + Mockito.verify(restTemplate, times(1)).put(eq(uri), isA(HttpEntity.class)); + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 9c257bdec3..b82c17dc84 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -7,9 +7,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. @@ -170,4 +170,5 @@ public class CatalogDbClientTest { CvnfcCustomization aCvnfc = catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs); assertTrue(aCvnfc.getModelCustomizationUUID().equals("a123")); } + } diff --git a/vnfm-simulator/vnfm-service/pom.xml b/vnfm-simulator/vnfm-service/pom.xml index c09c5f070a..7beccb6561 100644 --- a/vnfm-simulator/vnfm-service/pom.xml +++ b/vnfm-simulator/vnfm-service/pom.xml @@ -144,5 +144,23 @@ <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + <excludes> + <exclude>**/*.p12</exclude> + <exclude>**/*.jks</exclude> + </excludes> + </resource> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + <includes> + <include>**/*.p12</include> + <include>**/*.jks</include> + </includes> + </resource> + </resources> </build> </project> diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java index 91b79754a5..32c05ebca8 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java @@ -4,6 +4,7 @@ import java.net.InetAddress; import java.util.Arrays; import org.onap.svnfm.simulator.constants.Constant; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.cache.Cache; @@ -19,6 +20,9 @@ public class ApplicationConfig implements ApplicationRunner { private static final String PORT = "local.server.port"; + @Value("${server.dns.name:so-vnfm-simulator.onap}") + private String serverDnsName; + @Autowired private Environment environment; @@ -26,7 +30,7 @@ public class ApplicationConfig implements ApplicationRunner { @Override public void run(final ApplicationArguments args) throws Exception { - baseUrl = "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty(PORT); + baseUrl = "https://" + serverDnsName + ":" + environment.getProperty(PORT); } public String getBaseUrl() { @@ -35,8 +39,8 @@ public class ApplicationConfig implements ApplicationRunner { @Bean public CacheManager cacheManager() { - Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE); - SimpleCacheManager manager = new SimpleCacheManager(); + final Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE); + final SimpleCacheManager manager = new SimpleCacheManager(); manager.setCaches(Arrays.asList(inlineResponse201)); return manager; } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java index 9c3a02d4e6..d3ff66aed0 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java @@ -168,6 +168,6 @@ public class SvnfmController { final HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); - return new ResponseEntity<>(response, headers, HttpStatus.OK); + return new ResponseEntity<>(response, headers, HttpStatus.CREATED); } } diff --git a/vnfm-simulator/vnfm-service/src/main/resources/application.yaml b/vnfm-simulator/vnfm-service/src/main/resources/application.yaml index 2ef302ce25..ea8105d891 100644 --- a/vnfm-simulator/vnfm-service/src/main/resources/application.yaml +++ b/vnfm-simulator/vnfm-service/src/main/resources/application.yaml @@ -34,6 +34,11 @@ server: port: 9093 tomcat: max-threads: 50 + ssl: + key-alias: so@so.onap.org + key--store-password: '7Em3&j4.19xYiMelhD5?xbQ.' + key-store: classpath:so-vnfm-simulator.p12 + key-store-type: PKCS12 vnfds: vnfdlist: @@ -56,4 +61,4 @@ vnfds: - vnfcid: VNFC4 resourceTemplateId: vnfd2_vnfc4 vduId: vnfd2_vduForVnfc4 - type: COMPUTE
\ No newline at end of file + type: COMPUTE diff --git a/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-simulator.p12 b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-simulator.p12 Binary files differnew file mode 100644 index 0000000000..7ac02855bc --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-simulator.p12 |