diff options
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/java')
32 files changed, 630 insertions, 221 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java deleted file mode 100644 index 33b40b7bf0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java +++ /dev/null @@ -1,46 +0,0 @@ -/*-
- * ============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.openecomp.mso.bpmn.infrastructure.workflow.service;
-
-import javax.ws.rs.Path;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
-
-
-/**
- *
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
- *
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
- */
-@Path("/async")
-public class WorkflowAsyncInfrastructureResource extends WorkflowAsyncResource {
-
- protected ProcessEngineServices getProcessEngineServices() {
- return pes4junit.orElse(ProcessEngines.getProcessEngine("infrastructure"));
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java index 16811979c1..80b11bbdf5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java @@ -26,14 +26,10 @@ import java.util.Set; import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
-/**
- * @version 1.0
- * RESTeasy workflow application which wires synchronous and asynchronous response
- *
- */
@ApplicationPath("/")
public class WorkflowResourceApplication extends Application {
private Set<Object> singletons = new HashSet<Object>();
@@ -41,7 +37,7 @@ public class WorkflowResourceApplication extends Application { public WorkflowResourceApplication() {
singletons.add(new WorkflowResource());
- singletons.add(new WorkflowAsyncInfrastructureResource());
+ singletons.add(new WorkflowAsyncResource());
singletons.add(new WorkflowMessageResource());
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 4495e87789..6ca93f7238 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -20,9 +20,22 @@ package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +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.openecomp.mso.bpmn.core.BaseTask; @@ -31,10 +44,13 @@ import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.Generic import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.requestsdb.RequestsDbConstant; import org.openecomp.mso.requestsdb.ResourceOperationStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.IOException; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; /** @@ -42,36 +58,308 @@ import java.util.Map; */ public abstract class AbstractSdncOperationTask extends BaseTask { + private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class); + private static final String DEFAULT_MSB_IP = "127.0.0.1"; - private static final int DEFAULT_MSB_Port = 10081; + private static final int DEFAULT_MSB_Port = 80; private static final String SDCADAPTOR_INPUTS = "resourceParameters"; + public static final String ONAP_IP = "ONAP_IP"; private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); + private static final String postBodyTemplate = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/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 getBodyTemplate = " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/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 url = "http://mso:8080/dbadapters/RequestsDbAdapter"; + HttpPost httpPost = new HttpPost(url); + 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(url, httpPost); + logger.info("AbstractSdncOperationTask.updateResOperStatus end!"); + //requestsDB.updateResOperStatus(resourceOperationStatus); + } + + 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) { + e.printStackTrace(); + } + return postBody; + } + + protected String httpPost(String url, HttpPost httpPost) throws RouteException { + logger.info("AbstractSdncOperationTask.httpPost begin!"); + CloseableHttpClient httpClient = HttpClients.createDefault(); + String result = null; + boolean var15 = false; + + String errorMsg; + label91: { + try { + var15 = true; + CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); + result = EntityUtils.toString(closeableHttpResponse.getEntity()); + logger.info("result = {}", result); +// LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, result.toString(), "SDNC", ""); + if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { + logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode()); + throw new RouteException(result, "SERVICE_GET_ERR"); + } - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + closeableHttpResponse.close(); + var15 = false; + break label91; + } catch (IOException var19) { + errorMsg = url + ":httpPostWithJSON connect faild"; + logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg); + throwsRouteException(errorMsg, var19, "POST_CONNECT_FAILD"); + var15 = false; + } finally { + if(var15) { + try { + httpClient.close(); + } catch (IOException var16) { + String errorMsg1 = url + ":close httpClient faild"; + logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg1); + throwsRouteException(errorMsg1, var16, "CLOSE_CONNECT_FAILD"); + } + + } + } + + try { + httpClient.close(); + } catch (IOException var17) { + errorMsg = url + ":close httpClient faild"; + logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg); + throwsRouteException(errorMsg, var17, "CLOSE_CONNECT_FAILD"); + } + } + + try { + httpClient.close(); + } catch (IOException var18) { + errorMsg = url + ":close httpClient faild"; + logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg); + throwsRouteException(errorMsg, var18, "CLOSE_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 = new String(postBodyTemplate); + 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 = new String(getBodyTemplate); + 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 url = "http://mso:8080/dbadapters/RequestsDbAdapter"; + HttpPost httpPost = new HttpPost(url); + 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(url, httpPost); + ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result); + logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!"); + return resourceOperationStatus; + + //return requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + } + + private String httpGet(String url, HttpGet httpGet) throws RouteException { + logger.info("AbstractSdncOperationTask.httpGet begin!"); + boolean var16 = false; + CloseableHttpClient httpClient = HttpClients.createDefault(); + String result = ""; + String errorMsg; + label109: + { + label110: + { + try { + var16 = true; + CloseableHttpResponse e = httpClient.execute(httpGet); + result = EntityUtils.toString(e.getEntity()); + logger.info("result = {}", result); + if (e.getStatusLine().getStatusCode() != 200) { + logger.info("exception: fail for status code = {}", e.getStatusLine().getStatusCode()); + throw new RouteException(result, "SERVICE_GET_ERR"); + } + + e.close(); + var16 = false; + break label110; + } catch (ClientProtocolException var21) { + errorMsg = url + ":httpGetWithJSON connect faild"; + logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); + throwsRouteException(errorMsg, var21, "GET_CONNECT_FAILD"); + var16 = false; + } catch (IOException var22) { + errorMsg = url + ":httpGetWithJSON connect faild"; + logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); + throwsRouteException(errorMsg, var22, "GET_CONNECT_FAILD"); + var16 = false; + break label109; + } finally { + if (var16) { + try { + httpClient.close(); + } catch (IOException var17) { + String errorMsg1 = url + ":close httpClient faild"; + logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg1); + throwsRouteException(errorMsg1, var17, "CLOSE_CONNECT_FAILD"); + } + + } + } + + try { + httpClient.close(); + } catch (IOException var19) { + errorMsg = url + ":close httpClient faild"; + logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg); + throwsRouteException(errorMsg, var19, "CLOSE_CONNECT_FAILD"); + } + + } + + try { + httpClient.close(); + } catch (IOException var20) { + errorMsg = url + ":close httpClient faild"; + logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg); + throwsRouteException(errorMsg, var20, "CLOSE_CONNECT_FAILD"); + } + + } + + try { + httpClient.close(); + } catch (IOException var18) { + errorMsg = url + ":close httpClient faild"; + logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg); + throwsRouteException(errorMsg, var18, "CLOSE_CONNECT_FAILD"); + } + logger.info("AbstractSdncOperationTask.httpGet end!"); + return result; + } + + 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 ""; + } + + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); @Override public void execute(DelegateExecution execution) { + logger.info("AbstractSdncOperationTask.execute begin!"); GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(execution); - updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); +// updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); Map<String, String> inputs = getInputs(execution); - updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!"); +// updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!"); try { sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient); execution.setVariable("SDNCA_SuccessIndicator", true); - updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); +// updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); } catch (Exception e) { + logger.info("exception: AbstractSdncOperationTask.fail!"); + logger.error("exception: AbstractSdncOperationTask.fail!:", e); e.printStackTrace(); execution.setVariable("SDNCA_SuccessIndicator", false); } + 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); JSONObject jsonObject = new JSONObject(json); JSONObject paras = jsonObject.getJSONObject("additionalParamForNs"); - paras.keySet().stream().forEach(key -> inputs.put(key, paras.getString((String) key))); + Iterator<String> iterator = paras.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + inputs.put(key, paras.getString(key)); + } +/* if (paras.keys().hasNext()) { + paras.keySet().stream().forEach(key -> inputs.put(key, paras.getString((String) key))); + }*/ + logger.info("AbstractSdncOperationTask.getInputs end!"); return inputs; } @@ -84,35 +372,104 @@ public abstract class AbstractSdncOperationTask extends BaseTask { String errorCode, String progress, String statusDescription) { + logger.info("AbstractSdncOperationTask.updateProgress begin!"); String serviceId = (String) execution.getVariable("serviceId"); String operationId = (String) execution.getVariable("operationId"); - String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); - ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); - if (!StringUtils.isBlank(status)) { - resourceOperationStatus.setStatus(status); + String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); + 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) { + System.out.println(exception); + logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); + logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); } - if (!StringUtils.isBlank(errorCode)) { - resourceOperationStatus.setErrorCode(errorCode); + } + + + protected boolean isSend2SdncDirectly() { + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!"); + Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); + if (properties != null) { + String sdncIp = properties.get("sdnc-ip"); + String sdncPort = properties.get("sdnc-port"); + if (!StringUtils.isBlank(sdncIp) && isIp(sdncIp) && !StringUtils.isBlank(sdncPort)) { + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true."); + return true; + } } - if (!StringUtils.isBlank(progress)) { - resourceOperationStatus.setProgress(progress); + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false."); + return false; + } + + protected String getSdncIp() { + logger.info("AbstractSdncOperationTask.getSdncIp begin."); + String sdncIp = null; + Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); + if (properties != null) { + sdncIp = properties.get("sdnc-ip"); } - if (!StringUtils.isBlank(statusDescription)) { - resourceOperationStatus.setStatusDescription(statusDescription); + 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 = null; + Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); + if (properties != null) { + sdncPort = properties.get("sdnc-port"); } - requestsDB.updateResOperStatus(resourceOperationStatus); + String returnPort = StringUtils.isBlank(sdncPort) ? null : sdncPort; + logger.info("AbstractSdncOperationTask.getSdncPort: returnPort = {}", sdncPort); + return returnPort; } private GenericResourceApi getGenericResourceApiClient(DelegateExecution execution) { - updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!"); - Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - String msbIp = getString(properties, "msb.address", DEFAULT_MSB_IP); - int msbPort = Integer.valueOf(getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_Port))); + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!"); +// updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!"); + String msbIp = System.getenv().get(ONAP_IP); + int msbPort = DEFAULT_MSB_Port; + Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); + if (properties != null) { + if (StringUtils.isBlank(msbIp) || !isIp(msbIp)) { + msbIp = properties.get("msb-ip"); + if (StringUtils.isBlank(msbIp)) { + msbIp = getString(properties, "msb.address", DEFAULT_MSB_IP); + } + } + String strMsbPort = properties.get("msb-port"); + if (StringUtils.isBlank(strMsbPort)) { + strMsbPort = getString(properties, "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; + } + private String getString(Map<String, String> properties, String name, String defaultValue) { String vlaue = properties.get(name); try { @@ -121,7 +478,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } } catch (Exception e) { System.out.println(e); - logger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); } return defaultValue; } @@ -134,7 +491,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } } catch (Exception e) { System.out.println(e); - logger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); } return defaultValue; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 9e0b4f7806..e8bfcf5caa 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -20,13 +20,21 @@ package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask; +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.openecomp.mso.bpmn.core.WorkflowException; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; +import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; @@ -34,20 +42,48 @@ import java.util.Map; * Created by 10112215 on 2017/9/20. */ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask { + private static final Logger logger = 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 { + logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); updateProgress(execution, null, null, "50", "RequestBody build finished!"); - RpcNetworkTopologyOperationOutputEntity outputEntity = genericResourceApiClient.postNetworkTopologyOperation(inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); + 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); + } + logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + } + + private void Send2SdncDirectly(String defaulAuth, + RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { + logger.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); + LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody.toString(), "SDNC", ""); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(url, httpPost); + logger.info("SdncNetworkTopologyOperationTask.Send2SdncDirectly end!"); } private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws Exception { + logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); @@ -56,8 +92,11 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); + logger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); throw new Exception(""); } + updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + logger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index d6ccc8b03b..89d0958c75 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -21,14 +21,20 @@ package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask; +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.openecomp.mso.bpmn.core.WorkflowException; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.ServiceRpcInputEntityBuilder; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationOutputEntity; -import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceTopologyOperationOutputEntity; -import org.openecomp.mso.requestsdb.RequestsDbConstant; +import org.openecomp.mso.logger.MessageEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; @@ -36,20 +42,49 @@ import java.util.Map; * Created by 10112215 on 2017/9/26. */ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask { + private static final Logger logger = 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 { - updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); + logger.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 = genericResourceApiClient.postServiceTopologyOperation(inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); +// 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); + } + logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + + } + + private void Send2SdncDirectly(String defaulAuth, + RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { + logger.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); + LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody.toString(), "SDNC", ""); + httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); + httpPost(url, httpPost); + logger.info("SdncServiceTopologyOperationTask.Send2SdncDirectly end!"); } private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { + logger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); @@ -57,8 +92,10 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask 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); +// updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); + logger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); throw new Exception(""); } + logger.info("SdncServiceTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java index 8d2cb1ef7f..49d702d1ee 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils; import org.onap.msb.sdk.httpclient.RestServiceCreater; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; @@ -71,7 +72,8 @@ public class SdncUnderlayVpnOperationClient { updateProgress(null, null, "50", "RequestBody build finished!"); RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null; try { - networkRpcOutputEntiy = genericResourceApiClient.postNetworkTopologyOperation(body).execute().body(); + networkRpcOutputEntiy = genericResourceApiClient.postNetworkTopologyOperation + (HeaderUtil.DefaulAuth ,body).execute().body(); } catch (Exception e) { logger.debug("Exception: ", e); updateProgress(RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage()); diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java index 49ded45b4a..119ac42e76 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java @@ -41,7 +41,7 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask { private String getOperType(DelegateExecution execution) { String serviceId = (String) execution.getVariable("serviceId"); String operationId = (String) execution.getVariable("operationId"); - String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); + String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); return resourceOperationStatus.getOperType(); } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java index 62375afa20..23ad422599 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java @@ -26,6 +26,7 @@ import org.onap.msb.sdk.httpclient.annotaion.ServiceHttpEndPoint; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.*; import retrofit2.Call; import retrofit2.http.Body; +import retrofit2.http.Header; import retrofit2.http.POST; /** @@ -35,13 +36,16 @@ import retrofit2.http.POST; public interface GenericResourceApi { @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") - Call<ResponseBody> postNetworkTopologyOperation(@Body RequestBody input); + Call<ResponseBody> postNetworkTopologyOperation(@Header("Authorization") String authorization, + @Body RequestBody input); @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") - Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(@Body RpcNetworkTopologyOperationInputEntity input); + Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(@Header("Authorization") String authorization, + @Body RpcNetworkTopologyOperationInputEntity input); @POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation") - Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(@Body RpcServiceTopologyOperationInputEntity input); + Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(@Header("Authorization") String authorization, + @Body RpcServiceTopologyOperationInputEntity input); } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java new file mode 100644 index 0000000000..a43eb526a6 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/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.openecomp.mso.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/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java index 0634da7264..299c1c546b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -114,25 +114,25 @@ public abstract class AbstractBuilder<IN, OUT> { abstract OUT build(DelegateExecution execution, IN input) throws Exception; protected String getRequestActoin(DelegateExecution execution) { - String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.name(); + String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName(); String operType = (String) execution.getVariable(OPERATION_TYPE); String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase(); if (!StringUtils.isBlank(operType)) { - if (RequestsDbConstant.OperationType.DELETE.equals(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { if (isOverlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.DeActivateDCINetworkInstance.name(); + action = /*RequestInformation.*/RequestAction.DeActivateDCINetworkInstance.getName(); } else if (isUnderlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.DeleteNetworkInstance.name(); + action = /*RequestInformation.*/RequestAction.DeleteNetworkInstance.getName(); } else { - action = /*RequestInformation.*/RequestAction.DeleteServiceInstance.name(); + action = /*RequestInformation.*/RequestAction.DeleteServiceInstance.getName(); } - } else if (RequestsDbConstant.OperationType.CREATE.equals(operType)) { + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { if (isOverlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.ActivateDCINetworkInstance.name(); + action = /*RequestInformation.*/RequestAction.ActivateDCINetworkInstance.getName(); } else if (isUnderlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.name(); + action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName(); } else { - action = /*RequestInformation.*/RequestAction.CreateServiceInstance.name(); + action = /*RequestInformation.*/RequestAction.CreateServiceInstance.getName(); } } } @@ -148,21 +148,25 @@ public abstract class AbstractBuilder<IN, OUT> { } protected String getSvcAction(DelegateExecution execution) { - String action = /*SdncRequestHeader.*/SvcAction.Create.name(); + String action = /*SdncRequestHeader.*/SvcAction.Create.getName(); String operType = (String) execution.getVariable(OPERATION_TYPE); String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase(); if (!StringUtils.isBlank(operType)) { - if (RequestsDbConstant.OperationType.DELETE.equals(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { if (isOverlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.Deactivate.name(); + action = /*SdncRequestHeader.*/SvcAction.Deactivate.getName(); + } else if (isUnderlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.Delete.getName(); } else { - action = /*SdncRequestHeader.*/SvcAction.Delete.name(); + action = /*SdncRequestHeader.*/SvcAction.Unassign.getName(); } - } else if (RequestsDbConstant.OperationType.CREATE.equals(operType)) { + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { if (isOverlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.Activate.name(); + action = /*SdncRequestHeader.*/SvcAction.Activate.getName(); + } else if (isUnderlay(resourceType)) { + action = /*SdncRequestHeader.*/SvcAction.Create.getName(); } else { - action = /*SdncRequestHeader.*/SvcAction.Create.name(); + action = /*SdncRequestHeader.*/SvcAction.Assign.getName(); } } } @@ -179,13 +183,13 @@ public abstract class AbstractBuilder<IN, OUT> { return requestId; } - protected OnapModelInformationEntity getOnapModelInformationEntity(DelegateExecution execution) { + 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("modelName"); + String modelName = (String) execution.getVariable("serviceModelName"); onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); onapModelInformationEntity.setModelVersion(modelVersion); onapModelInformationEntity.setModelUuid(modelUuid); @@ -193,6 +197,21 @@ public abstract class AbstractBuilder<IN, OUT> { } 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("resourceType"); + 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<>(); @@ -218,9 +237,9 @@ public abstract class AbstractBuilder<IN, OUT> { protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) { ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity(); - serviceInformationEntity.setServiceId((String) execution.getVariable("productFamilyId")); - serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("subscriptionServiceType")); - serviceInformationEntity.setOnapModelInformation(getOnapModelInformationEntity(execution)); + serviceInformationEntity.setServiceId("VOLTE_SERVICE_ID"); + serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType")); + serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution)); serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId")); serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId")); return serviceInformationEntity; diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java index 94838ed1ff..8d0caaa765 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java @@ -47,6 +47,7 @@ public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, St List<ParamEntity> paramEntityList = getParamEntities(inputs); networkInputPaarametersEntity.setParamList(paramEntityList); } + networkRequestInputEntity.setNetworkInputPaarameters(networkInputPaarametersEntity); } networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity); } @@ -85,7 +86,7 @@ public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, St private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity(); { - OnapModelInformationEntity onapModelInformationEntity = getOnapModelInformationEntity(execution); + OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution); networkInformationEntity.setOnapModelInformation(onapModelInformationEntity); } networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity); diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java index 02ac6824a1..3d59d3b73e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java @@ -26,13 +26,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/20. */ public class NetworkInformationEntity { - @JsonProperty("network-id") + @JsonProperty("GENERIC-RESOURCE-API:network-id") private String networkId; - @JsonProperty("network-type") + @JsonProperty("GENERIC-RESOURCE-API:network-type") private String networkType; - @JsonProperty("onap-model-information") + @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") private OnapModelInformationEntity onapModelInformation; public String getNetworkId() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java index b45a21d3ac..f7b055efcf 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java @@ -36,6 +36,6 @@ public class NetworkInputPaarametersEntity { this.paramList = paramList; } - @JsonProperty("param") + @JsonProperty("GENERIC-RESOURCE-API:param") private List<ParamEntity> paramList; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java index 1aff6e948a..420d547a39 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java @@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/20. */ public class NetworkRequestInputEntity { - @JsonProperty("network-name") + @JsonProperty("GENERIC-RESOURCE-API:network-name") private String networkName; - @JsonProperty("tenant") + @JsonProperty("GENERIC-RESOURCE-API:tenant") private String tenant; - @JsonProperty("aic-cloud-region") + @JsonProperty("GENERIC-RESOURCE-API:aic-cloud-region") private String aicCloudRegion; - @JsonProperty("aic-clli") + @JsonProperty("GENERIC-RESOURCE-API:aic-clli") private String aicClli; - @JsonProperty("network-input-parameters") + @JsonProperty("GENERIC-RESOURCE-API:network-input-parameters") private NetworkInputPaarametersEntity networkInputPaarameters; public String getNetworkName() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java index 69ee28758d..aa8ea39cd1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java @@ -26,10 +26,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/22. */ public class NetworkResponseInformationEntity { - @JsonProperty("instance-id") + @JsonProperty("GENERIC-RESOURCE-API:instance-id") private String instanceId; - @JsonProperty("object-path") + @JsonProperty("GENERIC-RESOURCE-API:object-path") private String objectPath; public String getInstanceId() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java index 2fbc23e0cd..1ce0b455ed 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java @@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/20. */ public class NetworkTopologyOperationInputEntity { - @JsonProperty("sdnc-request-header") + @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") private SdncRequestHeaderEntity sdncRequestHeader; - @JsonProperty("request-information") + @JsonProperty("GENERIC-RESOURCE-API:request-information") private RequestInformationEntity requestInformation; - @JsonProperty("service-information") + @JsonProperty("GENERIC-RESOURCE-API:service-information") private ServiceInformationEntity serviceInformation; - @JsonProperty("network-information") + @JsonProperty("GENERIC-RESOURCE-API:network-information") private NetworkInformationEntity networkInformation; - @JsonProperty("network-request-input") + @JsonProperty("GENERIC-RESOURCE-API:network-request-input") private NetworkRequestInputEntity networkRequestInput; public SdncRequestHeaderEntity getSdncRequestHeader() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java index 4be0844fc9..c835efb9ed 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java @@ -26,22 +26,22 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/22. */ public class NetworkTopologyOperationOutputEntity { - @JsonProperty("svc-request-id") + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") private String svcRequestId; - @JsonProperty("response-code") + @JsonProperty("GENERIC-RESOURCE-API:response-code") private String responseCode; - @JsonProperty("response-message") + @JsonProperty("GENERIC-RESOURCE-API:response-message") private String responseMessage; - @JsonProperty("ack-final-indicator") + @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") private String ackFinalIndicator; - @JsonProperty("network-response-information") + @JsonProperty("GENERIC-RESOURCE-API:network-response-information") private NetworkResponseInformationEntity networkResponseInformation; - @JsonProperty("service-response-information") + @JsonProperty("GENERIC-RESOURCE-API:service-response-information") private ServiceResponseInformationEntity serviceResponseInformation; public String getSvcRequestId() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java index f061c9ab0a..eeb8eda61f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java @@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/20. */ public class OnapModelInformationEntity { - @JsonProperty("model-invariant-uuid") + @JsonProperty("GENERIC-RESOURCE-API:model-invariant-uuid") private String modelInvariantUuid; - @JsonProperty("model-customization-uuid") + @JsonProperty("GENERIC-RESOURCE-API:model-customization-uuid") private String modelCustomizationUuid; - @JsonProperty("model-uuid") + @JsonProperty("GENERIC-RESOURCE-API:model-uuid") private String modelUuid; - @JsonProperty("model-version") + @JsonProperty("GENERIC-RESOURCE-API:model-version") private String modelVersion; - @JsonProperty("model-name") + @JsonProperty("GENERIC-RESOURCE-API:model-name") private String modelName; public String getModelInvariantUuid() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java index 8c2f217839..b45a1c3265 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java @@ -26,10 +26,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/20. */ public class ParamEntity { - @JsonProperty("name") + @JsonProperty("GENERIC-RESOURCE-API:name") private String name; - @JsonProperty("value") + @JsonProperty("GENERIC-RESOURCE-API:value") private String value; public String getName() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java index 1538b64c54..2982e5afc5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java @@ -74,21 +74,21 @@ public class RequestInformationEntity { this.orerVersion = orerVersion; } - @JsonProperty("request-id") + @JsonProperty("GENERIC-RESOURCE-API:request-id") private String requestId; - @JsonProperty("request-action") + @JsonProperty("GENERIC-RESOURCE-API:request-action") private String requestAction; - @JsonProperty("source") + @JsonProperty("GENERIC-RESOURCE-API:source") private String source; - @JsonProperty("notification-url") + @JsonProperty("GENERIC-RESOURCE-API:notification-url") private String notificationUrl; - @JsonProperty("order-number") + @JsonProperty("GENERIC-RESOURCE-API:order-number") private String orderUnmber; - @JsonProperty("order-version") + @JsonProperty("GENERIC-RESOURCE-API:order-version") private String orerVersion; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java index ed8ae578a1..b20e9ab833 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java @@ -34,6 +34,6 @@ public class RpcNetworkTopologyOperationInputEntity { this.input = input; } - @JsonProperty("input") + @JsonProperty("GENERIC-RESOURCE-API:input") private NetworkTopologyOperationInputEntity input = null; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java index 745d6c66b5..40d336e000 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java @@ -34,6 +34,6 @@ public class RpcNetworkTopologyOperationOutputEntity { this.output = output; } - @JsonProperty("output") + @JsonProperty("GENERIC-RESOURCE-API:output") private NetworkTopologyOperationOutputEntity output; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java index 5b49e11efd..54933cce2a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java @@ -34,6 +34,6 @@ public class RpcServiceTopologyOperationInputEntity { this.serviceTopologyOperationInputEntity = serviceTopologyOperationInputEntity; } - @JsonProperty("input") + @JsonProperty("GENERIC-RESOURCE-API:input") private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java index c59cc4eed1..02fb1116e1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java @@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/26. */ public class RpcServiceTopologyOperationOutputEntity { - @JsonProperty("output") + @JsonProperty("GENERIC-RESOURCE-API:output") private ServiceTopologyOperationOutputEntity output; public ServiceTopologyOperationOutputEntity getOutput() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java index 1ea1045cc0..7e28aa07b6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java @@ -26,13 +26,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/20. */ public class SdncRequestHeaderEntity { - @JsonProperty("svc-request-id") + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") private String svcRequestId; - @JsonProperty("svc-action") + @JsonProperty("GENERIC-RESOURCE-API:svc-action") private String svcAction; - @JsonProperty("svc-notification-url") + @JsonProperty("GENERIC-RESOURCE-API:svc-notification-url") private String svcNotificationUrl; public String getSvcRequestId() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java index 58d50fa724..46b53902a4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java @@ -26,22 +26,22 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/20. */ public class ServiceInformationEntity { - @JsonProperty("service-id") + @JsonProperty("GENERIC-RESOURCE-API:service-id") private String serviceId; - @JsonProperty("subscription-service-type") + @JsonProperty("GENERIC-RESOURCE-API:subscription-service-type") private String subscriptionServiceType; - @JsonProperty("onap-model-information") + @JsonProperty("GENERIC-RESOURCE-API:onap-model-information") private OnapModelInformationEntity onapModelInformation; - @JsonProperty("service-instance-id") + @JsonProperty("GENERIC-RESOURCE-API:service-instance-id") private String serviceInstanceId; - @JsonProperty("global-customer-id") + @JsonProperty("GENERIC-RESOURCE-API:global-customer-id") private String globalCustomerId; - @JsonProperty("subscriber-name") + @JsonProperty("GENERIC-RESOURCE-API:subscriber-name") private String subscriberName; public String getServiceId() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java index 038c50c7c6..c056ffa5d9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java @@ -36,6 +36,6 @@ public class ServiceInputParametersEntity { this.paramList = paramList; } - @JsonProperty("param") + @JsonProperty("GENERIC-RESOURCE-API:param") private List<ParamEntity> paramList; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java index 576995df49..934a94610d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java @@ -27,10 +27,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; */ public class ServiceRequestInputEntity { - @JsonProperty("service-instance-name") + @JsonProperty("GENERIC-RESOURCE-API:service-instance-name") private String serviceInstanceName; - @JsonProperty("service-input-parameters") + @JsonProperty("GENERIC-RESOURCE-API:service-input-parameters") private ServiceInputParametersEntity serviceInputParametersEntity; public String getServiceInstanceName() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java index ade389b30e..ee0104bff0 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java @@ -26,10 +26,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/22. */ public class ServiceResponseInformationEntity { - @JsonProperty("instance-id") + @JsonProperty("GENERIC-RESOURCE-API:instance-id") private String instanceId; - @JsonProperty("object-path") + @JsonProperty("GENERIC-RESOURCE-API:object-path") private String objectPath; public String getInstanceId() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java index d817b0c52f..ba46eb7ee1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java @@ -26,16 +26,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/26. */ public class ServiceTopologyOperationInputEntity { - @JsonProperty("sdnc-request-header") + @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header") private SdncRequestHeaderEntity sdncRequestHeader; - @JsonProperty("request-information") + @JsonProperty("GENERIC-RESOURCE-API:request-information") private RequestInformationEntity requestInformation; - @JsonProperty("service-information") + @JsonProperty("GENERIC-RESOURCE-API:service-information") private ServiceInformationEntity serviceInformation; - @JsonProperty("service-request-input") + @JsonProperty("GENERIC-RESOURCE-API:service-request-input") private ServiceRequestInputEntity serviceRequestInput; public SdncRequestHeaderEntity getSdncRequestHeader() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java index ebc1ca807d..216a3d41bd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java @@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; * Created by 10112215 on 2017/9/26. */ public class ServiceTopologyOperationOutputEntity { - @JsonProperty("svc-request-id") + @JsonProperty("GENERIC-RESOURCE-API:svc-request-id") private String svcRequestId; - @JsonProperty("response-code") + @JsonProperty("GENERIC-RESOURCE-API:response-code") private String responseCode; - @JsonProperty("response-message") + @JsonProperty("GENERIC-RESOURCE-API:response-message") private String responseMessage; - @JsonProperty("ack-final-indicator") + @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator") private String ackFinalIndicator; - @JsonProperty("service-response-information") + @JsonProperty("GENERIC-RESOURCE-API:service-response-information") private ServiceResponseInformationEntity serviceResponseInformation; public String getSvcRequestId() { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java deleted file mode 100644 index f1224da30c..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java +++ /dev/null @@ -1,45 +0,0 @@ -/*
- * ============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.openecomp.mso.bpmn.vcpe.workflow;
-
-import javax.ws.rs.Path;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
-
-
-/**
- *
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
- *
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
- */
-@Path("/async")
-public class WorkflowAsyncVcpeResource extends WorkflowAsyncResource {
-
- protected ProcessEngineServices getProcessEngineServices() {
- return pes4junit.orElse(ProcessEngines.getProcessEngine("vcpe"));
- }
-}
|