diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main')
61 files changed, 4448 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java new file mode 100644 index 0000000000..a47b16fc33 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.client.aai.AAIObjectType; +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; + +public class AAICreateResources extends AAIResource { + + + public void createAAIProject (String projectName, String serviceInstance){ + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); + + } + + public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + Map<String, String> hashMap= new HashMap<>(); + hashMap.put("owning-entity-name", owningEntityName); + getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); + } + + public boolean existsOwningEntity(String owningEntityId){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + return getAaiClient().exists(owningEntityURI); + } + + public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + getAaiClient().connect(owningEntityURI, serviceInstanceURI); + } + + public void createAAIPlatform(String platformName,String vnfId){ + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); + } + + public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); + } + public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); + getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty()); + } + + public Optional<GenericVnf> getVnfInstance(String vnfId){ + try{ + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI); + Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class); + return vnf; + } catch (Exception ex){ + return Optional.empty(); + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java new file mode 100644 index 0000000000..cea6fe740d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.springframework.stereotype.Component; + +public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate{ + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + public void execute(DelegateExecution execution) throws Exception { + try{ + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstanceId); + getAaiClient().delete(serviceInstanceURI); + execution.setVariable("GENDS_SuccessIndicator",true); + } catch(Exception ex){ + String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java new file mode 100644 index 0000000000..3bc02be476 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai; + +import org.onap.so.client.aai.AAIResourcesClient; +import org.springframework.stereotype.Component; + +@Component +public abstract class AAIResource { + private AAIResourcesClient aaiClient; + + public AAIResourcesClient getAaiClient() { + if(aaiClient == null) + return new AAIResourcesClient(); + else + return aaiClient; + } + + public void setAaiClient(AAIResourcesClient aaiClient) { + this.aaiClient = aaiClient; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java new file mode 100644 index 0000000000..67ba155336 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai; + +public class AAIServiceInstance { + String serviceInstanceName; + String serviceType; + String serviceRole; + String orchestrationStatus; + String modelInvariantUuid; + String modelVersionId; + String environmentContext; + String workloadContext; + public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, + String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, + String workloadContext) { + this.serviceInstanceName = serviceInstanceName; + this.serviceType = serviceType; + this.serviceRole = serviceRole; + this.orchestrationStatus = orchestrationStatus; + this.modelInvariantUuid = modelInvariantUuid; + this.modelVersionId = modelVersionId; + this.environmentContext = environmentContext; + this.workloadContext = workloadContext; + } + public String getServiceInstanceName() { + return serviceInstanceName; + } + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getServiceRole() { + return serviceRole; + } + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getEnvironmentContext() { + return environmentContext; + } + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + public String getWorkloadContext() { + return workloadContext; + } + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java new file mode 100644 index 0000000000..c04c2dc15b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.groovyflows; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import javax.ws.rs.NotFoundException; + +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.OwningEntities; +import org.onap.aai.domain.yang.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.logger.MsoLogger; + +public class AAICreateResources { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateResources.class); + + public void createAAIProject (String projectName, String serviceInstance){ + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); + + } + + public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + Map<String, String> hashMap= new HashMap<>(); + hashMap.put("owning-entity-name", owningEntityName); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); + } + + public boolean existsOwningEntity(String owningEntityId){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + return aaiRC.exists(owningEntityURI); + } + + protected OwningEntities getOwningEntityName(String owningEntityName){ + + AAIResourcesClient aaiRC = new AAIResourcesClient(); + return aaiRC.get(OwningEntities.class, + AAIUriFactory + .createResourceUri(AAIObjectPlurals.OWNING_ENTITIES) + .queryParam("owning-entity-name", owningEntityName)) + .orElseGet(() -> { + msoLogger.debug("No Owning Entity matched by name"); + return null; + }); + + } + + public Optional<OwningEntity> getOwningEntityNames(String owningEntityName) throws Exception{ + OwningEntity owningEntity = null; + OwningEntities owningEntities = null; + owningEntities = getOwningEntityName(owningEntityName); + + if (owningEntities == null) { + return Optional.empty(); + } else if (owningEntities.getOwningEntity().size() > 1) { + throw new Exception("Multiple OwningEntities Returned"); + } else { + owningEntity = owningEntities.getOwningEntity().get(0); + } + return Optional.of(owningEntity); + } + + public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.connect(owningEntityURI, serviceInstanceURI); + } + + public void createAAIPlatform(String platformName,String vnfId){ + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); + } + + public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); + } + public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java new file mode 100644 index 0000000000..495c77255d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.groovyflows; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; + +public class AAIDeleteServiceInstance implements JavaDelegate{ + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + public void execute(DelegateExecution execution) throws Exception { + try{ + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.delete(serviceInstanceURI); + execution.setVariable("GENDS_SuccessIndicator",true); + } catch(Exception ex){ + String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java new file mode 100644 index 0000000000..805ece9de8 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.groovyflows; + +public class AAIServiceInstance { + String serviceInstanceName; + String serviceType; + String serviceRole; + String orchestrationStatus; + String modelInvariantUuid; + String modelVersionId; + String environmentContext; + String workloadContext; + public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, + String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, + String workloadContext) { + this.serviceInstanceName = serviceInstanceName; + this.serviceType = serviceType; + this.serviceRole = serviceRole; + this.orchestrationStatus = orchestrationStatus; + this.modelInvariantUuid = modelInvariantUuid; + this.modelVersionId = modelVersionId; + this.environmentContext = environmentContext; + this.workloadContext = workloadContext; + } + public String getServiceInstanceName() { + return serviceInstanceName; + } + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getServiceRole() { + return serviceRole; + } + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getEnvironmentContext() { + return environmentContext; + } + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + public String getWorkloadContext() { + return workloadContext; + } + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java new file mode 100644 index 0000000000..3b443cbaf2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.common.name.generation; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.springframework.stereotype.Component; + +@Component +public class AAIObjectInstanceNameGenerator { + + public String generateInstanceGroupName(InstanceGroup instanceGroup, GenericVnf vnf) { + if(vnf.getVnfName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) { + return vnf.getVnfName() + "_" + instanceGroup.getModelInfoInstanceGroup().getFunction(); + } else { + throw new IllegalArgumentException("Cannot generate instance group name because either one or both fields are null: " + + " Vnf Instance Name: " + vnf.getVnfName() + + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction()); + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java new file mode 100644 index 0000000000..fa40e860c5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.aai; + +import java.io.IOException; +import java.util.Optional; +import java.util.UUID; + +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; +import org.onap.so.client.aai.AAIRestClientImpl; + +public class AaiConnectionImpl implements AaiConnection { + + @Override + public Optional<Pnf> getEntryFor(String correlationId) throws IOException { + AAIRestClientImpl restClient = new AAIRestClientImpl(); + return restClient.getPnfByName(correlationId, UUID.randomUUID().toString()); + } + + @Override + public void createEntry(String correlationId, Pnf entry) throws IOException { + AAIRestClientImpl restClient = new AAIRestClientImpl(); + restClient.createPnf(correlationId, UUID.randomUUID().toString(), entry); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java new file mode 100644 index 0000000000..85cbe2b024 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; +import org.springframework.beans.factory.annotation.Autowired; + +public class CancelDmaapSubscription implements JavaDelegate { + + private DmaapClient dmaapClient; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); + dmaapClient.unregister(correlationId); + } + + @Autowired + public void setDmaapClient(DmaapClient dmaapClient) { + this.dmaapClient = dmaapClient; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java new file mode 100644 index 0000000000..63db293a2e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + +import java.io.IOException; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse; +import org.onap.so.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn + * + * Inputs: + * - correlationId - String + * + * Outputs: + * - AAI_CONTAINS_INFO_ABOUT_PNF - local Boolean + * - aaiContainsInfoAboutIp - local Boolean + */ + +public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, CheckAaiForCorrelationIdDelegate.class); + private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation(); + private AaiConnection aaiConnection; + + @Autowired + public void setAaiConnection(AaiConnection aaiConnection) { + this.aaiConnection = aaiConnection; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + if (correlationId == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set"); + } + + try { + AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection); + + execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf()); + execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, aaiResponse.getContainsInfoAboutIp()); + } catch (IOException e) { + LOGGER.error("IOException",e); + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java new file mode 100644 index 0000000000..ec1ef21028 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn + * + * Inputs: + * - correlationId - String + */ +public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { + + private AaiConnection aaiConnection; + + @Autowired + public void setAaiConnection(AaiConnection aaiConnection) { + this.aaiConnection = aaiConnection; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + Pnf pnf = new Pnf(); + pnf.setInMaint(true); + pnf.setPnfId(correlationId); + pnf.setPnfName(correlationId); + aaiConnection.createEntry(correlationId, pnf); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java new file mode 100644 index 0000000000..b3f2f726a0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +@SuppressWarnings("ALL") +public class ExecutionVariableNames { + + private ExecutionVariableNames() {} + + public final static String CORRELATION_ID = "correlationId"; + public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf"; + public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; + public final static String DMAAP_MESSAGE = "dmaapMessage"; + public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java new file mode 100644 index 0000000000..bb490a06e4 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; +import org.springframework.beans.factory.annotation.Autowired; + +public class InformDmaapClient implements JavaDelegate { + + private DmaapClient dmaapClient; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); + dmaapClient.registerForUpdate(correlationId, () -> execution.getProcessEngineServices().getRuntimeService() + .createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey(execution.getProcessBusinessKey()) + .correlateWithResult()); + } + + @Autowired + public void setDmaapClient(DmaapClient dmaapClient) { + this.dmaapClient = dmaapClient; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java new file mode 100644 index 0000000000..c7e7c7848c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.dmaap; + +public interface DmaapClient { + + void registerForUpdate(String correlationId, Runnable informConsumer); + + Runnable unregister(String correlationId); +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java new file mode 100644 index 0000000000..90b48ab2c1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.dmaap; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.Spliterator; + +public final class JsonUtilForCorrelationId { + + private static final String JSON_HEADER = "pnfRegistrationFields"; + private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId"; + + static List<String> parseJsonToGelAllCorrelationId(String json) { + List<String> list = new ArrayList<>(); + JsonElement je = new JsonParser().parse(json); + if (je.isJsonObject()) { + getCorrelationIdFromJsonObject(je.getAsJsonObject()).ifPresent(corr -> list.add(corr)); + } else { + JsonArray array = je.getAsJsonArray(); + Spliterator<JsonElement> spliterator = array.spliterator(); + spliterator.forEachRemaining(jsonElement -> { + parseJsonElementToJsonObject(jsonElement) + .ifPresent(jsonObject -> getCorrelationIdFromJsonObject(jsonObject) + .ifPresent(correlationId -> list.add(correlationId))); + }); + } + return list; + } + + private static Optional<JsonObject> parseJsonElementToJsonObject(JsonElement jsonElement) { + if (jsonElement.isJsonObject()) { + return Optional.ofNullable(jsonElement.getAsJsonObject()); + } + return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject()); + } + + private static Optional<String> getCorrelationIdFromJsonObject(JsonObject jsonObject) { + if (jsonObject.has(JSON_HEADER)) { + JsonObject jo = jsonObject.getAsJsonObject(JSON_HEADER); + if (jo.has(JSON_CORRELATION_ID_FIELD_NAME)) { + return Optional.ofNullable(jo.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); + } + } + return Optional.empty(); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java new file mode 100644 index 0000000000..353b4e32c5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.dmaap; + +import java.io.IOException; +import java.net.URI; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Scope("prototype") +public class PnfEventReadyDmaapClient implements DmaapClient { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class); + + private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId"; + + @Autowired + private Environment env; + private HttpClient httpClient; + private String dmaapHost; + private int dmaapPort; + private String dmaapProtocol; + private String dmaapUriPathPrefix; + private String dmaapTopicName; + private String consumerId; + private String consumerGroup; + private Map<String, Runnable> pnfCorrelationIdToThreadMap; + private HttpGet getRequest; + private ScheduledExecutorService executor; + private int dmaapClientDelayInSeconds; + private volatile boolean dmaapThreadListenerIsRunning; + + public void init() { + httpClient = HttpClientBuilder.create().build(); + pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>(); + dmaapHost = env.getProperty("pnf.dmaap.host"); + dmaapPort = env.getProperty("pnf.dmaap.port", Integer.class); + executor = null; + getRequest = new HttpGet(buildURI()); + } + + @Override + public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) { + LOGGER.debug("registering for pnf ready dmaap event for correlation id: " + correlationId); + pnfCorrelationIdToThreadMap.put(correlationId, informConsumer); + if (!dmaapThreadListenerIsRunning) { + startDmaapThreadListener(); + } + } + + @Override + public synchronized Runnable unregister(String correlationId) { + LOGGER.debug("unregistering from pnf ready dmaap event for correlation id: " + correlationId); + Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId); + if (pnfCorrelationIdToThreadMap.isEmpty()) { + stopDmaapThreadListener(); + } + return runnable; + } + + private synchronized void startDmaapThreadListener() { + if (!dmaapThreadListenerIsRunning) { + executor = Executors.newScheduledThreadPool(1); + executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, + dmaapClientDelayInSeconds, TimeUnit.SECONDS); + dmaapThreadListenerIsRunning = true; + } + } + + private synchronized void stopDmaapThreadListener() { + if (dmaapThreadListenerIsRunning) { + executor.shutdownNow(); + dmaapThreadListenerIsRunning = false; + executor = null; + } + } + + private URI buildURI() { + return UriBuilder.fromUri(dmaapUriPathPrefix) + .scheme(dmaapProtocol) + .host(dmaapHost) + .port(dmaapPort).path(dmaapTopicName) + .path(consumerGroup).path(consumerId).build(); + } + + public void setDmaapProtocol(String dmaapProtocol) { + this.dmaapProtocol = dmaapProtocol; + } + + public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) { + this.dmaapUriPathPrefix = dmaapUriPathPrefix; + } + + public void setDmaapTopicName(String dmaapTopicName) { + this.dmaapTopicName = dmaapTopicName; + } + + public void setConsumerId(String consumerId) { + this.consumerId = consumerId; + } + + public void setConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + } + + public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) { + this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds; + } + + class DmaapTopicListenerThread implements Runnable { + + @Override + public void run() { + try { + HttpResponse response = httpClient.execute(getRequest); + getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound); + } catch (IOException e) { + LOGGER.error("Exception caught during sending rest request to dmaap for listening event topic", e); + } + } + + private List<String> getCorrelationIdListFromResponse(HttpResponse response) throws IOException { + if (response.getStatusLine().getStatusCode() == 200) { + String responseString = EntityUtils.toString(response.getEntity(), "UTF-8"); + if (responseString != null) { + return JsonUtilForCorrelationId.parseJsonToGelAllCorrelationId(responseString); + } + } + return Collections.emptyList(); + } + + private synchronized void informAboutPnfReadyIfCorrelationIdFound(String correlationId) { + Runnable runnable = unregister(correlationId); + if (runnable != null) { + LOGGER.debug("pnf ready event got from dmaap for correlationId: " + correlationId); + runnable.run(); + } + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java new file mode 100644 index 0000000000..5165912653 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.implementation; + +import java.io.IOException; +import java.util.Optional; +import org.onap.aai.domain.yang.Pnf; + +public interface AaiConnection { + + Optional<Pnf> getEntryFor(String correlationId) throws IOException; + + void createEntry(String correlationId, Pnf entry) throws IOException; +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java new file mode 100644 index 0000000000..32ecff102f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiResponse.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.implementation; + +import java.util.Optional; +import javax.annotation.Nullable; +import javax.validation.constraints.NotNull; + +public enum AaiResponse { + NO_ENTRY(false, false), + ENTRY_NO_IP(true, false), + ENTRY_WITH_IP(true, true); + + private boolean containsInfoAboutPnf; + private boolean containsInfoAboutIp; + + AaiResponse(boolean containsInfoAboutPnf, boolean containsInfoAboutIp) { + this.containsInfoAboutPnf = containsInfoAboutPnf; + this.containsInfoAboutIp = containsInfoAboutIp; + } + + public boolean getContainsInfoAboutPnf() { + return containsInfoAboutPnf; + } + + public boolean getContainsInfoAboutIp() { + return containsInfoAboutIp; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java new file mode 100644 index 0000000000..e5fc87db91 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.implementation; + +import java.io.IOException; +import java.util.Optional; +import org.onap.aai.domain.yang.Pnf; + +public class CheckAaiForCorrelationIdImplementation { + + public AaiResponse check(String correlationId, AaiConnection aaiConnection) throws IOException { + Optional<Pnf> pnf = aaiConnection.getEntryFor(correlationId); + if (!pnf.isPresent()) { + return AaiResponse.NO_ENTRY; + } + + if(extractIp(pnf.get()).isPresent()) { + return AaiResponse.ENTRY_WITH_IP; + } else { + return AaiResponse.ENTRY_NO_IP; + } + } + + private Optional<String> extractIp(Pnf pnf) { + if (pnf.getIpaddressV4Oam() != null) { + return Optional.of(pnf.getIpaddressV4Oam()); + } else { + return Optional.ofNullable(pnf.getIpaddressV6Oam()); + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java new file mode 100644 index 0000000000..60f109a81f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.properties; + +import java.util.Arrays; +import java.util.List; + +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.MsoLogger; + +public class BPMNProperties { + + public static String getProperty(String key, String defaultValue) { + String value = UrnPropertiesReader.getVariable(key); + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + public static List<String> getResourceSequenceProp(String input) { + String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null); + if (resourceSequence != null) { + return Arrays.asList(resourceSequence.split(",")); + } + return null; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/LocationConstraint.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/LocationConstraint.java new file mode 100644 index 0000000000..e3c6dce2af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/LocationConstraint.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class LocationConstraint { + + /** + * vnf profile id + */ + private String vnfProfileId; + + /** + * location constraints: vimId + */ + private VimLocation locationConstraints; + + /** + * @return Returns the vnfProfileId. + */ + public String getVnfProfileId() { + return vnfProfileId; + } + + /** + * @param vnfProfileId The vnfProfileId to set. + */ + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + + /** + * @return Returns the locationConstraints. + */ + public VimLocation getLocationConstraints() { + return locationConstraints; + } + + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(VimLocation locationConstraints) { + this.locationConstraints = locationConstraints; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java new file mode 100644 index 0000000000..ae320bdfb0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +import org.onap.so.logger.MsoLogger; + + +/** + * NS Create Input Parameter For VFC Adapter<br> + * <p> + * </p> + * + * @version ONAP Beijing Release 2018/2/5 + */ +public class NSResourceInputParameter { + + private NsOperationKey nsOperationKey; + + private String nsServiceName; + + private String nsServiceDescription; + + private NsParameters nsParameters; + + private NsScaleParameters nsScaleParameters; + + + + + /** + * @return Returns the nsServiceName. + */ + public String getNsServiceName() { + return nsServiceName; + } + + + /** + * @param nsServiceName The nsServiceName to set. + */ + public void setNsServiceName(String nsServiceName) { + this.nsServiceName = nsServiceName; + } + + + /** + * @return Returns the nsServiceDescription. + */ + public String getNsServiceDescription() { + return nsServiceDescription; + } + + + /** + * @param nsServiceDescription The nsServiceDescription to set. + */ + public void setNsServiceDescription(String nsServiceDescription) { + this.nsServiceDescription = nsServiceDescription; + } + + /** + * @return Returns the nsParameters. + */ + public NsParameters getNsParameters() { + return nsParameters; + } + + /** + * @param nsParameters The nsParameters to set. + */ + public void setNsParameters(NsParameters nsParameters) { + this.nsParameters = nsParameters; + } + + public NsOperationKey getNsOperationKey() { + return nsOperationKey; + } + + public void setNsOperationKey(NsOperationKey nsOperationKey) { + this.nsOperationKey = nsOperationKey; + } + + /** + * @return Returns the nsScaleParameters. + */ + public NsScaleParameters getNsScaleParameters() { + return nsScaleParameters; + } + + /** + * @param nsScaleParameters The nsScaleParameters to set. + */ + public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { + this.nsScaleParameters = nsScaleParameters; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java new file mode 100644 index 0000000000..81826a27eb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +/** + * The operation key object for NS + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-09-15 + */ +public class NsOperationKey { + + /** + * The subscriber id + */ + private String globalSubscriberId; + + /** + * The serviceType + */ + private String serviceType; + + /** + * The service ID + */ + private String serviceId; + + /** + * The Operation ID + */ + private String operationId; + + /** + * the NS template uuid + */ + private String nodeTemplateUUID; + + /** + * @return Returns the globalSubscriberId. + */ + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + /** + * @param globalSubscriberId The globalSubscriberId to set. + */ + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + /** + * @return Returns the serviceType. + */ + public String getServiceType() { + return serviceType; + } + + /** + * @param serviceType The serviceType to set. + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + /** + * <br> + * + * @return + * @since ONAP Amsterdam Release + */ + public String getServiceId() { + return serviceId; + } + + /** + * <br> + * + * @param serviceId + * @since ONAP Amsterdam Release + */ + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + /** + * <br> + * + * @return + * @since ONAP Amsterdam Release + */ + public String getOperationId() { + return operationId; + } + + /** + * <br> + * + * @param operationId + * @since ONAP Amsterdam Release + */ + public void setOperationId(String operationId) { + this.operationId = operationId; + } + + /** + * @return Returns the nodeTemplateUUID. + */ + public String getNodeTemplateUUID() { + return nodeTemplateUUID; + } + + /** + * @param nodeTemplateUUID The nodeTemplateUUID to set. + */ + public void setNodeTemplateUUID(String nodeTemplateUUID) { + this.nodeTemplateUUID = nodeTemplateUUID; + } + +} 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 new file mode 100644 index 0000000000..0d8f2fcbd7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class NsParameters { + + private List<LocationConstraint> locationConstraints; + + private Map<String, Object> additionalParamForNs = new HashMap<String,Object>(); + /** + * @return Returns the locationConstraints. + */ + public List<LocationConstraint> getLocationConstraints() { + return locationConstraints; + } + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(List<LocationConstraint> locationConstraints) { + this.locationConstraints = locationConstraints; + } + + + /** + * @return Returns the additionalParamForNs. + */ + public Map<String, Object> getAdditionalParamForNs() { + return additionalParamForNs; + } + + + /** + * @param additionalParamForNs The additionalParamForNs to set. + */ + public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) { + this.additionalParamForNs = additionalParamForNs; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsScaleParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsScaleParameters.java new file mode 100644 index 0000000000..3340176646 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsScaleParameters.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + +import java.util.List; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleParameters { + + private List<ScaleNsByStepsData> scaleNsByStepsData; + + private String scaleType; + + + private String nsInstanceId; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List<ScaleNsByStepsData> getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java new file mode 100644 index 0000000000..bbf189ac7a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class ScaleNsByStepsData { + + /** + * scaling Direction + */ + private String scalingDirection; + + /** + * aspect ID + */ + private String aspectId; + + /** + * number of Steps + */ + private int numberOfSteps; + + /** + * @return Returns the scalingDirection. + */ + public String getScalingDirection() { + return scalingDirection; + } + + /** + * @param scalingDirection The scalingDirection to set. + */ + public void setScalingDirection(String scalingDirection) { + this.scalingDirection = scalingDirection; + } + + /** + * @return Returns the aspectId. + */ + public String getAspectId() { + return aspectId; + } + + /** + * @param aspectId The aspectId to set. + */ + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + /** + * @return Returns the numberofSteps. + */ + public int getNumberOfSteps() { + return numberOfSteps; + } + + /** + * @param numberOfSteps The numberofSteps to set. + */ + public void setNumberOfSteps(int numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsData.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsData.java new file mode 100644 index 0000000000..0f72045f4e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleNsData.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +public class ScaleNsData { + + private ScaleNsByStepsData scaleNsByStepsData; + + public ScaleNsByStepsData getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleResource.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleResource.java new file mode 100644 index 0000000000..4791338aab --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/ScaleResource.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +public class ScaleResource { + + private String resourceInstanceId; + + private String scaleType; + + private ScaleNsData scaleNsData; + + public String getResourceInstanceId() { + return resourceInstanceId; + } + + public void setResourceInstanceId(String resourceInstanceId) { + this.resourceInstanceId = resourceInstanceId; + } + + public String getScaleType() { + return scaleType; + } + + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public ScaleNsData getScaleNsData() { + return scaleNsData; + } + + public void setScaleNsData(ScaleNsData scaleNsData) { + this.scaleNsData = scaleNsData; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java new file mode 100644 index 0000000000..970fa43d9f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.vfcmodel; + + +/** + * + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-10-18 + */ +public class VimLocation { + private String vimId; + + + /** + * @return Returns the vimId. + */ + public String getVimId() { + return vimId; + } + + + /** + * @param vimId The vimId to set. + */ + public void setVimId(String vimId) { + this.vimId = vimId; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java new file mode 100644 index 0000000000..3c4a35737b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -0,0 +1,350 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.json.JSONObject; +import org.onap.msb.sdk.discovery.common.RouteException; +import org.onap.msb.sdk.httpclient.RestServiceCreater; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.onap.so.bpmn.core.BaseTask; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class AbstractSdncOperationTask extends BaseTask { + + private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class); + protected static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, AbstractSdncOperationTask.class); + + @Autowired + private Environment env; + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + private static final int DEFAULT_MSB_PORT = 80; + private static final String SDCADAPTOR_INPUTS = "resourceParameters"; + private static final String TOPOLOGY_PROPERTIES = "topology.properties"; + public static final String ONAP_IP = "ONAP_IP"; + + private static final String POST_BODY_TEMPLATE = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n"+ + " <ns:updateResourceOperationStatus>\n"+ + " <errorCode>$errorCode</errorCode>\n"+ + " <jobId>$jobId</jobId>\n"+ + " <operType>$operType</operType>\n"+ + " <operationId>$operationId</operationId>\n"+ + " <progress>$progress</progress>\n"+ + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"+ + " <serviceId>$serviceId</serviceId>\n"+ + " <status>$status</status>\n"+ + " <statusDescription>$statusDescription</statusDescription>\n"+ + " </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>"; + + private static final String GET_BODY_TEMPLATE = " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n" + + " <ns:getResourceOperationStatus>\n" + + " <operationId>$operationId</operationId>\n" + + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n" + + " <serviceId>$serviceId</serviceId>\n" + + " </ns:getResourceOperationStatus></soapenv:Body></soapenv:Envelope>"; + + + private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException { + logger.info("AbstractSdncOperationTask.updateResOperStatus begin!"); + String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); + HttpPost httpPost = new HttpPost(requestsdbEndPoint); + httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Content-type", "application/soap+xml"); + String postBody = getPostStringBody(resourceOperationStatus); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(requestsdbEndPoint, httpPost); + logger.info("AbstractSdncOperationTask.updateResOperStatus end!"); + } + + protected String getPostbody(Object inputEntity) { + ObjectMapper objectMapper = new ObjectMapper(); + String postBody = null; + try { + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + postBody = objectMapper.writeValueAsString(inputEntity); + } catch (JsonProcessingException e) { + logger.error(Arrays.toString(e.getStackTrace())); + } + return postBody; + } + + protected String httpPost(String url, HttpPost httpPost) throws RouteException { + logger.info("AbstractSdncOperationTask.httpPost begin!"); + String result = null; + + String errorMsg; + try(CloseableHttpClient httpClient = HttpClients.createDefault()) { + CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); + result = EntityUtils.toString(closeableHttpResponse.getEntity()); + logger.info("result = {}", result); + if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { + logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode()); + throw new RouteException(result, "SERVICE_GET_ERR"); + } + + closeableHttpResponse.close(); + } catch (IOException e) { + errorMsg = url + ":httpPostWithJSON connect faild"; + logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg); + throwsRouteException(errorMsg, e, "POST_CONNECT_FAILD"); + } + + logger.info("AbstractSdncOperationTask.httpPost end!"); + return result; + } + + private static void throwsRouteException(String errorMsg, Exception e, String errorCode) throws RouteException { + String msg = errorMsg + ".errorMsg:" + e.getMessage(); + logger.info("exception: {}", msg); + throw new RouteException(errorMsg, errorCode); + } + + private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) { + logger.info("AbstractSdncOperationTask.getPostStringBody begin!"); + String postBody = POST_BODY_TEMPLATE; + postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode()); + postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId()); + postBody = postBody.replace("$operType", resourceOperationStatus.getOperType()); + postBody = postBody.replace("$operationId", resourceOperationStatus.getOperationId()); + postBody = postBody.replace("$progress", resourceOperationStatus.getProgress()); + postBody = postBody.replace("$resourceTemplateUUID", resourceOperationStatus.getResourceTemplateUUID()); + postBody = postBody.replace("$serviceId", resourceOperationStatus.getServiceId()); + postBody = postBody.replace("$status", resourceOperationStatus.getStatus()); + postBody = postBody.replace("$statusDescription", resourceOperationStatus.getStatusDescription()); + logger.info("AbstractSdncOperationTask.getPostStringBody end!"); + return postBody; + } + + private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) { + logger.info("AbstractSdncOperationTask.getGetStringBody begin!"); + String getBody = GET_BODY_TEMPLATE; + getBody = getBody.replace("$operationId", operationId); + getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID); + getBody = getBody.replace("$serviceId", serviceId); + logger.info("AbstractSdncOperationTask.getGetStringBody end!"); + return getBody; + } + + private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException { + logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!"); + String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); + HttpPost httpPost = new HttpPost(requestsdbEndPoint); + httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Content-type", "application/soap+xml"); + String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID); + httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML)); + String result = httpPost(requestsdbEndPoint, httpPost); + ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result); + logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!"); + return resourceOperationStatus; + } + + private ResourceOperationStatus getResourceOperationStatusFromXmlString(String result) { + logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString begin!"); + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); + resourceOperationStatus.setErrorCode(getValueByName("errorCode", result)); + resourceOperationStatus.setJobId(getValueByName("jobId", result)); + resourceOperationStatus.setOperType(getValueByName("operType", result)); + resourceOperationStatus.setOperationId(getValueByName("operationId", result)); + resourceOperationStatus.setProgress(getValueByName("progress", result)); + resourceOperationStatus.setResourceTemplateUUID(getValueByName("resourceTemplateUUID", result)); + resourceOperationStatus.setServiceId(getValueByName("serviceId", result)); + resourceOperationStatus.setStatus(getValueByName("status", result)); + resourceOperationStatus.setStatusDescription(getValueByName("statusDescription", result)); + logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString end!"); + return resourceOperationStatus; + } + + private String getValueByName(String name, String xml) { + if (!StringUtils.isBlank(xml) && xml.contains(name)) { + String start = "<" + name + ">"; + String end = "</" + name + ">"; + return xml.substring(xml.indexOf(start), xml.indexOf(end)).replace(start, ""); + } + return ""; + } + + @Override + public void execute(DelegateExecution execution) { + logger.info("AbstractSdncOperationTask.execute begin!"); + GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(); + try { + Map<String, String> inputs = getInputs(execution); + + sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient); + execution.setVariable("SDNCA_SuccessIndicator", true); + } catch (Exception e) { + logger.info("exception: AbstractSdncOperationTask.fail!"); + logger.error("exception: AbstractSdncOperationTask.fail!:", e); + logger.error(Arrays.toString(e.getStackTrace())); + execution.setVariable("SDNCA_SuccessIndicator", false); + updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", "sendRestrequestAndHandleResponse finished!"); + + } + logger.info("AbstractSdncOperationTask.execute end!"); + } + + protected Map<String, String> getInputs(DelegateExecution execution) { + logger.info("AbstractSdncOperationTask.getInputs begin!"); + Map<String, String> inputs = new HashMap<>(); + String json = (String) execution.getVariable(SDCADAPTOR_INPUTS); + if (!StringUtils.isBlank(json)) { + JSONObject jsonObject = new JSONObject(json); + JSONObject paras = jsonObject.getJSONObject("additionalParamForNs"); + Iterator<String> iterator = paras.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + inputs.put(key, paras.getString(key)); + } + } + logger.info("AbstractSdncOperationTask.getInputs end!"); + return inputs; + } + + public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map<String, String> inputs, + GenericResourceApi genericResourceApiClient) throws Exception; + + public void updateProgress(DelegateExecution execution, + String status, + String errorCode, + String progress, + String statusDescription) { + logger.info("AbstractSdncOperationTask.updateProgress begin!"); + String serviceId = (String) execution.getVariable("serviceId"); + serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; + String operationId = (String) execution.getVariable("operationId"); + String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); + String resourceTemplateId = (String) execution.getVariable("resourceTemplateId"); + resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID; + resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID; + try { + ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + if (!StringUtils.isBlank(status)) { + resourceOperationStatus.setStatus(status); + } + if (!StringUtils.isBlank(errorCode)) { + resourceOperationStatus.setErrorCode(errorCode); + } + if (!StringUtils.isBlank(progress)) { + resourceOperationStatus.setProgress(progress); + } + if (!StringUtils.isBlank(statusDescription)) { + resourceOperationStatus.setStatusDescription(statusDescription); + } + updateResOperStatus(resourceOperationStatus); + logger.info("AbstractSdncOperationTask.updateProgress end!"); + } catch (Exception exception) { + logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); + logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); + msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); + } + } + + + protected boolean isSend2SdncDirectly() { + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!"); + String sdncIp = UrnPropertiesReader.getVariable("sdnc-ip"); + String sdncPort = UrnPropertiesReader.getVariable("sdnc-port"); + if (!StringUtils.isBlank(sdncIp) && isIp(sdncIp) && !StringUtils.isBlank(sdncPort)) { + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true."); + return true; + } + + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false."); + return false; + } + + protected String getSdncIp() { + logger.info("AbstractSdncOperationTask.getSdncIp begin."); + String sdncIp = null; + sdncIp = UrnPropertiesReader.getVariable("sdnc-ip"); + String returnIp = StringUtils.isBlank(sdncIp) || !isIp(sdncIp) ? null : sdncIp; + logger.info("AbstractSdncOperationTask.getSdncIp: sdncIp = {}", returnIp); + return returnIp; + } + + protected String getSdncPort() { + logger.info("AbstractSdncOperationTask.getSdncPort begin."); + String sdncPort = UrnPropertiesReader.getVariable("sdnc-port"); + String returnPort = StringUtils.isBlank(sdncPort) ? null : sdncPort; + logger.info("AbstractSdncOperationTask.getSdncPort: returnPort = {}", sdncPort); + return returnPort; + } + + private GenericResourceApi getGenericResourceApiClient() { + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!"); + String msbIp = System.getenv().get(ONAP_IP); + int msbPort = DEFAULT_MSB_PORT; + if (StringUtils.isBlank(msbIp) || !isIp(msbIp)) { + msbIp = env.getProperty("msb-ip"); + if (StringUtils.isBlank(msbIp)) { + msbIp = env.getProperty("msb.address", DEFAULT_MSB_IP); + } + } + String strMsbPort = env.getProperty("msb-port"); + if (StringUtils.isBlank(strMsbPort)) { + strMsbPort = env.getProperty("msb.port", String.valueOf(DEFAULT_MSB_PORT)); + } + msbPort = Integer.valueOf(strMsbPort); + + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient msbIp = " + msbIp + " msbPort = " + msbPort); + MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); + RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient end!"); + return restServiceCreater.createService(GenericResourceApi.class); + } + + protected boolean isIp(String msbIp) { + return !StringUtils.isBlank(msbIp) && msbIp.split("\\.").length == 4; + } + + public String getProcessKey(DelegateExecution execution) { + return execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java new file mode 100644 index 0000000000..3ef1410425 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + +import java.util.Map; + +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.msb.sdk.discovery.common.RouteException; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; +import org.onap.so.logger.MessageEnum; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask { + private static final Logger sdncLogger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); + + + private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation"; + + @Override + public void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map<String, String> inputs, + GenericResourceApi genericResourceApiClient) throws Exception { + sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!"); + NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); + RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); + updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "50", "RequestBody build finished!"); + RpcNetworkTopologyOperationOutputEntity outputEntity; + if (!isSend2SdncDirectly()) { + outputEntity = genericResourceApiClient.postNetworkTopologyOperation + (HeaderUtil.DefaulAuth, inputEntity).execute().body(); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); + } else { + send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); + } + updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + } + + private void send2SdncDirectly(String defaulAuth, + RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { + sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); + String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Authorization", defaulAuth); + httpPost.addHeader("Content-type", "application/json"); + String postBody = getPostbody(inputEntity); + msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(url, httpPost); + sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); + } + + private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException { + sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); + String responseCode = output.getOutput().getResponseCode(); + if (!"200".equals(responseCode)) { + String processKey = getProcessKey(execution); + int errorCode = Integer.parseInt(responseCode); + String errorMessage = output.getOutput().getResponseMessage(); + WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("SDNCA_SuccessIndicator", workflowException); + updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), "100", errorMessage); + sdncLogger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); + throw new RouteException(); + } + + sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java new file mode 100644 index 0000000000..8e41d0d88e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + + +import java.util.Map; + +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.msb.sdk.discovery.common.RouteException; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.ServiceRpcInputEntityBuilder; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationOutputEntity; +import org.onap.so.logger.MessageEnum; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask { + private static final Logger sdncLogger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); + + + private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation"; + + @Override + public void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map<String, String> inputs, + GenericResourceApi genericResourceApiClient) throws Exception { + sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); + ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); + RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); + updateProgress(execution, null, null, "50", "RequestBody build finished!"); + RpcServiceTopologyOperationOutputEntity outputEntity; + if (!isSend2SdncDirectly()) { + outputEntity = genericResourceApiClient.postServiceTopologyOperation + (HeaderUtil.DefaulAuth, inputEntity).execute().body(); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); + } else { + send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); + } + sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + + } + + private void send2SdncDirectly(String defaulAuth, + RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { + sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); + String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Authorization", defaulAuth); + httpPost.addHeader("Content-type", "application/json"); + String postBody = getPostbody(inputEntity); + msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(url, httpPost); + sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); + } + + private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { + sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); + String responseCode = output.getOutput().getResponseCode(); + if (!"200".equals(responseCode)) { + String processKey = getProcessKey(execution); + int errorCode = Integer.parseInt(responseCode); + String errorMessage = output.getOutput().getResponseMessage(); + WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("SDNCA_SuccessIndicator", workflowException); + updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); + sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); + throw new RouteException(); + } + sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput end!"); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java new file mode 100644 index 0000000000..fd844648fa --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.onap.msb.sdk.httpclient.RestServiceCreater; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.beans.ResourceOperationStatusId; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SdncUnderlayVpnOperationClient { + + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + private static final int DEFAULT_MSB_PORT = 10081; + + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, SdncUnderlayVpnOperationClient.class); + + public boolean excute(String msbIp, + int msbPort, + Map<String, String> inputs, + String iServiceID, + String iOperationID, + String resourceTemplateUUID_i){ + ResourceOperationStatusId id = new ResourceOperationStatusId(iServiceID, iOperationID, resourceTemplateUUID_i); + GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(msbIp, msbPort); + updateProgress(id, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); + return sendRestrequestAndHandleResponse(id, inputs, genericResourceApiClient); + } + + public boolean sendRestrequestAndHandleResponse(ResourceOperationStatusId id, Map<String, String> inputs, GenericResourceApi genericResourceApiClient){ + updateProgress(id, null, null, "40", "sendRestrequestAndHandleResponse begin!"); + NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); + RpcNetworkTopologyOperationInputEntity body = builder.build(null, inputs); + updateProgress(id, null, null, "50", "RequestBody build finished!"); + //RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null; + try { + genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth ,body).execute().body(); + } catch (Exception e) { + logger.debug("Exception: ", e); + updateProgress(id, RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage()); + return false; + } + updateProgress(id, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + updateProgress(id, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + return true; + } + + private GenericResourceApi getGenericResourceApiClient(String msbIp, int msbPort) { + if (StringUtils.isBlank(msbIp)) { + msbIp = DEFAULT_MSB_IP; + } + if (msbPort <= 0) { + msbPort = DEFAULT_MSB_PORT; + } + MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); + RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); + return restServiceCreater.createService(GenericResourceApi.class); + } + + public void updateProgress(ResourceOperationStatusId id, String status, + String errorCode, + String progress, + String statusDescription) { + + + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(id); + if (!StringUtils.isBlank(status)) { + resourceOperationStatus.setStatus(status); + } + if (!StringUtils.isBlank(errorCode)) { + resourceOperationStatus.setErrorCode(errorCode); + } + if (!StringUtils.isBlank(progress)) { + resourceOperationStatus.setProgress(progress); + } + if (!StringUtils.isBlank(statusDescription)) { + resourceOperationStatus.setStatusDescription(statusDescription); + } + //rosRepo.save(resourceOperationStatus); + } + + private void saveOutput() { + // Not implemented. + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java new file mode 100644 index 0000000000..5bd3297c20 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask; + +import org.apache.commons.lang3.StringUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.BaseTask; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.beans.ResourceOperationStatusId; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SdncUnderlayVpnPreprocessTask extends BaseTask { + public static final String RESOURCE_OPER_TYPE = "resourceOperType"; + + @Override + public void execute(DelegateExecution execution) { + String operType = getOperType(execution); + execution.setVariable(RESOURCE_OPER_TYPE, operType); + } + + private String getOperType(DelegateExecution execution) { + String serviceId = (String) execution.getVariable("serviceId"); + serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; + String operationId = (String) execution.getVariable("operationId"); + String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); + resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID; + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(new ResourceOperationStatusId(serviceId, operationId, resourceTemplateUUID)); + return resourceOperationStatus.getOperType(); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java new file mode 100644 index 0000000000..a837782a2c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import org.onap.msb.sdk.httpclient.annotaion.ServiceHttpEndPoint; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.*; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.POST; + +@ServiceHttpEndPoint(serviceName = "sdnc", serviceVersion = "v1") +public interface GenericResourceApi { + + @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") + Call<ResponseBody> postNetworkTopologyOperation(@Header("Authorization") String authorization, + @Body RequestBody input); + + @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") + Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(@Header("Authorization") String authorization, + @Body RpcNetworkTopologyOperationInputEntity input); + + @POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation") + Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(@Header("Authorization") String authorization, + @Body RpcServiceTopologyOperationInputEntity input); + +} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java new file mode 100644 index 0000000000..696be02809 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client; + +import java.util.Base64; + +public class HeaderUtil { + + public static final String USER = "admin"; + public static final String PASS = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"; + public static final String DefaulAuth = getAuthorization(USER, PASS); + + public static String getAuthorization(String usr, String pwd) { + + return "Basic " + base64Encode(usr + ":" + pwd); + } + + private static String base64Encode(String str) { + String base64 = str; + try { + base64 = Base64.getEncoder() + .encodeToString(str.getBytes("utf-8")); + } catch (Exception ex) { + } + return base64; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java new file mode 100644 index 0000000000..961b846ace --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -0,0 +1,239 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.commons.lang3.StringUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; +import org.onap.so.requestsdb.RequestsDbConstant; + +public abstract class AbstractBuilder<I, O> { + + public static final String OPERATION_TYPE = "operationType"; + public static final String RESOURCE_TYPE = "resourceType"; + + public enum RequestAction { + CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), + ACTIVATE_NETWORK_INSTANCE(1, "ActivateNetworkInstance"), + CREATE_SERVICE_INSTANCE(2, "CreateServiceInstance"), + DELETE_SERVICE_INSTANCE(3, "DeleteServiceInstance"), + DELETE_NETWORK_INSTANCE(4, "DeleteNetworkInstance"), + CREATE_VNF_INSTANCE(5, "CreateVnfInstance"), + ACTIVATE_VNF_INSTANCE(6, "ActivateVnfInstance"), + DELETE_VNF_INSTANCE(7, "DeleteVnfInstance"), + CREATE_VF_MODULE_INSTANCE(8, "CreateVfModuleInstance"), + ACTIVATE_VF_MODULE_INSTANCE(9, "ActivateVfModuleInstance"), + DELETE_VF_MODULE_INSTANCE(10, "DeleteVfModuleInstance"), + CREATE_CONTRAIL_ROUTE_INSTANCE(11, "CreateContrailRouteInstance"), + DELETE_CONTRAIL_ROUTE_INSTANCE(12, "DeleteContrailRouteInstance"), + CREATE_SECURITY_ZONE_INSTANCE(13, "CreateSecurityZoneInstance"), + DELETE_SECURITY_ZONE_INSTANCE(14, "DeleteSecurityZoneInstance"), + ACTIVATE_DCI_NETWORK_INSTANCE(15, "ActivateDCINetworkInstance"), + DEACTIVATE_DCI_NETWORK_INSTANCE(16, "DeActivateDCINetworkInstance"); + + String name; + int value; + + private RequestAction(int value, String name) { + this.value = value; + this.name = name; + } + + public String getName() { + return this.name; + } + + public int getIntValue() { + return this.value; + } + } + + public enum SvcAction { + RESERVE(0, "reserve"), + ASSIGN(1, "assign"), + ACTIVATE(2, "activate"), + DELETE(3, "delete"), + CHANGEASSIGN(4, "changeassign"), + CHANGEDELETE(5, "changedelete"), + ROLLBACK(6, "rollback"), + DEACTIVATE(7, "deactivate"), + UNASSIGN(8, "unassign"), + CREATE(9, "create"); + + String name; + int value; + + private SvcAction(int value, String name) { + this.value = value; + this.name = name; + } + + public String getName() { + return this.name; + } + + public int getIntValue() { + return this.value; + } + } + + protected String requestId = null; + + abstract O build(DelegateExecution execution, I input) throws Exception; + + protected String getRequestAction(DelegateExecution execution) { + String action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName(); + String operType = (String) execution.getVariable(OPERATION_TYPE); + String resourceType = (String)execution.getVariable(RESOURCE_TYPE); + if (!StringUtils.isBlank(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.DELETE_NETWORK_INSTANCE.getName(); + } else { + action = /*RequestInformation.*/RequestAction.DELETE_SERVICE_INSTANCE.getName(); + } + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName(); + } else { + action = /*RequestInformation.*/RequestAction.CREATE_SERVICE_INSTANCE.getName(); + } + } + } + return action; + } + + private boolean isOverlay(String resourceType) { + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay"); + } + + private boolean isUnderlay(String resourceType) { + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay"); + } + + protected String getSvcAction(DelegateExecution execution) { + String action = /*SdncRequestHeader.*/SvcAction.CREATE.getName(); + String operType = (String) execution.getVariable(OPERATION_TYPE); + String resourceType = (String)execution.getVariable(RESOURCE_TYPE); + if (!StringUtils.isBlank(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.DEACTIVATE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.DELETE.getName(); + } else { + action = /*SdncRequestHeader.*/SvcAction.UNASSIGN.getName(); + } + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.ACTIVATE.getName(); + } else if (isUnderlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.CREATE.getName(); + } else { + action = /*SdncRequestHeader.*/SvcAction.ASSIGN.getName(); + } + } + } + return action; + } + + protected synchronized String getRequestId(DelegateExecution execution) { + if (StringUtils.isBlank(requestId)) { + requestId = (String) execution.getVariable("msoRequestId"); + if (StringUtils.isBlank(requestId)) { + requestId = UUID.randomUUID().toString(); + } + } + return requestId; + } + + protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) { + OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); + String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid"); + String modelVersion = (String) execution.getVariable("modelVersion"); + String modelUuid = (String) execution.getVariable("modelUuid"); + String modelName = (String) execution.getVariable("serviceModelName"); + onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); + onapModelInformationEntity.setModelVersion(modelVersion); + onapModelInformationEntity.setModelUuid(modelUuid); + onapModelInformationEntity.setModelName(modelName); + return onapModelInformationEntity; + } + + protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) { + OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); + String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID"); + String modelVersion = (String) execution.getVariable("modelVersion"); + String modelUuid = (String) execution.getVariable("resourceUUID"); + String modelName = (String) execution.getVariable(RESOURCE_TYPE); + onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); + onapModelInformationEntity.setModelVersion(modelVersion); + onapModelInformationEntity.setModelUuid(modelUuid); + onapModelInformationEntity.setModelName(modelName); + return onapModelInformationEntity; + } + + protected List<ParamEntity> getParamEntities(Map<String, String> inputs) { + List<ParamEntity> paramEntityList = new ArrayList<>(); + if (inputs != null && !inputs.isEmpty()) { + inputs.keySet().forEach(key -> { + ParamEntity paramEntity = new ParamEntity(); + paramEntity.setName(key); + paramEntity.setValue(inputs.get(key)); + paramEntityList.add(paramEntity); + }); + } + return paramEntityList; + } + + protected RequestInformationEntity getRequestInformationEntity(DelegateExecution execution) { + RequestInformationEntity requestInformationEntity = new RequestInformationEntity(); + requestInformationEntity.setRequestId(getRequestId(execution)); + requestInformationEntity.setRequestAction(getRequestAction(execution)); + return requestInformationEntity; + } + + protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) { + ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity(); + serviceInformationEntity.setServiceId((String) execution.getVariable("serviceInstanceId")); + serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType")); + serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution)); + serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId")); + serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId")); + return serviceInformationEntity; + } + + protected String getServiceInstanceName(DelegateExecution execution) { + return (String) execution.getVariable("serviceInstanceName"); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java new file mode 100644 index 0000000000..547df2bb3a --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInputParametersEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRequestInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; + +public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> { + + @Override + public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) { + RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity(); + NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs); + rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity); + return rpcNetworkTopologyOperationInputEntity; + } + + private void loadNetwrokRequestInputEntity(Map<String, String> inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { + NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity(); + NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity(); + List<ParamEntity> paramEntityList = getParamEntities(inputs); + networkInputParametersEntity.setParamList(paramEntityList); + networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity); + networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity); + } + + private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution); + networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity); + } + + private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); + sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution)); + sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution)); + networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); + } + + private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution); + networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity); + } + + private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map<String, String> inputs) { + NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity(); + loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution); + loadRequestInformationEntity(networkTopologyOperationInputEntity, execution); + loadServiceInformation(networkTopologyOperationInputEntity, execution); + loadNetworkInformationEntity(execution, networkTopologyOperationInputEntity); + loadNetwrokRequestInputEntity(inputs, networkTopologyOperationInputEntity); + return networkTopologyOperationInputEntity; + } + + private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { + NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity(); + OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution); + networkInformationEntity.setOnapModelInformation(onapModelInformationEntity); + networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java new file mode 100644 index 0000000000..466652edff --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceRequestInputEntity; +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceTopologyOperationInputEntity; + +public class ServiceRpcInputEntityBuilder extends AbstractBuilder<Map<String, String>, RpcServiceTopologyOperationInputEntity> { + @Override + public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) throws Exception { + RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity = new RpcServiceTopologyOperationInputEntity(); + ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity = new ServiceTopologyOperationInputEntity(); + loadSdncRequestHeaderEntity(serviceTopologyOperationInputEntity, execution); + loadRequestInformationEntity(serviceTopologyOperationInputEntity, execution); + loadServiceInformation(serviceTopologyOperationInputEntity, execution); + loadServiceRequestInputEntity(serviceTopologyOperationInputEntity, execution); + rpcServiceTopologyOperationInputEntity.setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity); + return rpcServiceTopologyOperationInputEntity; + } + + private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + ServiceRequestInputEntity serviceRequestInputEntity = getServiceRequestInputEntity(execution); + serviceTopologyOperationInputEntity.setServiceRequestInput(serviceRequestInputEntity); + } + + private ServiceRequestInputEntity getServiceRequestInputEntity(DelegateExecution execution) { + ServiceRequestInputEntity serviceRequestInputEntity = new ServiceRequestInputEntity(); + serviceRequestInputEntity.setServiceInstanceName(getServiceInstanceName(execution)); + return serviceRequestInputEntity; + } + + private void loadServiceInformation(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution); + serviceTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity); + } + + private void loadRequestInformationEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution); + serviceTopologyOperationInputEntity.setRequestInformation(requestInformationEntity); + } + + private void loadSdncRequestHeaderEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); + sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution)); + sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution)); + serviceTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java new file mode 100644 index 0000000000..6ef9676ebb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:network-id") + private String networkId; + + @JsonProperty("GENERIC-RESOURCE-API:network-type") + private String networkType; + + @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") + private OnapModelInformationEntity onapModelInformation; + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkType() { + return networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public OnapModelInformationEntity getOnapModelInformation() { + return onapModelInformation; + } + + public void setOnapModelInformation(OnapModelInformationEntity onapModelInformation) { + this.onapModelInformation = onapModelInformation; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java new file mode 100644 index 0000000000..0863917f21 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class NetworkInputParametersEntity { + @JsonProperty("GENERIC-RESOURCE-API:param") + private List<ParamEntity> paramList; + + public List<ParamEntity> getParamList() { + return paramList; + } + + public void setParamList(List<ParamEntity> paramList) { + this.paramList = paramList; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java new file mode 100644 index 0000000000..e43291cf0c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkRequestInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:network-name") + private String networkName; + + @JsonProperty("GENERIC-RESOURCE-API:tenant") + private String tenant; + + @JsonProperty("GENERIC-RESOURCE-API:aic-cloud-region") + private String aicCloudRegion; + + @JsonProperty("GENERIC-RESOURCE-API:aic-clli") + private String aicClli; + + @JsonProperty("GENERIC-RESOURCE-API:network-input-parameters") + private NetworkInputParametersEntity networkInputPaarameters; + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + public String getAicCloudRegion() { + return aicCloudRegion; + } + + public void setAicCloudRegion(String aicCloudRegion) { + this.aicCloudRegion = aicCloudRegion; + } + + public String getAicClli() { + return aicClli; + } + + public void setAicClli(String aicClli) { + this.aicClli = aicClli; + } + + public NetworkInputParametersEntity getNetworkInputPaarameters() { + return networkInputPaarameters; + } + + public void setNetworkInputPaarameters(NetworkInputParametersEntity networkInputPaarameters) { + this.networkInputPaarameters = networkInputPaarameters; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java new file mode 100644 index 0000000000..3094ea26c3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkResponseInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:instance-id") + private String instanceId; + + @JsonProperty("GENERIC-RESOURCE-API:object-path") + private String objectPath; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getObjectPath() { + return objectPath; + } + + public void setObjectPath(String objectPath) { + this.objectPath = objectPath; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java new file mode 100644 index 0000000000..e4e37476e5 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") + private SdncRequestHeaderEntity sdncRequestHeader; + + @JsonProperty("GENERIC-RESOURCE-API:request-information") + private RequestInformationEntity requestInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-information") + private ServiceInformationEntity serviceInformation; + + @JsonProperty("GENERIC-RESOURCE-API:network-information") + private NetworkInformationEntity networkInformation; + + @JsonProperty("GENERIC-RESOURCE-API:network-request-input") + private NetworkRequestInputEntity networkRequestInput; + + public SdncRequestHeaderEntity getSdncRequestHeader() { + return sdncRequestHeader; + } + + public void setSdncRequestHeader(SdncRequestHeaderEntity sdncRequestHeader) { + this.sdncRequestHeader = sdncRequestHeader; + } + + public RequestInformationEntity getRequestInformation() { + return requestInformation; + } + + public void setRequestInformation(RequestInformationEntity requestInformation) { + this.requestInformation = requestInformation; + } + + public ServiceInformationEntity getServiceInformation() { + return serviceInformation; + } + + public void setServiceInformation(ServiceInformationEntity serviceInformation) { + this.serviceInformation = serviceInformation; + } + + public NetworkInformationEntity getNetworkInformation() { + return networkInformation; + } + + public void setNetworkInformation(NetworkInformationEntity networkInformation) { + this.networkInformation = networkInformation; + } + + public NetworkRequestInputEntity getNetworkRequestInput() { + return networkRequestInput; + } + + public void setNetworkRequestInput(NetworkRequestInputEntity networkRequestInput) { + this.networkRequestInput = networkRequestInput; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..19fca650bd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") + private String svcRequestId; + + @JsonProperty("GENERIC-RESOURCE-API:response-code") + private String responseCode; + + @JsonProperty("GENERIC-RESOURCE-API:response-message") + private String responseMessage; + + @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") + private String ackFinalIndicator; + + @JsonProperty("GENERIC-RESOURCE-API:network-response-information") + private NetworkResponseInformationEntity networkResponseInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-response-information") + private ServiceResponseInformationEntity serviceResponseInformation; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getResponseCode() { + return responseCode; + } + + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + public String getResponseMessage() { + return responseMessage; + } + + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public NetworkResponseInformationEntity getNetworkResponseInformation() { + return networkResponseInformation; + } + + public void setNetworkResponseInformation(NetworkResponseInformationEntity networkResponseInformation) { + this.networkResponseInformation = networkResponseInformation; + } + + public ServiceResponseInformationEntity getServiceResponseInformation() { + return serviceResponseInformation; + } + + public void setServiceResponseInformation(ServiceResponseInformationEntity serviceResponseInformation) { + this.serviceResponseInformation = serviceResponseInformation; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java new file mode 100644 index 0000000000..c5e9f5e61c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OnapModelInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:model-invariant-uuid") + private String modelInvariantUuid; + + @JsonProperty("GENERIC-RESOURCE-API:model-customization-uuid") + private String modelCustomizationUuid; + + @JsonProperty("GENERIC-RESOURCE-API:model-uuid") + private String modelUuid; + + @JsonProperty("GENERIC-RESOURCE-API:model-version") + private String modelVersion; + + @JsonProperty("GENERIC-RESOURCE-API:model-name") + private String modelName; + + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelUuid() { + return modelUuid; + } + + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java new file mode 100644 index 0000000000..05f8d40dcb --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ParamEntity { + @JsonProperty("GENERIC-RESOURCE-API:name") + private String name; + + @JsonProperty("GENERIC-RESOURCE-API:value") + private String value; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java new file mode 100644 index 0000000000..af448942cc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RequestInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:request-id") + private String requestId; + + @JsonProperty("GENERIC-RESOURCE-API:request-action") + private String requestAction; + + @JsonProperty("GENERIC-RESOURCE-API:source") + private String source; + + @JsonProperty("GENERIC-RESOURCE-API:notification-url") + private String notificationUrl; + + @JsonProperty("GENERIC-RESOURCE-API:order-number") + private String orderUnmber; + + @JsonProperty("GENERIC-RESOURCE-API:order-version") + private String orerVersion; + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getNotificationUrl() { + return notificationUrl; + } + + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + } + + public String getOrderUnmber() { + return orderUnmber; + } + + public void setOrderUnmber(String orderUnmber) { + this.orderUnmber = orderUnmber; + } + + public String getOrerVersion() { + return orerVersion; + } + + public void setOrerVersion(String orerVersion) { + this.orerVersion = orerVersion; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java new file mode 100644 index 0000000000..4e58a61750 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcNetworkTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:input") + private NetworkTopologyOperationInputEntity input = null; + + public NetworkTopologyOperationInputEntity getInput() { + return input; + } + + public void setInput(NetworkTopologyOperationInputEntity input) { + this.input = input; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..915a8a5e39 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcNetworkTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:output") + private NetworkTopologyOperationOutputEntity output; + + public NetworkTopologyOperationOutputEntity getOutput() { + return output; + } + + public void setOutput(NetworkTopologyOperationOutputEntity output) { + this.output = output; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java new file mode 100644 index 0000000000..145759e190 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcServiceTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:input") + private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity; + + public ServiceTopologyOperationInputEntity getServiceTopologyOperationInputEntity() { + return serviceTopologyOperationInputEntity; + } + + public void setServiceTopologyOperationInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity) { + this.serviceTopologyOperationInputEntity = serviceTopologyOperationInputEntity; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..bccd8c3d50 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RpcServiceTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:output") + private ServiceTopologyOperationOutputEntity output; + + public ServiceTopologyOperationOutputEntity getOutput() { + return output; + } + + public void setOutput(ServiceTopologyOperationOutputEntity output) { + this.output = output; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java new file mode 100644 index 0000000000..a5d806a2dc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SdncRequestHeaderEntity { + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") + private String svcRequestId; + + @JsonProperty("GENERIC-RESOURCE-API:svc-action") + private String svcAction; + + @JsonProperty("GENERIC-RESOURCE-API:svc-notification-url") + private String svcNotificationUrl; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getSvcAction() { + return svcAction; + } + + public void setSvcAction(String svcAction) { + this.svcAction = svcAction; + } + + public String getSvcNotificationUrl() { + return svcNotificationUrl; + } + + public void setSvcNotificationUrl(String svcNotificationUrl) { + this.svcNotificationUrl = svcNotificationUrl; + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java new file mode 100644 index 0000000000..1b6ac4939b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:service-id") + private String serviceId; + + @JsonProperty("GENERIC-RESOURCE-API:subscription-service-type") + private String subscriptionServiceType; + + @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") + private OnapModelInformationEntity onapModelInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-instance-id") + private String serviceInstanceId; + + @JsonProperty("GENERIC-RESOURCE-API:global-customer-id") + private String globalCustomerId; + + @JsonProperty("GENERIC-RESOURCE-API:subscriber-name") + private String subscriberName; + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public OnapModelInformationEntity getOnapModelInformation() { + return onapModelInformation; + } + + public void setOnapModelInformation(OnapModelInformationEntity onapModelInformation) { + this.onapModelInformation = onapModelInformation; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getGlobalCustomerId() { + return globalCustomerId; + } + + public void setGlobalCustomerId(String globalCustomerId) { + this.globalCustomerId = globalCustomerId; + } + + public String getSubscriberName() { + return subscriberName; + } + + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java new file mode 100644 index 0000000000..c1ba7dc614 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class ServiceInputParametersEntity { + @JsonProperty("GENERIC-RESOURCE-API:param") + private List<ParamEntity> paramList; + + public List<ParamEntity> getParamList() { + return paramList; + } + + public void setParamList(List<ParamEntity> paramList) { + this.paramList = paramList; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java new file mode 100644 index 0000000000..0bdb9cf565 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceRequestInputEntity { + + @JsonProperty("GENERIC-RESOURCE-API:service-instance-name") + private String serviceInstanceName; + + @JsonProperty("GENERIC-RESOURCE-API:service-input-parameters") + private ServiceInputParametersEntity serviceInputParametersEntity; + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public ServiceInputParametersEntity getServiceInputParametersEntity() { + return serviceInputParametersEntity; + } + + public void setServiceInputParametersEntity(ServiceInputParametersEntity serviceInputParametersEntity) { + this.serviceInputParametersEntity = serviceInputParametersEntity; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java new file mode 100644 index 0000000000..8a50f909f9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceResponseInformationEntity { + @JsonProperty("GENERIC-RESOURCE-API:instance-id") + private String instanceId; + + @JsonProperty("GENERIC-RESOURCE-API:object-path") + private String objectPath; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getObjectPath() { + return objectPath; + } + + public void setObjectPath(String objectPath) { + this.objectPath = objectPath; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java new file mode 100644 index 0000000000..ff3d3943e6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceTopologyOperationInputEntity { + @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") + private SdncRequestHeaderEntity sdncRequestHeader; + + @JsonProperty("GENERIC-RESOURCE-API:request-information") + private RequestInformationEntity requestInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-information") + private ServiceInformationEntity serviceInformation; + + @JsonProperty("GENERIC-RESOURCE-API:service-request-input") + private ServiceRequestInputEntity serviceRequestInput; + + public SdncRequestHeaderEntity getSdncRequestHeader() { + return sdncRequestHeader; + } + + public void setSdncRequestHeader(SdncRequestHeaderEntity sdncRequestHeader) { + this.sdncRequestHeader = sdncRequestHeader; + } + + public RequestInformationEntity getRequestInformation() { + return requestInformation; + } + + public void setRequestInformation(RequestInformationEntity requestInformation) { + this.requestInformation = requestInformation; + } + + public ServiceInformationEntity getServiceInformation() { + return serviceInformation; + } + + public void setServiceInformation(ServiceInformationEntity serviceInformation) { + this.serviceInformation = serviceInformation; + } + + public ServiceRequestInputEntity getServiceRequestInput() { + return serviceRequestInput; + } + + public void setServiceRequestInput(ServiceRequestInputEntity serviceRequestInput) { + this.serviceRequestInput = serviceRequestInput; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java new file mode 100644 index 0000000000..502b897def --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ServiceTopologyOperationOutputEntity { + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") + private String svcRequestId; + + @JsonProperty("GENERIC-RESOURCE-API:response-code") + private String responseCode; + + @JsonProperty("GENERIC-RESOURCE-API:response-message") + private String responseMessage; + + @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") + private String ackFinalIndicator; + + @JsonProperty("GENERIC-RESOURCE-API:service-response-information") + private ServiceResponseInformationEntity serviceResponseInformation; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getResponseCode() { + return responseCode; + } + + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + public String getResponseMessage() { + return responseMessage; + } + + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public ServiceResponseInformationEntity getServiceResponseInformation() { + return serviceResponseInformation; + } + + public void setServiceResponseInformation(ServiceResponseInformationEntity serviceResponseInformation) { + this.serviceResponseInformation = serviceResponseInformation; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/resources/dmaap.properties b/bpmn/so-bpmn-infrastructure-common/src/main/resources/dmaap.properties new file mode 100644 index 0000000000..a1286b056c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/resources/dmaap.properties @@ -0,0 +1,8 @@ +protocol=http +uriPathPrefix = events +eventReadyTopicName=unauthenticated.PNF_READY +consumerId=consumerId +consumerGroup=group +clientThreadDelayInSeconds=5 + +pnfDefaultTimeout=P14D |